Patch 17508: Blender Web Plugin - XEmbed. Enable XEmbed integration of blenderplayer...
[blender-staging.git] / intern / ghost / intern / GHOST_WindowX11.cpp
1 /**
2  * $Id$
3  * ***** BEGIN GPL LICENSE BLOCK *****
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software Foundation,
17  * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  *
19  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20  * All rights reserved.
21  *
22  * The Original Code is: all of this file.
23  *
24  * Contributor(s): none yet.
25  *
26  * ***** END GPL LICENSE BLOCK *****
27  */
28
29 #include "GHOST_WindowX11.h"
30 #include "GHOST_SystemX11.h"
31 #include "STR_String.h"
32 #include "GHOST_Debug.h"
33
34 // For standard X11 cursors
35 #include <X11/cursorfont.h>
36 #include <X11/Xatom.h>
37
38 #if defined(__sun__) || defined( __sun ) || defined (__sparc) || defined (__sparc__)
39 #include <strings.h>
40 #endif
41
42 #include <cstring>
43 #include <cstdio>
44
45 // For obscure full screen mode stuuf
46 // lifted verbatim from blut.
47
48 typedef struct {
49         long flags;
50         long functions;
51         long decorations;
52         long input_mode;
53 } MotifWmHints;
54
55 #define MWM_HINTS_DECORATIONS         (1L << 1)
56
57 /*
58 import bpy
59 I = bpy.data.images['blender.png'] # the 48x48 icon
60
61 # Write to a file that can be 
62 # used within static unsigned char BLENDER_ICON_48x48x24[] = {...}
63 f = open('/myicon.txt', 'w')
64 for j in xrange(48):
65         for k in xrange(48):
66                 v = I.getPixelI(j,47-k)
67                 v.pop()
68                 for p in v:
69                         f.write(str(hex(p))+',')
70
71         f.write('\n')
72 */
73
74 // See the python script above to regenerate the 48x48 icon within blender
75 #define BLENDER_ICON_WIDTH 48
76 #define BLENDER_ICON_HEIGHT 48
77 static unsigned char BLENDER_ICON_48x48x24[] = {
78 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
79 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x4f,0x2a,0xd,0xa7,0x5b,0x1f,0xb8,0x66,0x22,0x6c,0x3b,0x14,0x5,0x3,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
80 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x6f,0x3a,0x13,0xea,0x7f,0x2c,0xee,0x7e,0x2b,0xee,0x7e,0x2b,0xef,0x85,0x2e,0x5f,0x35,0x12,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
81 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x43,0x22,0xb,0xed,0x7f,0x2c,0xed,0x7c,0x2b,0xee,0x7f,0x2c,0xee,0x80,0x2c,0xee,0x80,0x2c,0xa8,0x5f,0x20,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
82 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x2e,0x16,0x6,0xd0,0x6f,0x26,0xed,0x7b,0x2a,0xed,0x7d,0x2b,0xee,0x7f,0x2c,0xee,0x80,0x2c,0xee,0x82,0x2d,0x9a,0x57,0x1d,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
83 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x17,0xb,0x4,0xb9,0x60,0x21,0xed,0x7a,0x2a,0xed,0x7b,0x2a,0xed,0x7e,0x2b,0xee,0x7f,0x2c,0xee,0x7f,0x2c,0xee,0x86,0x2e,0x4e,0x2b,0xe,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
84 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x1,0x0,0x0,0x96,0x4d,0x19,0xee,0x7a,0x2a,0xed,0x79,0x2a,0xed,0x7c,0x2b,0xed,0x7e,0x2b,0xed,0x7e,0x2b,0xef,0x83,0x2d,0x98,0x55,0x1c,0x3,0x1,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
85 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x20,0xf,0x5,0x4b,0x27,0xe,0x21,0x11,0x5,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x67,0x34,0x11,0xed,0x7b,0x2a,0xec,0x79,0x29,0xed,0x7b,0x2a,0xed,0x7c,0x2b,0xed,0x7d,0x2b,0xee,0x7f,0x2c,0xbb,0x69,0x24,0x11,0x9,0x3,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
86 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x38,0x1c,0x9,0xc9,0x6d,0x2c,0xf1,0x86,0x36,0xd7,0x79,0x2a,0x22,0x12,0x5,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x3b,0x1d,0x9,0xe0,0x74,0x27,0xed,0x7a,0x2a,0xed,0x7c,0x2a,0xed,0x7d,0x2b,0xed,0x7d,0x2b,0xed,0x7d,0x2b,0xdc,0x7a,0x2a,0x1e,0xf,0x5,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
87 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xa6,0x56,0x23,0xee,0x83,0x3b,0xed,0x7d,0x2c,0xf0,0x85,0x2e,0x75,0x43,0x17,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x25,0x12,0x5,0xc9,0x68,0x24,0xed,0x7b,0x2a,0xed,0x7d,0x2b,0xed,0x7e,0x2b,0xee,0x7e,0x2c,0xed,0x7d,0x2b,0xe3,0x7d,0x2b,0x3b,0x1f,0xa,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
88 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x1c,0xd,0x4,0xd9,0x74,0x35,0xee,0x83,0x3a,0xee,0x7f,0x2b,0xf0,0x86,0x2e,0x83,0x4d,0x1a,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xa,0x5,0x1,0xa1,0x54,0x1c,0xee,0x7e,0x2c,0xed,0x7e,0x2c,0xed,0x7f,0x2c,0xed,0x80,0x2c,0xed,0x7f,0x2b,0xec,0x81,0x2d,0x60,0x33,0x11,0x1,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
89 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x24,0x11,0x5,0xe0,0x7a,0x38,0xee,0x84,0x3a,0xee,0x82,0x2c,0xf0,0x88,0x2f,0x82,0x4d,0x1a,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x6f,0x39,0x13,0xef,0x82,0x30,0xed,0x82,0x2f,0xee,0x82,0x2e,0xee,0x82,0x2d,0xee,0x81,0x2c,0xf0,0x83,0x2d,0x88,0x49,0x18,0x3,0x2,0x1,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
90 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x24,0x11,0x5,0xe0,0x7c,0x3a,0xee,0x86,0x3b,0xee,0x84,0x2d,0xf1,0x8b,0x30,0x82,0x4d,0x1a,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0x54,0x2b,0xf,0xe9,0x80,0x30,0xee,0x87,0x33,0xef,0x88,0x32,0xef,0x88,0x30,0xee,0x85,0x2f,0xef,0x83,0x2e,0xae,0x5f,0x20,0x4,0x2,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
91 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x24,0x11,0x5,0xe0,0x7e,0x3d,0xef,0x8a,0x3d,0xef,0x88,0x2e,0xf1,0x8d,0x31,0x81,0x4d,0x1a,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0x29,0x15,0x7,0xd2,0x74,0x2d,0xf0,0x8b,0x36,0xf0,0x8d,0x35,0xef,0x8d,0x35,0xef,0x8b,0x33,0xef,0x88,0x30,0xc4,0x6d,0x26,0x18,0xc,0x4,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
92 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x24,0x11,0x5,0xe1,0x80,0x3f,0xf0,0x8d,0x3f,0xef,0x8a,0x2f,0xf1,0x8f,0x32,0x81,0x4e,0x1a,0x0,0x0,0x0,0x0,0x0,0x0,0x9,0x3,0x0,0xb1,0x61,0x26,0xf1,0x8e,0x3a,0xf1,0x90,0x3a,0xf0,0x90,0x38,0xf0,0x90,0x36,0xef,0x8e,0x35,0xd3,0x7a,0x2c,0x22,0x11,0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
93 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x24,0x12,0x5,0xe1,0x83,0x42,0xf0,0x90,0x42,0xf0,0x8d,0x30,0xf2,0x92,0x33,0x80,0x4e,0x1b,0x0,0x0,0x0,0x3,0x2,0x0,0x81,0x45,0x1b,0xf1,0x90,0x3e,0xf1,0x94,0x3d,0xf1,0x95,0x3c,0xf0,0x94,0x3b,0xf0,0x92,0x39,0xf0,0x90,0x35,0xd0,0x7b,0x2b,0xc2,0x6e,0x26,0xbe,0x6c,0x25,0x94,0x54,0x1c,0x5b,0x33,0x11,0x1a,0xe,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
94 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x25,0x14,0x6,0xe2,0x86,0x44,0xf1,0x94,0x45,0xf0,0x90,0x31,0xf2,0x94,0x33,0x80,0x4e,0x1b,0x0,0x0,0x0,0x60,0x34,0x14,0xed,0x8c,0x3e,0xf0,0x96,0x42,0xf1,0x97,0x40,0xf1,0x95,0x3f,0xf0,0x91,0x39,0xef,0x8e,0x33,0xef,0x8d,0x31,0xf0,0x8d,0x31,0xef,0x8c,0x30,0xef,0x8c,0x30,0xf0,0x8d,0x31,0xf1,0x8e,0x31,0xe1,0x85,0x2e,0x92,0x55,0x1d,0x25,0x14,0x7,0x1,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
95 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x26,0x14,0x6,0xe2,0x89,0x46,0xf2,0x97,0x47,0xf1,0x92,0x32,0xf2,0x96,0x34,0x80,0x4e,0x1a,0x32,0x1a,0xa,0xe3,0x87,0x3d,0xf1,0x97,0x45,0xf1,0x98,0x44,0xf1,0x95,0x41,0xf0,0x90,0x39,0xef,0x8d,0x30,0xef,0x8f,0x31,0xf0,0x90,0x32,0xf0,0x92,0x33,0xf1,0x93,0x33,0xf1,0x94,0x34,0xf1,0x94,0x34,0xf0,0x93,0x34,0xf0,0x91,0x32,0xf1,0x91,0x33,0xe2,0x8a,0x30,0x6b,0x3f,0x15,0x1,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
96 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x26,0x14,0x6,0xe3,0x8b,0x49,0xf2,0x9a,0x49,0xf1,0x93,0x32,0xf2,0x98,0x35,0x8f,0x57,0x1d,0xcf,0x7c,0x38,0xf2,0x99,0x48,0xf1,0x98,0x47,0xf1,0x96,0x44,0xf0,0x90,0x39,0xef,0x8d,0x31,0xf0,0x90,0x31,0xf0,0x92,0x33,0xf1,0x94,0x33,0xf1,0x96,0x35,0xf1,0x98,0x35,0xf1,0x9a,0x36,0xf1,0x9c,0x37,0xf2,0x9d,0x37,0xf2,0x9c,0x37,0xf2,0x99,0x36,0xf0,0x94,0x34,0xf3,0x97,0x35,0x9f,0x60,0x21,0x13,0xb,0x3,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
97 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x26,0x14,0x6,0xe3,0x8d,0x4b,0xf2,0x9b,0x4c,0xf1,0x93,0x32,0xf1,0x97,0x35,0xea,0x98,0x43,0xf2,0x9d,0x4d,0xf1,0x9a,0x4b,0xf1,0x99,0x49,0xf0,0x93,0x3d,0xf0,0x8d,0x30,0xf0,0x90,0x32,0xf0,0x92,0x32,0xf0,0x94,0x34,0xf1,0x96,0x34,0xf1,0x98,0x36,0xf1,0x9a,0x36,0xf2,0x9c,0x38,0xf2,0x9f,0x38,0xf2,0xa2,0x39,0xf3,0xa2,0x39,0xf3,0xa2,0x39,0xf2,0x9f,0x38,0xf1,0x99,0x35,0xf2,0x97,0x35,0xba,0x74,0x29,0x13,0xb,0x4,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
98 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x26,0x14,0x6,0xe4,0x8e,0x4d,0xf2,0x9d,0x4e,0xf1,0x93,0x32,0xf2,0x9d,0x3f,0xf3,0xa4,0x54,0xf2,0x9d,0x50,0xf1,0x9b,0x4d,0xf2,0x98,0x46,0xef,0x8d,0x31,0xf0,0x8f,0x31,0xf0,0x91,0x32,0xf0,0x93,0x32,0xf1,0x94,0x32,0xf1,0x95,0x32,0xf1,0x98,0x34,0xf1,0x9b,0x36,0xf2,0x9e,0x38,0xf2,0xa1,0x39,0xf2,0xa4,0x3a,0xf3,0xa6,0x3b,0xf4,0xa8,0x3c,0xf3,0xa7,0x3c,0xf3,0xa4,0x3a,0xf2,0x9c,0x37,0xf2,0x99,0x36,0xa9,0x69,0x25,0x2,0x1,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
99 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x26,0x14,0x6,0xe4,0x90,0x50,0xf2,0x9e,0x51,0xf1,0x95,0x35,0xf4,0xa6,0x54,0xf3,0xa2,0x55,0xf2,0x9e,0x51,0xf2,0x9c,0x4e,0xf0,0x8f,0x35,0xf0,0x8e,0x31,0xf0,0x90,0x32,0xf3,0xa5,0x56,0xf7,0xc4,0x8e,0xfa,0xd8,0xb6,0xfb,0xdf,0xc2,0xfa,0xd8,0xb2,0xf7,0xc4,0x89,0xf4,0xae,0x59,0xf2,0xa1,0x38,0xf3,0xa5,0x3b,0xf4,0xa8,0x3c,0xf4,0xab,0x3d,0xf4,0xac,0x3e,0xf4,0xab,0x3d,0xf3,0xa7,0x3b,0xf2,0x9e,0x38,0xf4,0x9e,0x38,0x6f,0x45,0x17,0x1,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
100 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x19,0xc,0x5,0x63,0x36,0x18,0x3f,0x20,0x9,0x2,0x1,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x26,0x14,0x6,0xe4,0x91,0x52,0xf3,0xa2,0x55,0xf2,0x9d,0x43,0xf4,0xa7,0x5b,0xf3,0xa2,0x57,0xf3,0xa0,0x55,0xf1,0x97,0x43,0xf0,0x8d,0x30,0xf2,0x9d,0x4c,0xfa,0xda,0xbc,0xfe,0xfb,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfb,0xf6,0xfa,0xdc,0xb5,0xf4,0xae,0x4e,0xf4,0xa9,0x3c,0xf4,0xac,0x3d,0xf4,0xae,0x3f,0xf4,0xaf,0x3f,0xf4,0xad,0x3f,0xf3,0xa8,0x3d,0xf2,0x9d,0x38,0xe2,0x94,0x34,0x23,0x14,0x6,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
101 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x11,0x8,0x3,0x9e,0x62,0x39,0xf2,0x91,0x4e,0xe7,0x79,0x29,0x48,0x25,0xc,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0x27,0x13,0x6,0xe5,0x93,0x54,0xf3,0xa7,0x59,0xf4,0xa6,0x56,0xf4,0xa7,0x5d,0xf3,0xa4,0x59,0xf3,0xa2,0x57,0xf1,0x90,0x36,0xf4,0xa7,0x5d,0xfe,0xf4,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0xf2,0xe3,0xf6,0xb8,0x5f,0xf4,0xac,0x3e,0xf4,0xaf,0x3f,0xf4,0xb1,0x40,0xf4,0xb2,0x40,0xf5,0xaf,0x3f,0xf3,0xa6,0x3c,0xf3,0x9f,0x38,0x90,0x5d,0x21,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
102 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x3d,0x1f,0xf,0xed,0x9c,0x6a,0xef,0x8b,0x4a,0xec,0x78,0x29,0xe4,0x79,0x2a,0x29,0x15,0x7,0x0,0x0,0x0,0xff,0x0,0xff,0x28,0x14,0x6,0xe6,0x97,0x57,0xf5,0xad,0x63,0xf5,0xac,0x62,0xf4,0xa8,0x5f,0xf4,0xa6,0x5c,0xf3,0xa0,0x53,0xf4,0xa9,0x64,0xfe,0xf8,0xf4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xff,0xf2,0xf7,0xfa,0xed,0xf4,0xf8,0xfd,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf7,0xed,0xf5,0xb5,0x53,0xf5,0xb0,0x3f,0xf5,0xb3,0x41,0xf5,0xb4,0x42,0xf5,0xb3,0x41,0xf4,0xad,0x3f,0xf3,0xa1,0x39,0xe4,0x98,0x37,0x1d,0x11,0x5,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
103 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x43,0x23,0x10,0xf2,0xa1,0x70,0xf1,0x99,0x61,0xec,0x78,0x2a,0xed,0x7b,0x2a,0xc4,0x69,0x23,0x15,0xa,0x3,0x0,0x0,0x0,0x1d,0xf,0x5,0xe7,0x9b,0x5b,0xf5,0xb1,0x68,0xf5,0xad,0x65,0xf4,0xaa,0x62,0xf4,0xa8,0x5f,0xf3,0xa4,0x59,0xfd,0xec,0xde,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xfd,0xfe,0xc3,0xda,0xe9,0x5c,0x9a,0xc5,0x2a,0x7b,0xb4,0x17,0x6f,0xae,0x36,0x81,0xb8,0x91,0xbb,0xd9,0xf0,0xf6,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xe7,0xc7,0xf5,0xb2,0x43,0xf6,0xb3,0x41,0xf5,0xb5,0x43,0xf5,0xb6,0x43,0xf5,0xb3,0x42,0xf4,0xa8,0x3c,0xf4,0xa2,0x3a,0x66,0x41,0x17,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
104 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x22,0x10,0x7,0xd6,0x88,0x5b,0xf2,0xa5,0x76,0xee,0x84,0x3f,0xed,0x7a,0x2a,0xee,0x80,0x2c,0xa5,0x59,0x1e,0x7,0x3,0x1,0x19,0xd,0x4,0xe7,0x9e,0x5e,0xf6,0xb2,0x6b,0xf5,0xae,0x67,0xf5,0xac,0x65,0xf4,0xa9,0x61,0xf8,0xcc,0xa1,0xff,0xff,0xfe,0xff,0xff,0xff,0xfd,0xfe,0xfe,0x97,0xbf,0xdb,0x33,0x83,0xbb,0x24,0x7e,0xb9,0x3,0x6a,0xae,0x0,0x66,0xab,0x0,0x64,0xa9,0x1,0x63,0xa9,0x3c,0x87,0xbd,0xee,0xf5,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xf8,0xc7,0x76,0xf6,0xb4,0x41,0xf5,0xb7,0x43,0xf6,0xb8,0x44,0xf6,0xb6,0x43,0xf5,0xae,0x3f,0xf3,0xa2,0x3a,0xac,0x71,0x29,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
105 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x52,0x2c,0x16,0xf0,0xa1,0x71,0xf2,0xa2,0x6f,0xed,0x7e,0x32,0xed,0x7e,0x2b,0xef,0x82,0x2d,0x8a,0x49,0x18,0x1b,0xe,0x4,0xe7,0xa2,0x61,0xf6,0xb3,0x6e,0xf6,0xb0,0x6a,0xf5,0xae,0x67,0xf5,0xab,0x64,0xfe,0xf4,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xb4,0xd1,0xe5,0x3e,0x8d,0xc3,0x37,0x8e,0xc5,0x16,0x7a,0xb9,0x0,0x6b,0xaf,0x0,0x68,0xac,0x0,0x65,0xaa,0x0,0x65,0xab,0x0,0x66,0xac,0x4d,0x93,0xc4,0xf8,0xfb,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xe7,0xc5,0xf6,0xb3,0x40,0xf6,0xb7,0x43,0xf6,0xb9,0x44,0xf6,0xb8,0x45,0xf5,0xb2,0x41,0xf3,0xa5,0x3b,0xe2,0x98,0x37,0x3,0x1,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
106 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x86,0x4e,0x2e,0xf3,0xa6,0x77,0xf1,0x9e,0x66,0xed,0x7e,0x2d,0xee,0x82,0x2c,0xf0,0x85,0x2d,0x7e,0x47,0x17,0xe8,0xa6,0x64,0xf6,0xb5,0x70,0xf6,0xb2,0x6d,0xf5,0xb0,0x6a,0xf7,0xbb,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xf9,0xfb,0xfd,0x5b,0x9c,0xca,0x42,0x96,0xcb,0x3c,0x93,0xc9,0x9,0x73,0xb6,0x0,0x6b,0xb0,0x0,0x69,0xad,0x0,0x66,0xab,0x0,0x66,0xab,0x0,0x67,0xad,0x4,0x6a,0xaf,0xbb,0xd7,0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf8,0xee,0xf6,0xb9,0x4f,0xf6,0xb7,0x44,0xf6,0xba,0x45,0xf6,0xba,0x45,0xf5,0xb5,0x43,0xf4,0xa8,0x3d,0xf5,0xa7,0x3d,0x1b,0xf,0x4,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
107 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x11,0x8,0x3,0xb0,0x6d,0x45,0xf4,0xaa,0x7b,0xf1,0x9a,0x5b,0xee,0x82,0x2d,0xef,0x86,0x2e,0xee,0x91,0x36,0xf5,0xb5,0x70,0xf6,0xb7,0x73,0xf6,0xb4,0x70,0xf5,0xb1,0x6c,0xf9,0xcc,0xa1,0xff,0xff,0xff,0xff,0xff,0xff,0xd1,0xe2,0xef,0x4b,0x97,0xca,0x47,0x9a,0xce,0x3f,0x95,0xcb,0x3,0x71,0xb5,0x0,0x6c,0xb0,0x0,0x69,0xae,0x0,0x67,0xac,0x0,0x66,0xac,0x0,0x67,0xad,0x0,0x69,0xaf,0x66,0xa5,0xcf,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0xfa,0xf8,0xc3,0x67,0xf6,0xb8,0x44,0xf6,0xba,0x45,0xf6,0xbb,0x46,0xf6,0xb7,0x44,0xf4,0xab,0x3e,0xf8,0xab,0x3f,0x2a,0x19,0x8,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
108 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x2b,0x15,0x9,0xd4,0x8a,0x5c,0xf4,0xac,0x7c,0xf1,0x98,0x54,0xee,0x85,0x2e,0xf1,0x93,0x38,0xf6,0xba,0x75,0xf6,0xb9,0x75,0xf6,0xb6,0x72,0xf6,0xb3,0x6f,0xfa,0xd5,0xb1,0xff,0xff,0xff,0xff,0xff,0xff,0xb0,0xcf,0xe5,0x51,0x9e,0xcf,0x4b,0x9d,0xd0,0x43,0x97,0xcc,0x3,0x71,0xb5,0x0,0x6d,0xb1,0x0,0x6a,0xae,0x0,0x67,0xac,0x0,0x67,0xad,0x0,0x68,0xae,0x0,0x6a,0xb0,0x3b,0x8c,0xc2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf9,0xc9,0x77,0xf6,0xb8,0x44,0xf6,0xba,0x45,0xf6,0xbc,0x46,0xf6,0xb8,0x44,0xf4,0xad,0x3f,0xf8,0xac,0x3f,0x2a,0x1a,0x8,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
109 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x47,0x26,0x12,0xee,0xa3,0x72,0xf4,0xae,0x7b,0xf1,0x97,0x4e,0xf1,0x92,0x38,0xf6,0xbb,0x78,0xf6,0xbb,0x78,0xf6,0xb7,0x75,0xf6,0xb5,0x71,0xfa,0xd6,0xb2,0xff,0xff,0xff,0xff,0xff,0xff,0xad,0xcd,0xe4,0x54,0xa0,0xd1,0x4e,0xa0,0xd1,0x48,0x9b,0xce,0xb,0x76,0xb8,0x0,0x6d,0xb2,0x0,0x6a,0xaf,0x0,0x68,0xad,0x0,0x68,0xad,0x0,0x69,0xae,0x0,0x6b,0xb1,0x36,0x89,0xc1,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xf9,0xc9,0x76,0xf6,0xb9,0x44,0xf6,0xbb,0x46,0xf6,0xbc,0x47,0xf6,0xb9,0x44,0xf4,0xad,0x3f,0xf8,0xad,0x40,0x2a,0x1a,0x8,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
110 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x70,0x42,0x26,0xf4,0xad,0x7b,0xf5,0xb1,0x7d,0xf3,0x9f,0x50,0xf7,0xbc,0x7b,0xf7,0xbc,0x7b,0xf6,0xb9,0x78,0xf6,0xb7,0x74,0xf9,0xd0,0xa6,0xff,0xff,0xff,0xff,0xff,0xff,0xc3,0xda,0xeb,0x56,0xa0,0xd0,0x51,0xa1,0xd2,0x4a,0x9c,0xcf,0x20,0x82,0xbf,0x0,0x6e,0xb2,0x0,0x6b,0xb0,0x0,0x68,0xae,0x0,0x68,0xae,0x0,0x69,0xaf,0x0,0x6b,0xb1,0x50,0x98,0xc9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0xf9,0xf8,0xc3,0x66,0xf6,0xb9,0x45,0xf7,0xbb,0x46,0xf6,0xbc,0x47,0xf6,0xb8,0x45,0xf4,0xad,0x3f,0xf8,0xac,0x3f,0x2a,0x19,0x7,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
111 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xc,0x5,0x0,0xa5,0x67,0x40,0xf5,0xb1,0x7f,0xf5,0xb7,0x7e,0xf7,0xbf,0x80,0xf7,0xbe,0x7d,0xf7,0xbb,0x7b,0xf6,0xb9,0x78,0xf8,0xc2,0x8b,0xff,0xff,0xff,0xff,0xff,0xff,0xee,0xf5,0xf9,0x5b,0xa0,0xce,0x53,0xa2,0xd2,0x4c,0x9e,0xd0,0x3c,0x93,0xc8,0x6,0x71,0xb4,0x0,0x6c,0xb0,0x0,0x69,0xae,0x0,0x69,0xae,0x0,0x6a,0xaf,0x0,0x6b,0xb1,0x9b,0xc5,0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf7,0xec,0xf6,0xba,0x4e,0xf6,0xb9,0x45,0xf7,0xbb,0x46,0xf6,0xbc,0x47,0xf5,0xb7,0x44,0xf4,0xab,0x3e,0xf5,0xa8,0x3e,0x18,0xd,0x4,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
112 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x1f,0x10,0x7,0xc9,0x84,0x56,0xf5,0xb5,0x81,0xf7,0xbf,0x82,0xf8,0xc0,0x80,0xf7,0xbd,0x7d,0xf7,0xba,0x7a,0xf6,0xb8,0x77,0xfe,0xf5,0xec,0xff,0xff,0xff,0xff,0xff,0xff,0x9a,0xc2,0xdf,0x55,0x9f,0xd0,0x4e,0x9f,0xd0,0x47,0x99,0xcc,0x2a,0x87,0xc1,0x3,0x6d,0xb1,0x0,0x69,0xaf,0x0,0x6a,0xaf,0x0,0x6a,0xb0,0x27,0x80,0xbc,0xec,0xf4,0xf9,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xe5,0xbf,0xf6,0xb6,0x42,0xf6,0xba,0x46,0xf7,0xbb,0x46,0xf7,0xbb,0x47,0xf5,0xb5,0x43,0xf3,0xa8,0x3d,0xdd,0x97,0x37,0x2,0x1,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
113 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x32,0x1a,0xb,0xe4,0x9d,0x6a,0xf7,0xbd,0x84,0xf8,0xc1,0x83,0xf8,0xbe,0x80,0xf7,0xbd,0x7d,0xf7,0xba,0x79,0xfa,0xd9,0xb6,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xf6,0xfa,0x74,0xac,0xd4,0x4f,0x9b,0xcd,0x48,0x99,0xcc,0x41,0x94,0xc8,0x2c,0x85,0xbe,0xb,0x70,0xb3,0x1,0x6a,0xb0,0xb,0x6e,0xb2,0xbf,0xd9,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xf8,0xc8,0x74,0xf6,0xb7,0x44,0xf6,0xba,0x46,0xf7,0xbb,0x46,0xf7,0xb9,0x46,0xf6,0xb2,0x42,0xf4,0xa7,0x3d,0xa6,0x70,0x29,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
114 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x4f,0x2e,0x18,0xef,0xaf,0x78,0xf8,0xc1,0x85,0xf8,0xc0,0x82,0xf7,0xbe,0x7f,0xf7,0xbc,0x7d,0xf7,0xbe,0x81,0xfe,0xf3,0xe8,0xff,0xff,0xff,0xff,0xff,0xff,0xf2,0xf7,0xfa,0x91,0xbd,0xdb,0x4f,0x97,0xc8,0x40,0x8e,0xc3,0x37,0x8a,0xc0,0x34,0x88,0xbf,0x57,0x9c,0xca,0xcc,0xe1,0xef,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0xe4,0xbf,0xf5,0xb6,0x45,0xf6,0xb8,0x45,0xf6,0xba,0x46,0xf7,0xba,0x46,0xf6,0xb7,0x45,0xf5,0xad,0x3f,0xf4,0xa9,0x40,0x5c,0x3d,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
115 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x85,0x55,0x31,0xf7,0xbd,0x84,0xf8,0xc2,0x85,0xf8,0xc0,0x82,0xf7,0xbe,0x80,0xf7,0xbc,0x7d,0xf9,0xcb,0x99,0xfe,0xf9,0xf4,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0xfe,0xfe,0xe5,0xef,0xf6,0xc1,0xda,0xeb,0xba,0xd5,0xe9,0xd8,0xe8,0xf2,0xf9,0xfb,0xfd,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xf3,0xe4,0xf6,0xb9,0x51,0xf5,0xb5,0x43,0xf6,0xb8,0x45,0xf6,0xb9,0x46,0xf6,0xb8,0x46,0xf6,0xb3,0x43,0xf4,0xa7,0x3e,0xdf,0x9d,0x43,0x17,0xd,0x4,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
116 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x14,0xa,0x4,0xb2,0x7b,0x4b,0xf8,0xc2,0x88,0xf8,0xc1,0x85,0xf7,0xbf,0x82,0xf7,0xbe,0x80,0xf7,0xbd,0x7d,0xf9,0xca,0x97,0xfe,0xf9,0xf4,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfd,0xf2,0xe1,0xf7,0xbc,0x5d,0xf5,0xb3,0x42,0xf5,0xb6,0x44,0xf5,0xb7,0x45,0xf6,0xb8,0x45,0xf6,0xb5,0x44,0xf5,0xad,0x40,0xf6,0xae,0x4c,0x88,0x5d,0x27,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
117 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x1d,0x10,0x6,0xdb,0xa0,0x68,0xf8,0xc3,0x88,0xf7,0xc1,0x85,0xf7,0xc0,0x82,0xf7,0xbf,0x80,0xf7,0xbe,0x7e,0xf8,0xc4,0x88,0xfc,0xe6,0xcc,0xfe,0xfb,0xf7,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfa,0xf3,0xfa,0xda,0xa9,0xf5,0xb3,0x4a,0xf5,0xb2,0x42,0xf5,0xb3,0x43,0xf5,0xb6,0x44,0xf5,0xb7,0x45,0xf5,0xb5,0x44,0xf5,0xb0,0x42,0xf5,0xad,0x4d,0xdd,0x9e,0x4a,0x19,0xf,0x5,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
118 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x50,0x33,0x19,0xec,0xb4,0x7a,0xf8,0xc2,0x87,0xf7,0xc1,0x85,0xf7,0xc1,0x83,0xf7,0xc0,0x80,0xf7,0xc0,0x7f,0xf7,0xc0,0x7c,0xf7,0xc2,0x7e,0xf8,0xcc,0x92,0xfa,0xda,0xb0,0xfb,0xdf,0xb9,0xfa,0xd9,0xad,0xf7,0xc8,0x84,0xf5,0xb4,0x54,0xf4,0xad,0x3f,0xf4,0xaf,0x41,0xf5,0xb2,0x42,0xf5,0xb4,0x43,0xf5,0xb5,0x44,0xf5,0xb4,0x44,0xf5,0xb2,0x46,0xf5,0xb2,0x54,0xf5,0xb4,0x5a,0x5e,0x3e,0x1a,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
119 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x71,0x4b,0x29,0xf8,0xc0,0x86,0xf7,0xc3,0x87,0xf7,0xc2,0x85,0xf7,0xc1,0x83,0xf7,0xc2,0x82,0xf7,0xc2,0x7f,0xf7,0xc2,0x7e,0xf6,0xc0,0x76,0xf4,0xb4,0x59,0xf3,0xa8,0x3e,0xf3,0xa7,0x39,0xf3,0xa9,0x3d,0xf4,0xab,0x3e,0xf4,0xad,0x40,0xf4,0xb0,0x41,0xf4,0xb2,0x42,0xf5,0xb2,0x42,0xf5,0xb3,0x45,0xf6,0xb7,0x54,0xf6,0xb7,0x60,0xf6,0xb5,0x5f,0x9d,0x6b,0x31,0x2,0x1,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
120 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x8b,0x5f,0x36,0xf9,0xc1,0x87,0xf7,0xc3,0x88,0xf8,0xc3,0x86,0xf7,0xc3,0x84,0xf8,0xc3,0x81,0xf7,0xc4,0x80,0xf7,0xc4,0x7e,0xf7,0xc4,0x7d,0xf7,0xc3,0x7a,0xf6,0xbd,0x6c,0xf5,0xb7,0x5c,0xf5,0xb5,0x54,0xf5,0xb4,0x50,0xf5,0xb6,0x52,0xf6,0xb9,0x58,0xf6,0xbd,0x62,0xf7,0xbf,0x6a,0xf6,0xba,0x66,0xf6,0xb6,0x63,0xab,0x78,0x39,0xa,0x6,0x2,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
121 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x83,0x58,0x32,0xf0,0xb9,0x7f,0xf7,0xc3,0x88,0xf7,0xc3,0x86,0xf8,0xc4,0x84,0xf7,0xc5,0x82,0xf7,0xc5,0x80,0xf7,0xc5,0x7f,0xf8,0xc5,0x7d,0xf7,0xc4,0x7b,0xf7,0xc4,0x79,0xf7,0xc4,0x78,0xf7,0xc3,0x76,0xf7,0xc3,0x74,0xf7,0xc2,0x71,0xf6,0xbe,0x6d,0xf6,0xba,0x6a,0xf4,0xb6,0x65,0x8a,0x5e,0x2c,0xc,0x7,0x3,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
122 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x4f,0x33,0x1a,0xd2,0x99,0x60,0xf8,0xc4,0x89,0xf8,0xc3,0x86,0xf8,0xc4,0x84,0xf7,0xc5,0x82,0xf7,0xc5,0x80,0xf7,0xc5,0x7f,0xf7,0xc4,0x7e,0xf7,0xc4,0x7b,0xf7,0xc3,0x79,0xf7,0xc2,0x77,0xf6,0xc0,0x74,0xf6,0xbd,0x71,0xf6,0xbb,0x6e,0xe1,0xa4,0x59,0x5c,0x3d,0x1b,0x1,0x1,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
123 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xe,0x6,0x0,0x72,0x4b,0x28,0xd0,0x9a,0x62,0xf7,0xbf,0x80,0xf8,0xc4,0x85,0xf7,0xc3,0x82,0xf7,0xc3,0x80,0xf7,0xc3,0x7e,0xf7,0xc1,0x7c,0xf6,0xc0,0x7a,0xf7,0xbf,0x78,0xf8,0xbc,0x72,0xde,0xa2,0x5d,0x80,0x57,0x2b,0x13,0xb,0x4,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
124 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x19,0xe,0x5,0x44,0x2c,0x15,0x81,0x59,0x32,0xb2,0x80,0x4c,0xcb,0x95,0x5b,0xd2,0x9c,0x5f,0xcd,0x97,0x5a,0xb9,0x86,0x4d,0x8b,0x61,0x34,0x4a,0x30,0x17,0x15,0xc,0x5,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
125 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0x0,0x0,0x0,0x1,0x0,0x0,0x3,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,
126 };
127
128
129 GLXContext GHOST_WindowX11::s_firstContext = NULL;
130
131 GHOST_WindowX11::
132 GHOST_WindowX11(
133         GHOST_SystemX11 *system,
134         Display * display,
135         const STR_String& title, 
136         GHOST_TInt32 left,
137         GHOST_TInt32 top,
138         GHOST_TUns32 width,     
139         GHOST_TUns32 height,
140         GHOST_TWindowState state,
141         const GHOST_TEmbedderWindowID parentWindow,
142         GHOST_TDrawingContextType type,
143         const bool stereoVisual
144 ) :
145         GHOST_Window(title,left,top,width,height,state,type,stereoVisual),
146         m_context(NULL),
147         m_display(display),
148         m_system (system),
149         m_valid_setup (false),
150         m_invalid_window(false),
151         m_empty_cursor(None),
152         m_custom_cursor(None)
153 {
154         
155         // Set up the minimum atrributes that we require and see if
156         // X can find us a visual matching those requirements.
157
158         int attributes[40], i = 0;
159         
160         
161         if(m_stereoVisual)
162                 attributes[i++] = GLX_STEREO;
163
164         attributes[i++] = GLX_RGBA;
165         attributes[i++] = GLX_DOUBLEBUFFER;     
166         attributes[i++] = GLX_RED_SIZE;   attributes[i++] = 1;
167         attributes[i++] = GLX_BLUE_SIZE;  attributes[i++] = 1;
168         attributes[i++] = GLX_GREEN_SIZE; attributes[i++] = 1;
169         attributes[i++] = GLX_DEPTH_SIZE; attributes[i++] = 1;
170         attributes[i] = None;
171         
172         m_visual = glXChooseVisual(m_display, DefaultScreen(m_display), attributes);
173
174         if (m_visual == NULL) {
175                 // barf : no visual meeting these requirements could be found.
176                 printf("%s:%d: X11 glxChooseVisual() failed for OpenGL, verify working openGL system!\n", __FILE__, __LINE__);
177                 return;
178         }
179
180         // Create a bunch of attributes needed to create an X window.
181
182
183         // First create a colormap for the window and visual. 
184         // This seems pretty much a legacy feature as we are in rgba mode anyway.
185
186         XSetWindowAttributes xattributes;
187         memset(&xattributes, 0, sizeof(xattributes));
188
189         xattributes.colormap= XCreateColormap(
190                 m_display, 
191                 RootWindow(m_display, m_visual->screen),
192                 m_visual->visual,
193                 AllocNone
194         );
195
196         xattributes.border_pixel= 0;
197
198         // Specify which events we are interested in hearing.   
199
200         xattributes.event_mask= 
201                 ExposureMask | StructureNotifyMask | 
202                 KeyPressMask | KeyReleaseMask |
203                 EnterWindowMask | LeaveWindowMask |
204                 ButtonPressMask | ButtonReleaseMask |
205                 PointerMotionMask | FocusChangeMask | PropertyChangeMask;
206
207         // create the window!
208
209         ;
210         if (parentWindow == 0) {
211                 m_window = 
212                         XCreateWindow(
213                                 m_display, 
214                                 RootWindow(m_display, m_visual->screen), 
215                                 left,
216                                 top,
217                                 width,
218                                 height,
219                                 0, // no border.
220                                 m_visual->depth,
221                                 InputOutput, 
222                                 m_visual->visual,
223                                 CWBorderPixel|CWColormap|CWEventMask, 
224                                 &xattributes
225                         );
226         } else {
227
228                 Window root_return;
229                 int x_return,y_return;
230                 unsigned int w_return,h_return,border_w_return,depth_return;
231                 GHOST_TInt32 screen_x, screen_y;
232                 
233                 XGetGeometry(m_display, parentWindow, &root_return, &x_return, &y_return,
234                         &w_return, &h_return, &border_w_return, &depth_return );
235
236                 left = 0;
237                 top = 0;
238                 width = w_return;
239                 height = h_return;
240
241
242                 m_window = XCreateWindow(
243                                 m_display, 
244                                 parentWindow,  // reparent against embedder 
245                                 left,
246                                 top,
247                                 width,
248                                 height,
249                                 0, // no border.
250                                 m_visual->depth,
251                                 InputOutput, 
252                                 m_visual->visual,
253                                 CWBorderPixel|CWColormap|CWEventMask, 
254                                 &xattributes
255                         );
256
257                 XSelectInput(m_display , parentWindow, SubstructureNotifyMask);
258                 
259         }       
260         
261         
262         // Are we in fullscreen mode - then include
263         // some obscure blut code to remove decorations.
264
265         if (state == GHOST_kWindowStateFullScreen) {
266
267                 MotifWmHints hints;
268                 Atom atom;
269                                         
270                 atom = XInternAtom(m_display, "_MOTIF_WM_HINTS", False);
271                 
272                 if (atom == None) {
273                         GHOST_PRINT("Could not intern X atom for _MOTIF_WM_HINTS.\n");
274                 } else {
275                         hints.flags = MWM_HINTS_DECORATIONS;
276                         hints.decorations = 0;  /* Absolutely no decorations. */
277                         // other hints.decorations make no sense
278                         // you can't select individual decorations
279
280                         XChangeProperty(m_display, m_window,
281                                 atom, atom, 32,
282                                 PropModeReplace, (unsigned char *) &hints, 4);
283                 }
284         } else if (state == GHOST_kWindowStateMaximized) {
285                 // With this, xprop should report the following just after launch
286                 // _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ
287                 // After demaximization the right side is empty, though (maybe not the most correct then?)
288                 Atom state, atomh, atomv;
289
290                 state = XInternAtom(m_display, "_NET_WM_STATE", False);
291                 atomh = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
292                 atomv = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
293                 if (state == None ) {
294                         GHOST_PRINT("Atom _NET_WM_STATE requested but not avaliable nor created.\n");
295                 } else {
296                         XChangeProperty(m_display, m_window,
297                                 state, XA_ATOM, 32,
298                                 PropModeAppend, (unsigned char *) &atomh, 1);
299                         XChangeProperty(m_display, m_window,
300                                 state, XA_ATOM, 32,
301                                 PropModeAppend, (unsigned char *) &atomv, 1);
302                 }
303         }
304         
305         // Create some hints for the window manager on how
306         // we want this window treated. 
307
308         XSizeHints * xsizehints = XAllocSizeHints();
309         xsizehints->flags = USPosition | USSize;
310         xsizehints->x = left;
311         xsizehints->y = top;
312         xsizehints->width = width;
313         xsizehints->height = height;
314         XSetWMNormalHints(m_display, m_window, xsizehints);
315         XFree(xsizehints);
316
317         XClassHint * xclasshint = XAllocClassHint();
318         int len = title.Length() +1 ;
319         char *wmclass = (char *)malloc(sizeof(char) * len);
320         strncpy(wmclass, (const char*)title, sizeof(char) * len);
321         xclasshint->res_name = wmclass;
322         xclasshint->res_class = wmclass;
323         XSetClassHint(m_display, m_window, xclasshint);
324         free(wmclass);
325         XFree(xclasshint);
326
327
328         // Set the window icon
329         XWMHints *xwmhints = XAllocWMHints();
330         XImage *x_image, *mask_image;
331         Pixmap icon_pixmap, mask_pixmap;
332         icon_pixmap = XCreatePixmap(display, m_window, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 24);
333         mask_pixmap = XCreatePixmap(display, m_window, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 1);
334         GC gc_icon = XCreateGC(display, icon_pixmap, 0, NULL);
335         GC gc_mask = XCreateGC(display, mask_pixmap, 0, NULL);
336         
337         x_image = XCreateImage( display, m_visual->visual, 24, ZPixmap, 0, NULL, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 32, 0 );
338         mask_image = XCreateImage( display, m_visual->visual, 1, ZPixmap, 0, NULL,  BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 8, 0);
339         
340         x_image->data = (char *)malloc(x_image->bytes_per_line * BLENDER_ICON_HEIGHT);
341         mask_image->data = (char *)malloc( mask_image->bytes_per_line * BLENDER_ICON_HEIGHT);
342         
343         /* copy the BLENDER_ICON_48x48x24 into the XImage */
344         unsigned char *col = BLENDER_ICON_48x48x24;
345         int px, py;
346         for (px=0; px<BLENDER_ICON_WIDTH; px++) {
347                 for (py=0; py<BLENDER_ICON_HEIGHT; py++, col+=3) {
348                         /* mask out pink */
349                         if (col[0]==255 && col[1] == 0 && col[2]== 255) {
350                                 XPutPixel(mask_image, px, py, 0 );
351                         } else {
352                                 XPutPixel(x_image, px, py, (col[0]<<16)+(col[1]<<8)+col[2] );
353                                 XPutPixel(mask_image, px, py, 1 );
354                         }
355                 }
356         }
357         
358         XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
359         XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
360         
361         // Now the pixmap is ok to assign to the window as a hint
362         xwmhints->icon_pixmap = icon_pixmap;
363         xwmhints->icon_mask = mask_pixmap;
364         XFreeGC (display, gc_icon);
365         XFreeGC (display, gc_mask);
366         XDestroyImage( x_image ); /* frees x_image->data too */
367         XDestroyImage( mask_image );
368         
369         xwmhints->initial_state = NormalState;
370         xwmhints->flags         = IconPixmapHint|IconMaskHint|StateHint;
371         XSetWMHints(display, m_window, xwmhints );
372         XFree(xwmhints);
373         // done setting the icon
374         
375
376         setTitle(title);
377
378         initXInputDevices();
379
380         // now set up the rendering context.
381         if (installDrawingContext(type) == GHOST_kSuccess) {
382                 m_valid_setup = true;
383                 GHOST_PRINT("Created window\n");
384         }
385
386         XMapWindow(m_display, m_window);
387         GHOST_PRINT("Mapped window\n");
388
389         XFlush(m_display);
390 }
391
392 /* 
393         Dummy function to get around IO Handler exiting if device invalid
394         Basically it will not crash blender now if you have a X device that 
395         is configured but not plugged in.
396
397 */
398 static int ApplicationErrorHandler(Display *display, XErrorEvent *theEvent) {
399         fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
400                 theEvent->error_code, theEvent->request_code) ;
401
402         /* No exit! - but keep lint happy */
403         return 0 ;
404 }
405
406 void GHOST_WindowX11::initXInputDevices()
407 {
408         static XErrorHandler old_handler = (XErrorHandler) 0 ;
409         XExtensionVersion *version = XGetExtensionVersion(m_display, INAME);
410
411         if(version && (version != (XExtensionVersion*)NoSuchExtension)) {
412                 if(version->present) {
413                         int device_count;
414                         XDeviceInfo* device_info = XListInputDevices(m_display, &device_count);
415                         m_xtablet.StylusDevice = 0;
416                         m_xtablet.EraserDevice = 0;
417                         m_xtablet.CommonData.Active= 0;
418
419                         /* Install our error handler to override Xlib's termination behavior */
420                         old_handler = XSetErrorHandler(ApplicationErrorHandler) ;
421
422                         for(int i=0; i<device_count; ++i) {
423                                 if(!strcasecmp(device_info[i].name, "stylus")) {
424                                         m_xtablet.StylusID= device_info[i].id;
425                                         m_xtablet.StylusDevice = XOpenDevice(m_display, m_xtablet.StylusID);
426
427                                         if (m_xtablet.StylusDevice != NULL) {
428                                                 /* Find how many pressure levels tablet has */
429                                                 XAnyClassPtr ici = device_info[i].inputclassinfo;
430                                                 for(int j=0; j<m_xtablet.StylusDevice->num_classes; ++j) {
431                                                         if(ici->c_class==ValuatorClass) {
432                                                                 XValuatorInfo* xvi = (XValuatorInfo*)ici;
433                                                                 m_xtablet.PressureLevels = xvi->axes[2].max_value;
434                                                         
435                                                                 /* this is assuming that the tablet has the same tilt resolution in both
436                                                                  * positive and negative directions. It would be rather weird if it didn't.. */
437                                                                 m_xtablet.XtiltLevels = xvi->axes[3].max_value;
438                                                                 m_xtablet.YtiltLevels = xvi->axes[4].max_value;
439                                                                 break;
440                                                         }
441                                                 
442                                                         ici = (XAnyClassPtr)(((char *)ici) + ici->length);
443                                                 }
444                                         } else {
445                                                 m_xtablet.StylusID= 0;
446                                         }
447                                 }
448                                 if(!strcasecmp(device_info[i].name, "eraser")) {
449                                         m_xtablet.EraserID= device_info[i].id;
450                                         m_xtablet.EraserDevice = XOpenDevice(m_display, m_xtablet.EraserID);
451                                         if (m_xtablet.EraserDevice == NULL) m_xtablet.EraserID= 0;
452                                 }
453                         }
454
455                         /* Restore handler */
456                         (void) XSetErrorHandler(old_handler) ;
457
458                         XFreeDeviceList(device_info);
459
460
461                         XEventClass xevents[10], ev;
462                         int dcount = 0;
463
464                         if(m_xtablet.StylusDevice) {
465                                 DeviceMotionNotify(m_xtablet.StylusDevice, m_xtablet.MotionEvent, ev);
466                                 if(ev) xevents[dcount++] = ev;
467                                 ProximityIn(m_xtablet.StylusDevice, m_xtablet.ProxInEvent, ev);
468                                 if(ev) xevents[dcount++] = ev;
469                                 ProximityOut(m_xtablet.StylusDevice, m_xtablet.ProxOutEvent, ev);
470                                 if(ev) xevents[dcount++] = ev;
471                         }
472                         if(m_xtablet.EraserDevice) {
473                                 DeviceMotionNotify(m_xtablet.EraserDevice, m_xtablet.MotionEvent, ev);
474                                 if(ev) xevents[dcount++] = ev;
475                                 ProximityIn(m_xtablet.EraserDevice, m_xtablet.ProxInEvent, ev);
476                                 if(ev) xevents[dcount++] = ev;
477                                 ProximityOut(m_xtablet.EraserDevice, m_xtablet.ProxOutEvent, ev);
478                                 if(ev) xevents[dcount++] = ev;
479                         }
480
481                         XSelectExtensionEvent(m_display, m_window, xevents, dcount);
482                 }
483                 XFree(version);
484         }
485 }       
486
487
488         Window 
489 GHOST_WindowX11::
490 getXWindow(
491 ){
492         return m_window;
493 }       
494
495         bool 
496 GHOST_WindowX11::
497 getValid(
498 ) const {
499         return m_valid_setup;
500 }
501
502         void 
503 GHOST_WindowX11::
504 setTitle(
505         const STR_String& title
506 ){
507         XStoreName(m_display,m_window,title);
508         XFlush(m_display);
509 }
510
511         void 
512 GHOST_WindowX11::
513 getTitle(
514         STR_String& title
515 ) const {
516         char *name = NULL;
517         
518         XFetchName(m_display,m_window,&name);
519         title= name?name:"untitled";
520         XFree(name);
521 }
522         
523         void 
524 GHOST_WindowX11::
525 getWindowBounds(
526         GHOST_Rect& bounds
527 ) const {
528                 // Getting the window bounds under X11 is not
529                 // really supported (nor should it be desired).
530         getClientBounds(bounds);
531 }
532
533         void 
534 GHOST_WindowX11::
535 getClientBounds(
536         GHOST_Rect& bounds
537 ) const {
538         Window root_return;
539         int x_return,y_return;
540         unsigned int w_return,h_return,border_w_return,depth_return;
541         GHOST_TInt32 screen_x, screen_y;
542         
543         XGetGeometry(m_display,m_window,&root_return,&x_return,&y_return,
544                 &w_return,&h_return,&border_w_return,&depth_return);
545
546         clientToScreen(0, 0, screen_x, screen_y);
547         
548         bounds.m_l = screen_x;
549         bounds.m_r = bounds.m_l + w_return;
550         bounds.m_t = screen_y;
551         bounds.m_b = bounds.m_t + h_return;
552
553 }
554
555         GHOST_TSuccess 
556 GHOST_WindowX11::
557 setClientWidth(
558         GHOST_TUns32 width
559 ){      
560         XWindowChanges values;
561         unsigned int value_mask= CWWidth;               
562         values.width = width;
563         XConfigureWindow(m_display,m_window,value_mask,&values);
564
565         return GHOST_kSuccess;
566 }
567
568         GHOST_TSuccess 
569 GHOST_WindowX11::
570 setClientHeight(
571         GHOST_TUns32 height
572 ){
573         XWindowChanges values;
574         unsigned int value_mask= CWHeight;              
575         values.height = height;
576         XConfigureWindow(m_display,m_window,value_mask,&values);
577         return GHOST_kSuccess;
578
579 }
580
581         GHOST_TSuccess 
582 GHOST_WindowX11::
583 setClientSize(
584         GHOST_TUns32 width,
585         GHOST_TUns32 height
586 ){
587         XWindowChanges values;
588         unsigned int value_mask= CWWidth | CWHeight;            
589         values.width = width;
590         values.height = height;
591         XConfigureWindow(m_display,m_window,value_mask,&values);
592         return GHOST_kSuccess;
593
594 }       
595
596         void 
597 GHOST_WindowX11::
598 screenToClient(
599         GHOST_TInt32 inX,
600         GHOST_TInt32 inY,
601         GHOST_TInt32& outX,
602         GHOST_TInt32& outY
603 ) const {
604         // not sure about this one!
605
606         int ax,ay;
607         Window temp;
608
609         XTranslateCoordinates(
610                         m_display,
611                         RootWindow(m_display, m_visual->screen),
612                         m_window,
613                         inX,
614                         inY,
615                         &ax,
616                         &ay,
617                         &temp
618                 );
619         outX = ax;
620         outY = ay;
621 }
622                  
623         void 
624 GHOST_WindowX11::
625 clientToScreen(
626         GHOST_TInt32 inX,
627         GHOST_TInt32 inY,
628         GHOST_TInt32& outX,
629         GHOST_TInt32& outY
630 ) const {
631         int ax,ay;
632         Window temp;
633
634         XTranslateCoordinates(
635                         m_display,
636                         m_window,
637                         RootWindow(m_display, m_visual->screen),
638                         inX,
639                         inY,
640                         &ax,
641                         &ay,
642                         &temp
643                 );
644         outX = ax;
645         outY = ay;
646 }
647
648
649         GHOST_TWindowState 
650 GHOST_WindowX11::
651 getState(
652 ) const {
653         //FIXME 
654         return GHOST_kWindowStateNormal;
655 }
656
657         GHOST_TSuccess 
658 GHOST_WindowX11::
659 setState(
660         GHOST_TWindowState state
661 ){
662         //TODO
663
664         if (state == (int)getState()) {
665                 return GHOST_kSuccess;
666         } else {
667                 return GHOST_kFailure;
668         }
669
670 }
671
672 #include <iostream>
673 using namespace std;
674
675         GHOST_TSuccess 
676 GHOST_WindowX11::
677 setOrder(
678         GHOST_TWindowOrder order
679 ){
680         if (order == GHOST_kWindowOrderTop) {
681                 XWindowAttributes attr;   
682                 Atom atom;
683
684                 /* We use both XRaiseWindow and _NET_ACTIVE_WINDOW, since some
685                    window managers ignore the former (e.g. kwin from kde) and others
686                    don't implement the latter (e.g. fluxbox pre 0.9.9) */
687
688                 XRaiseWindow(m_display, m_window);
689
690                 atom = XInternAtom(m_display, "_NET_ACTIVE_WINDOW", True);
691
692                 if (atom != None) {
693                         Window root;
694                         XEvent xev;
695                         long eventmask;
696
697                         xev.xclient.type = ClientMessage;
698                         xev.xclient.serial = 0;
699                         xev.xclient.send_event = True;
700                         xev.xclient.window = m_window;
701                         xev.xclient.message_type = atom;
702
703                         xev.xclient.format = 32;
704                         xev.xclient.data.l[0] = 0;
705                         xev.xclient.data.l[1] = 0;
706                         xev.xclient.data.l[2] = 0;
707                         xev.xclient.data.l[3] = 0;
708                         xev.xclient.data.l[4] = 0;
709
710                         root = RootWindow(m_display, m_visual->screen),
711                         eventmask = SubstructureRedirectMask | SubstructureNotifyMask;
712
713                         XSendEvent(m_display, root, False, eventmask, &xev);
714                 }
715
716                 XGetWindowAttributes(m_display, m_window, &attr);
717
718                 /* iconized windows give bad match error */
719                 if (attr.map_state == IsViewable)
720                         XSetInputFocus(m_display, m_window, RevertToPointerRoot,
721                                                  CurrentTime);
722                 XFlush(m_display);
723         } else if (order == GHOST_kWindowOrderBottom) {
724                 XLowerWindow(m_display,m_window);
725                 XFlush(m_display);
726         } else {
727                 return GHOST_kFailure;
728         }
729         
730         return GHOST_kSuccess;
731 }
732
733         GHOST_TSuccess 
734 GHOST_WindowX11::
735 swapBuffers(
736 ){
737         if (getDrawingContextType() == GHOST_kDrawingContextTypeOpenGL) {
738                 glXSwapBuffers(m_display,m_window);
739                 return GHOST_kSuccess;
740         } else {
741                 return GHOST_kFailure;
742         }
743 }
744
745         GHOST_TSuccess 
746 GHOST_WindowX11::
747 activateDrawingContext(
748 ){
749         if (m_context !=NULL) {
750                 glXMakeCurrent(m_display, m_window,m_context);                                          
751                 return GHOST_kSuccess;
752         } 
753         return GHOST_kFailure;
754 }
755
756         GHOST_TSuccess 
757 GHOST_WindowX11::
758 invalidate(
759 ){
760         
761         // So the idea of this function is to generate an expose event
762         // for the window.
763         // Unfortunately X does not handle expose events for you and 
764         // it is the client's job to refresh the dirty part of the window.
765         // We need to queue up invalidate calls and generate GHOST events 
766         // for them in the system.
767
768         // We implement this by setting a boolean in this class to concatenate 
769         // all such calls into a single event for this window.
770
771         // At the same time we queue the dirty windows in the system class
772         // and generate events for them at the next processEvents call.
773
774         if (m_invalid_window == false) {
775                 m_system->addDirtyWindow(this);
776                 m_invalid_window = true;
777         } 
778  
779         return GHOST_kSuccess;
780 }
781
782 /**
783  * called by the X11 system implementation when expose events
784  * for the window have been pushed onto the GHOST queue
785  */
786  
787         void
788 GHOST_WindowX11::
789 validate(
790 ){
791         m_invalid_window = false;
792 }       
793  
794  
795 /**
796  * Destructor.
797  * Closes the window and disposes resources allocated.
798  */
799
800 GHOST_WindowX11::
801 ~GHOST_WindowX11(
802 ){
803         static Atom Primary_atom, Clipboard_atom;
804         Window p_owner, c_owner;
805         /*Change the owner of the Atoms to None if we are the owner*/
806         Primary_atom = XInternAtom(m_display, "PRIMARY", False);
807         Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False);
808         
809         p_owner = XGetSelectionOwner(m_display, Primary_atom);
810         c_owner = XGetSelectionOwner(m_display, Clipboard_atom);
811         
812         std::map<unsigned int, Cursor>::iterator it = m_standard_cursors.begin();
813         for (; it != m_standard_cursors.end(); it++) {
814                 XFreeCursor(m_display, it->second);
815         }
816
817         if (m_empty_cursor) {
818                 XFreeCursor(m_display, m_empty_cursor);
819         }
820         if (m_custom_cursor) {
821                 XFreeCursor(m_display, m_custom_cursor);
822         }
823         
824         if (m_context) {
825                 if (m_context == s_firstContext) {
826                         s_firstContext = NULL;
827                 }
828                 glXDestroyContext(m_display, m_context);
829         }
830         
831         if (p_owner == m_window) {
832                 XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime);
833         }
834         if (c_owner == m_window) {
835                 XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime);
836         }
837         
838         XDestroyWindow(m_display, m_window);
839         XFree(m_visual);
840 }
841
842
843
844
845 /**
846  * Tries to install a rendering context in this window.
847  * @param type  The type of rendering context installed.
848  * @return Indication as to whether installation has succeeded.
849  */
850         GHOST_TSuccess 
851 GHOST_WindowX11::
852 installDrawingContext(
853         GHOST_TDrawingContextType type
854 ){
855         // only support openGL for now.
856         GHOST_TSuccess success;
857         switch (type) {
858         case GHOST_kDrawingContextTypeOpenGL:
859                 m_context = glXCreateContext(m_display, m_visual, s_firstContext, True);
860                 if (m_context !=NULL) {
861                         if (!s_firstContext) {
862                                 s_firstContext = m_context;
863                         }
864                         glXMakeCurrent(m_display, m_window,m_context);                                          
865                         success = GHOST_kSuccess;
866                 } else {
867                         success = GHOST_kFailure;
868                 }
869
870                 break;
871
872         case GHOST_kDrawingContextTypeNone:
873                 success = GHOST_kSuccess;
874                 break;
875
876         default:
877                 success = GHOST_kFailure;
878         }
879         return success;
880 }
881
882
883
884 /**
885  * Removes the current drawing context.
886  * @return Indication as to whether removal has succeeded.
887  */
888         GHOST_TSuccess 
889 GHOST_WindowX11::
890 removeDrawingContext(
891 ){
892         GHOST_TSuccess success;
893
894         if (m_context != NULL) {
895                 glXDestroyContext(m_display, m_context);
896                 success = GHOST_kSuccess;
897         } else {
898                 success = GHOST_kFailure;
899         }
900         return success; 
901 }
902
903
904         Cursor
905 GHOST_WindowX11::
906 getStandardCursor(
907         GHOST_TStandardCursor g_cursor
908 ){
909         unsigned int xcursor_id;
910
911 #define GtoX(gcurs, xcurs)      case gcurs: xcursor_id = xcurs
912         switch (g_cursor) {
913         GtoX(GHOST_kStandardCursorRightArrow, XC_arrow); break;
914         GtoX(GHOST_kStandardCursorLeftArrow, XC_top_left_arrow); break;
915         GtoX(GHOST_kStandardCursorInfo, XC_hand1); break;
916         GtoX(GHOST_kStandardCursorDestroy, XC_pirate); break;
917         GtoX(GHOST_kStandardCursorHelp, XC_question_arrow); break; 
918         GtoX(GHOST_kStandardCursorCycle, XC_exchange); break;
919         GtoX(GHOST_kStandardCursorSpray, XC_spraycan); break;
920         GtoX(GHOST_kStandardCursorWait, XC_watch); break;
921         GtoX(GHOST_kStandardCursorText, XC_xterm); break;
922         GtoX(GHOST_kStandardCursorCrosshair, XC_crosshair); break;
923         GtoX(GHOST_kStandardCursorUpDown, XC_sb_v_double_arrow); break;
924         GtoX(GHOST_kStandardCursorLeftRight, XC_sb_h_double_arrow); break;
925         GtoX(GHOST_kStandardCursorTopSide, XC_top_side); break;
926         GtoX(GHOST_kStandardCursorBottomSide, XC_bottom_side); break;
927         GtoX(GHOST_kStandardCursorLeftSide, XC_left_side); break;
928         GtoX(GHOST_kStandardCursorRightSide, XC_right_side); break;
929         GtoX(GHOST_kStandardCursorTopLeftCorner, XC_top_left_corner); break;
930         GtoX(GHOST_kStandardCursorTopRightCorner, XC_top_right_corner); break;
931         GtoX(GHOST_kStandardCursorBottomRightCorner, XC_bottom_right_corner); break;
932         GtoX(GHOST_kStandardCursorBottomLeftCorner, XC_bottom_left_corner); break;
933         GtoX(GHOST_kStandardCursorPencil, XC_pencil); break;
934         default:
935                 xcursor_id = 0;
936         }
937 #undef GtoX
938
939         if (xcursor_id) {
940                 Cursor xcursor = m_standard_cursors[xcursor_id];
941                 
942                 if (!xcursor) {
943                         xcursor = XCreateFontCursor(m_display, xcursor_id);
944
945                         m_standard_cursors[xcursor_id] = xcursor;
946                 }
947                 
948                 return xcursor;
949         } else {
950                 return None;
951         }
952 }
953
954         Cursor 
955 GHOST_WindowX11::
956 getEmptyCursor(
957 ) {
958         if (!m_empty_cursor) {
959                 Pixmap blank;
960                 XColor dummy;
961                 char data[1] = {0};
962                         
963                 /* make a blank cursor */
964                 blank = XCreateBitmapFromData (
965                         m_display, 
966                         RootWindow(m_display,DefaultScreen(m_display)),
967                         data, 1, 1
968                 );
969
970                 m_empty_cursor = XCreatePixmapCursor(m_display, blank, blank, &dummy, &dummy, 0, 0);
971                 XFreePixmap(m_display, blank);
972         }
973
974         return m_empty_cursor;
975 }
976
977         GHOST_TSuccess
978 GHOST_WindowX11::
979 setWindowCursorVisibility(
980         bool visible
981 ){
982         Cursor xcursor;
983         
984         if (visible) {
985                 xcursor = getStandardCursor( getCursorShape() );
986         } else {
987                 xcursor = getEmptyCursor();
988         }
989
990         XDefineCursor(m_display, m_window, xcursor);
991         XFlush(m_display);
992         
993         return GHOST_kSuccess;
994 }
995
996         GHOST_TSuccess
997 GHOST_WindowX11::
998 setWindowCursorShape(
999         GHOST_TStandardCursor shape
1000 ){
1001         Cursor xcursor = getStandardCursor( shape );
1002         
1003         XDefineCursor(m_display, m_window, xcursor);
1004         XFlush(m_display);
1005
1006         return GHOST_kSuccess;
1007 }
1008
1009         GHOST_TSuccess
1010 GHOST_WindowX11::
1011 setWindowCustomCursorShape(
1012         GHOST_TUns8 bitmap[16][2], 
1013         GHOST_TUns8 mask[16][2], 
1014         int hotX, 
1015         int hotY
1016 ){
1017
1018 setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask, 
1019                                                                         16, 16, hotX, hotY, 0, 1);
1020         return GHOST_kSuccess;
1021 }
1022
1023         GHOST_TSuccess
1024 GHOST_WindowX11::
1025 setWindowCustomCursorShape(     
1026         GHOST_TUns8 *bitmap, 
1027         GHOST_TUns8 *mask, 
1028         int sizex, 
1029         int sizey, 
1030         int hotX, 
1031         int hotY, 
1032         int fg_color, 
1033         int bg_color
1034 ){
1035         Pixmap bitmap_pix, mask_pix;
1036         XColor fg, bg;
1037         
1038         if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
1039                 "White", &fg, &fg) == 0) return GHOST_kFailure;
1040         if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
1041                 "Black", &bg, &bg) == 0) return GHOST_kFailure;
1042
1043         if (m_custom_cursor) {
1044                 XFreeCursor(m_display, m_custom_cursor);
1045         }
1046
1047         bitmap_pix = XCreateBitmapFromData(m_display, m_window, (char*) bitmap, sizex, sizey);
1048         mask_pix = XCreateBitmapFromData(m_display, m_window, (char*) mask, sizex, sizey);
1049                 
1050         m_custom_cursor = XCreatePixmapCursor(m_display, bitmap_pix, mask_pix, &fg, &bg, hotX, hotY);
1051         XDefineCursor(m_display, m_window, m_custom_cursor);
1052         XFlush(m_display);
1053         
1054         XFreePixmap(m_display, bitmap_pix);
1055         XFreePixmap(m_display, mask_pix);
1056
1057         return GHOST_kSuccess;
1058 }
1059
1060 /*
1061
1062 void glutCustomCursor(char *data1, char *data2, int size)
1063 {
1064         Pixmap source, mask;
1065         Cursor cursor;
1066         XColor fg, bg;
1067         
1068         if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
1069                 "White", &fg, &fg) == 0) return;
1070         if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
1071                 "Red", &bg, &bg) == 0) return;
1072
1073
1074         source= XCreateBitmapFromData(__glutDisplay, xdraw, data2, size, size);
1075         mask= XCreateBitmapFromData(__glutDisplay, xdraw, data1, size, size);
1076                 
1077         cursor= XCreatePixmapCursor(__glutDisplay, source, mask, &fg, &bg, 7, 7);
1078                 
1079         XFreePixmap(__glutDisplay, source);
1080         XFreePixmap(__glutDisplay, mask);
1081                 
1082         XDefineCursor(__glutDisplay, xdraw, cursor);
1083 }
1084
1085 */