- X11 tablet was using uninitialized variables.
[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         Atom atoms[2];
160         int natom;      
161         
162         if(m_stereoVisual)
163                 attributes[i++] = GLX_STEREO;
164
165         attributes[i++] = GLX_RGBA;
166         attributes[i++] = GLX_DOUBLEBUFFER;     
167         attributes[i++] = GLX_RED_SIZE;   attributes[i++] = 1;
168         attributes[i++] = GLX_BLUE_SIZE;  attributes[i++] = 1;
169         attributes[i++] = GLX_GREEN_SIZE; attributes[i++] = 1;
170         attributes[i++] = GLX_DEPTH_SIZE; attributes[i++] = 1;
171         attributes[i] = None;
172         
173         m_visual = glXChooseVisual(m_display, DefaultScreen(m_display), attributes);
174
175         if (m_visual == NULL) {
176                 // barf : no visual meeting these requirements could be found.
177                 printf("%s:%d: X11 glxChooseVisual() failed for OpenGL, verify working openGL system!\n", __FILE__, __LINE__);
178                 return;
179         }
180         
181         memset(&m_xtablet, 0, sizeof(m_xtablet));
182
183         // Create a bunch of attributes needed to create an X window.
184
185
186         // First create a colormap for the window and visual. 
187         // This seems pretty much a legacy feature as we are in rgba mode anyway.
188
189         XSetWindowAttributes xattributes;
190         memset(&xattributes, 0, sizeof(xattributes));
191
192         xattributes.colormap= XCreateColormap(
193                 m_display, 
194                 RootWindow(m_display, m_visual->screen),
195                 m_visual->visual,
196                 AllocNone
197         );
198
199         xattributes.border_pixel= 0;
200
201         // Specify which events we are interested in hearing.   
202
203         xattributes.event_mask= 
204                 ExposureMask | StructureNotifyMask | 
205                 KeyPressMask | KeyReleaseMask |
206                 EnterWindowMask | LeaveWindowMask |
207                 ButtonPressMask | ButtonReleaseMask |
208                 PointerMotionMask | FocusChangeMask | PropertyChangeMask;
209
210         // create the window!
211
212         ;
213         if (parentWindow == 0) {
214                 m_window = 
215                         XCreateWindow(
216                                 m_display, 
217                                 RootWindow(m_display, m_visual->screen), 
218                                 left,
219                                 top,
220                                 width,
221                                 height,
222                                 0, // no border.
223                                 m_visual->depth,
224                                 InputOutput, 
225                                 m_visual->visual,
226                                 CWBorderPixel|CWColormap|CWEventMask, 
227                                 &xattributes
228                         );
229         } else {
230
231                 Window root_return;
232                 int x_return,y_return;
233                 unsigned int w_return,h_return,border_w_return,depth_return;
234                 
235                 XGetGeometry(m_display, parentWindow, &root_return, &x_return, &y_return,
236                         &w_return, &h_return, &border_w_return, &depth_return );
237
238                 left = 0;
239                 top = 0;
240                 width = w_return;
241                 height = h_return;
242
243
244                 m_window = XCreateWindow(
245                                 m_display, 
246                                 parentWindow,  // reparent against embedder 
247                                 left,
248                                 top,
249                                 width,
250                                 height,
251                                 0, // no border.
252                                 m_visual->depth,
253                                 InputOutput, 
254                                 m_visual->visual,
255                                 CWBorderPixel|CWColormap|CWEventMask, 
256                                 &xattributes
257                         );
258
259                 XSelectInput(m_display , parentWindow, SubstructureNotifyMask);
260                 
261         }       
262         
263         
264         // Are we in fullscreen mode - then include
265         // some obscure blut code to remove decorations.
266
267         if (state == GHOST_kWindowStateFullScreen) {
268
269                 MotifWmHints hints;
270                 Atom atom;
271                                         
272                 atom = XInternAtom(m_display, "_MOTIF_WM_HINTS", False);
273                 
274                 if (atom == None) {
275                         GHOST_PRINT("Could not intern X atom for _MOTIF_WM_HINTS.\n");
276                 } else {
277                         hints.flags = MWM_HINTS_DECORATIONS;
278                         hints.decorations = 0;  /* Absolutely no decorations. */
279                         // other hints.decorations make no sense
280                         // you can't select individual decorations
281
282                         XChangeProperty(m_display, m_window,
283                                 atom, atom, 32,
284                                 PropModeReplace, (unsigned char *) &hints, 4);
285                 }
286         } else if (state == GHOST_kWindowStateMaximized) {
287                 // With this, xprop should report the following just after launch
288                 // _NET_WM_STATE(ATOM) = _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ
289                 // After demaximization the right side is empty, though (maybe not the most correct then?)
290                 Atom state, atomh, atomv;
291
292                 state = XInternAtom(m_display, "_NET_WM_STATE", False);
293                 atomh = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
294                 atomv = XInternAtom(m_display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
295                 if (state == None ) {
296                         GHOST_PRINT("Atom _NET_WM_STATE requested but not avaliable nor created.\n");
297                 } else {
298                         XChangeProperty(m_display, m_window,
299                                 state, XA_ATOM, 32,
300                                 PropModeAppend, (unsigned char *) &atomh, 1);
301                         XChangeProperty(m_display, m_window,
302                                 state, XA_ATOM, 32,
303                                 PropModeAppend, (unsigned char *) &atomv, 1);
304                 }
305         }
306         
307         // Create some hints for the window manager on how
308         // we want this window treated. 
309
310         XSizeHints * xsizehints = XAllocSizeHints();
311         xsizehints->flags = USPosition | USSize;
312         xsizehints->x = left;
313         xsizehints->y = top;
314         xsizehints->width = width;
315         xsizehints->height = height;
316         XSetWMNormalHints(m_display, m_window, xsizehints);
317         XFree(xsizehints);
318
319         XClassHint * xclasshint = XAllocClassHint();
320         int len = title.Length() +1 ;
321         char *wmclass = (char *)malloc(sizeof(char) * len);
322         strncpy(wmclass, (const char*)title, sizeof(char) * len);
323         xclasshint->res_name = wmclass;
324         xclasshint->res_class = wmclass;
325         XSetClassHint(m_display, m_window, xclasshint);
326         free(wmclass);
327         XFree(xclasshint);
328
329         /* The basic for a good ICCCM "work" */
330         if (m_system->m_wm_protocols) {
331                 natom= 0;
332
333                 if (m_system->m_delete_window_atom) {
334                         atoms[natom]= m_system->m_delete_window_atom;
335                         natom++;
336                 }
337
338                 if (m_system->m_wm_take_focus) {
339                         atoms[natom]= m_system->m_wm_take_focus;
340                         natom++;
341                 }
342
343                 if (natom) {
344                         /* printf("Register atoms: %d\n", natom); */
345                         XSetWMProtocols(m_display, m_window, atoms, natom);
346                 }
347         }
348
349         // Set the window icon
350         XWMHints *xwmhints = XAllocWMHints();
351         XImage *x_image, *mask_image;
352         Pixmap icon_pixmap, mask_pixmap;
353         icon_pixmap = XCreatePixmap(display, m_window, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 24);
354         mask_pixmap = XCreatePixmap(display, m_window, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 1);
355         GC gc_icon = XCreateGC(display, icon_pixmap, 0, NULL);
356         GC gc_mask = XCreateGC(display, mask_pixmap, 0, NULL);
357         
358         x_image = XCreateImage( display, m_visual->visual, 24, ZPixmap, 0, NULL, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 32, 0 );
359         mask_image = XCreateImage( display, m_visual->visual, 1, ZPixmap, 0, NULL,  BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 8, 0);
360         
361         x_image->data = (char *)malloc(x_image->bytes_per_line * BLENDER_ICON_HEIGHT);
362         mask_image->data = (char *)malloc( mask_image->bytes_per_line * BLENDER_ICON_HEIGHT);
363         
364         /* copy the BLENDER_ICON_48x48x24 into the XImage */
365         unsigned char *col = BLENDER_ICON_48x48x24;
366         int px, py;
367         for (px=0; px<BLENDER_ICON_WIDTH; px++) {
368                 for (py=0; py<BLENDER_ICON_HEIGHT; py++, col+=3) {
369                         /* mask out pink */
370                         if (col[0]==255 && col[1] == 0 && col[2]== 255) {
371                                 XPutPixel(mask_image, px, py, 0 );
372                         } else {
373                                 XPutPixel(x_image, px, py, (col[0]<<16)+(col[1]<<8)+col[2] );
374                                 XPutPixel(mask_image, px, py, 1 );
375                         }
376                 }
377         }
378         
379         XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
380         XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
381         
382         // Now the pixmap is ok to assign to the window as a hint
383         xwmhints->icon_pixmap = icon_pixmap;
384         xwmhints->icon_mask = mask_pixmap;
385         XFreeGC (display, gc_icon);
386         XFreeGC (display, gc_mask);
387         XDestroyImage( x_image ); /* frees x_image->data too */
388         XDestroyImage( mask_image );
389         
390         xwmhints->initial_state = NormalState;
391         xwmhints->flags         = IconPixmapHint|IconMaskHint|StateHint;
392         XSetWMHints(display, m_window, xwmhints );
393         XFree(xwmhints);
394         // done setting the icon
395         
396
397         setTitle(title);
398
399         initXInputDevices();
400
401         // now set up the rendering context.
402         if (installDrawingContext(type) == GHOST_kSuccess) {
403                 m_valid_setup = true;
404                 GHOST_PRINT("Created window\n");
405         }
406
407         XMapWindow(m_display, m_window);
408         GHOST_PRINT("Mapped window\n");
409
410         XFlush(m_display);
411 }
412
413 /* 
414         Dummy function to get around IO Handler exiting if device invalid
415         Basically it will not crash blender now if you have a X device that 
416         is configured but not plugged in.
417
418 */
419 static int ApplicationErrorHandler(Display *display, XErrorEvent *theEvent) {
420         fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
421                 theEvent->error_code, theEvent->request_code) ;
422
423         /* No exit! - but keep lint happy */
424         return 0 ;
425 }
426
427 void GHOST_WindowX11::initXInputDevices()
428 {
429         static XErrorHandler old_handler = (XErrorHandler) 0 ;
430         XExtensionVersion *version = XGetExtensionVersion(m_display, INAME);
431
432         if(version && (version != (XExtensionVersion*)NoSuchExtension)) {
433                 if(version->present) {
434                         int device_count;
435                         XDeviceInfo* device_info = XListInputDevices(m_display, &device_count);
436                         m_xtablet.StylusDevice = 0;
437                         m_xtablet.EraserDevice = 0;
438                         m_xtablet.CommonData.Active= 0;
439
440                         /* Install our error handler to override Xlib's termination behavior */
441                         old_handler = XSetErrorHandler(ApplicationErrorHandler) ;
442
443                         for(int i=0; i<device_count; ++i) {
444                                 if(!strcasecmp(device_info[i].name, "stylus")) {
445                                         m_xtablet.StylusID= device_info[i].id;
446                                         m_xtablet.StylusDevice = XOpenDevice(m_display, m_xtablet.StylusID);
447
448                                         if (m_xtablet.StylusDevice != NULL) {
449                                                 /* Find how many pressure levels tablet has */
450                                                 XAnyClassPtr ici = device_info[i].inputclassinfo;
451                                                 for(int j=0; j<m_xtablet.StylusDevice->num_classes; ++j) {
452                                                         if(ici->c_class==ValuatorClass) {
453                                                                 XValuatorInfo* xvi = (XValuatorInfo*)ici;
454                                                                 m_xtablet.PressureLevels = xvi->axes[2].max_value;
455                                                         
456                                                                 /* this is assuming that the tablet has the same tilt resolution in both
457                                                                  * positive and negative directions. It would be rather weird if it didn't.. */
458                                                                 m_xtablet.XtiltLevels = xvi->axes[3].max_value;
459                                                                 m_xtablet.YtiltLevels = xvi->axes[4].max_value;
460                                                                 break;
461                                                         }
462                                                 
463                                                         ici = (XAnyClassPtr)(((char *)ici) + ici->length);
464                                                 }
465                                         } else {
466                                                 m_xtablet.StylusID= 0;
467                                         }
468                                 }
469                                 if(!strcasecmp(device_info[i].name, "eraser")) {
470                                         m_xtablet.EraserID= device_info[i].id;
471                                         m_xtablet.EraserDevice = XOpenDevice(m_display, m_xtablet.EraserID);
472                                         if (m_xtablet.EraserDevice == NULL) m_xtablet.EraserID= 0;
473                                 }
474                         }
475
476                         /* Restore handler */
477                         (void) XSetErrorHandler(old_handler) ;
478
479                         XFreeDeviceList(device_info);
480
481
482                         XEventClass xevents[10], ev;
483                         int dcount = 0;
484
485                         if(m_xtablet.StylusDevice) {
486                                 DeviceMotionNotify(m_xtablet.StylusDevice, m_xtablet.MotionEvent, ev);
487                                 if(ev) xevents[dcount++] = ev;
488                                 ProximityIn(m_xtablet.StylusDevice, m_xtablet.ProxInEvent, ev);
489                                 if(ev) xevents[dcount++] = ev;
490                                 ProximityOut(m_xtablet.StylusDevice, m_xtablet.ProxOutEvent, ev);
491                                 if(ev) xevents[dcount++] = ev;
492                         }
493                         if(m_xtablet.EraserDevice) {
494                                 DeviceMotionNotify(m_xtablet.EraserDevice, m_xtablet.MotionEvent, ev);
495                                 if(ev) xevents[dcount++] = ev;
496                                 ProximityIn(m_xtablet.EraserDevice, m_xtablet.ProxInEvent, ev);
497                                 if(ev) xevents[dcount++] = ev;
498                                 ProximityOut(m_xtablet.EraserDevice, m_xtablet.ProxOutEvent, ev);
499                                 if(ev) xevents[dcount++] = ev;
500                         }
501
502                         XSelectExtensionEvent(m_display, m_window, xevents, dcount);
503                 }
504                 XFree(version);
505         }
506 }       
507
508
509         Window 
510 GHOST_WindowX11::
511 getXWindow(
512 ){
513         return m_window;
514 }       
515
516         bool 
517 GHOST_WindowX11::
518 getValid(
519 ) const {
520         return m_valid_setup;
521 }
522
523         void 
524 GHOST_WindowX11::
525 setTitle(
526         const STR_String& title
527 ){
528         XStoreName(m_display,m_window,title);
529         XFlush(m_display);
530 }
531
532         void 
533 GHOST_WindowX11::
534 getTitle(
535         STR_String& title
536 ) const {
537         char *name = NULL;
538         
539         XFetchName(m_display,m_window,&name);
540         title= name?name:"untitled";
541         XFree(name);
542 }
543         
544         void 
545 GHOST_WindowX11::
546 getWindowBounds(
547         GHOST_Rect& bounds
548 ) const {
549                 // Getting the window bounds under X11 is not
550                 // really supported (nor should it be desired).
551         getClientBounds(bounds);
552 }
553
554         void 
555 GHOST_WindowX11::
556 getClientBounds(
557         GHOST_Rect& bounds
558 ) const {
559         Window root_return;
560         int x_return,y_return;
561         unsigned int w_return,h_return,border_w_return,depth_return;
562         GHOST_TInt32 screen_x, screen_y;
563         
564         XGetGeometry(m_display,m_window,&root_return,&x_return,&y_return,
565                 &w_return,&h_return,&border_w_return,&depth_return);
566
567         clientToScreen(0, 0, screen_x, screen_y);
568         
569         bounds.m_l = screen_x;
570         bounds.m_r = bounds.m_l + w_return;
571         bounds.m_t = screen_y;
572         bounds.m_b = bounds.m_t + h_return;
573
574 }
575
576         GHOST_TSuccess 
577 GHOST_WindowX11::
578 setClientWidth(
579         GHOST_TUns32 width
580 ){      
581         XWindowChanges values;
582         unsigned int value_mask= CWWidth;               
583         values.width = width;
584         XConfigureWindow(m_display,m_window,value_mask,&values);
585
586         return GHOST_kSuccess;
587 }
588
589         GHOST_TSuccess 
590 GHOST_WindowX11::
591 setClientHeight(
592         GHOST_TUns32 height
593 ){
594         XWindowChanges values;
595         unsigned int value_mask= CWHeight;              
596         values.height = height;
597         XConfigureWindow(m_display,m_window,value_mask,&values);
598         return GHOST_kSuccess;
599
600 }
601
602         GHOST_TSuccess 
603 GHOST_WindowX11::
604 setClientSize(
605         GHOST_TUns32 width,
606         GHOST_TUns32 height
607 ){
608         XWindowChanges values;
609         unsigned int value_mask= CWWidth | CWHeight;            
610         values.width = width;
611         values.height = height;
612         XConfigureWindow(m_display,m_window,value_mask,&values);
613         return GHOST_kSuccess;
614
615 }       
616
617         void 
618 GHOST_WindowX11::
619 screenToClient(
620         GHOST_TInt32 inX,
621         GHOST_TInt32 inY,
622         GHOST_TInt32& outX,
623         GHOST_TInt32& outY
624 ) const {
625         // not sure about this one!
626
627         int ax,ay;
628         Window temp;
629
630         XTranslateCoordinates(
631                         m_display,
632                         RootWindow(m_display, m_visual->screen),
633                         m_window,
634                         inX,
635                         inY,
636                         &ax,
637                         &ay,
638                         &temp
639                 );
640         outX = ax;
641         outY = ay;
642 }
643                  
644         void 
645 GHOST_WindowX11::
646 clientToScreen(
647         GHOST_TInt32 inX,
648         GHOST_TInt32 inY,
649         GHOST_TInt32& outX,
650         GHOST_TInt32& outY
651 ) const {
652         int ax,ay;
653         Window temp;
654
655         XTranslateCoordinates(
656                         m_display,
657                         m_window,
658                         RootWindow(m_display, m_visual->screen),
659                         inX,
660                         inY,
661                         &ax,
662                         &ay,
663                         &temp
664                 );
665         outX = ax;
666         outY = ay;
667 }
668
669
670         GHOST_TWindowState 
671 GHOST_WindowX11::
672 getState(
673 ) const {
674         //FIXME 
675         return GHOST_kWindowStateNormal;
676 }
677
678         GHOST_TSuccess 
679 GHOST_WindowX11::
680 setState(
681         GHOST_TWindowState state
682 ){
683         //TODO
684
685         if (state == (int)getState()) {
686                 return GHOST_kSuccess;
687         } else {
688                 return GHOST_kFailure;
689         }
690
691 }
692
693 #include <iostream>
694 using namespace std;
695
696         GHOST_TSuccess 
697 GHOST_WindowX11::
698 setOrder(
699         GHOST_TWindowOrder order
700 ){
701         if (order == GHOST_kWindowOrderTop) {
702                 XWindowAttributes attr;   
703                 Atom atom;
704
705                 /* We use both XRaiseWindow and _NET_ACTIVE_WINDOW, since some
706                    window managers ignore the former (e.g. kwin from kde) and others
707                    don't implement the latter (e.g. fluxbox pre 0.9.9) */
708
709                 XRaiseWindow(m_display, m_window);
710
711                 atom = XInternAtom(m_display, "_NET_ACTIVE_WINDOW", True);
712
713                 if (atom != None) {
714                         Window root;
715                         XEvent xev;
716                         long eventmask;
717
718                         xev.xclient.type = ClientMessage;
719                         xev.xclient.serial = 0;
720                         xev.xclient.send_event = True;
721                         xev.xclient.window = m_window;
722                         xev.xclient.message_type = atom;
723
724                         xev.xclient.format = 32;
725                         xev.xclient.data.l[0] = 1;
726                         xev.xclient.data.l[1] = CurrentTime;
727                         xev.xclient.data.l[2] = m_window;
728                         xev.xclient.data.l[3] = 0;
729                         xev.xclient.data.l[4] = 0;
730
731                         root = RootWindow(m_display, m_visual->screen),
732                         eventmask = SubstructureRedirectMask | SubstructureNotifyMask;
733
734                         XSendEvent(m_display, root, False, eventmask, &xev);
735                 }
736
737                 XGetWindowAttributes(m_display, m_window, &attr);
738
739                 /* iconized windows give bad match error */
740                 if (attr.map_state == IsViewable)
741                         XSetInputFocus(m_display, m_window, RevertToPointerRoot,
742                                                  CurrentTime);
743                 XFlush(m_display);
744         } else if (order == GHOST_kWindowOrderBottom) {
745                 XLowerWindow(m_display,m_window);
746                 XFlush(m_display);
747         } else {
748                 return GHOST_kFailure;
749         }
750         
751         return GHOST_kSuccess;
752 }
753
754         GHOST_TSuccess 
755 GHOST_WindowX11::
756 swapBuffers(
757 ){
758         if (getDrawingContextType() == GHOST_kDrawingContextTypeOpenGL) {
759                 glXSwapBuffers(m_display,m_window);
760                 return GHOST_kSuccess;
761         } else {
762                 return GHOST_kFailure;
763         }
764 }
765
766         GHOST_TSuccess 
767 GHOST_WindowX11::
768 activateDrawingContext(
769 ){
770         if (m_context !=NULL) {
771                 glXMakeCurrent(m_display, m_window,m_context);                                          
772                 return GHOST_kSuccess;
773         } 
774         return GHOST_kFailure;
775 }
776
777         GHOST_TSuccess 
778 GHOST_WindowX11::
779 invalidate(
780 ){
781         
782         // So the idea of this function is to generate an expose event
783         // for the window.
784         // Unfortunately X does not handle expose events for you and 
785         // it is the client's job to refresh the dirty part of the window.
786         // We need to queue up invalidate calls and generate GHOST events 
787         // for them in the system.
788
789         // We implement this by setting a boolean in this class to concatenate 
790         // all such calls into a single event for this window.
791
792         // At the same time we queue the dirty windows in the system class
793         // and generate events for them at the next processEvents call.
794
795         if (m_invalid_window == false) {
796                 m_system->addDirtyWindow(this);
797                 m_invalid_window = true;
798         } 
799  
800         return GHOST_kSuccess;
801 }
802
803 /**
804  * called by the X11 system implementation when expose events
805  * for the window have been pushed onto the GHOST queue
806  */
807  
808         void
809 GHOST_WindowX11::
810 validate(
811 ){
812         m_invalid_window = false;
813 }       
814  
815  
816 /**
817  * Destructor.
818  * Closes the window and disposes resources allocated.
819  */
820
821 GHOST_WindowX11::
822 ~GHOST_WindowX11(
823 ){
824         static Atom Primary_atom, Clipboard_atom;
825         Window p_owner, c_owner;
826         /*Change the owner of the Atoms to None if we are the owner*/
827         Primary_atom = XInternAtom(m_display, "PRIMARY", False);
828         Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False);
829         
830         p_owner = XGetSelectionOwner(m_display, Primary_atom);
831         c_owner = XGetSelectionOwner(m_display, Clipboard_atom);
832         
833         std::map<unsigned int, Cursor>::iterator it = m_standard_cursors.begin();
834         for (; it != m_standard_cursors.end(); it++) {
835                 XFreeCursor(m_display, it->second);
836         }
837
838         if (m_empty_cursor) {
839                 XFreeCursor(m_display, m_empty_cursor);
840         }
841         if (m_custom_cursor) {
842                 XFreeCursor(m_display, m_custom_cursor);
843         }
844         
845         if (m_context) {
846                 if (m_context == s_firstContext) {
847                         s_firstContext = NULL;
848                 }
849                 glXDestroyContext(m_display, m_context);
850         }
851         
852         if (p_owner == m_window) {
853                 XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime);
854         }
855         if (c_owner == m_window) {
856                 XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime);
857         }
858         
859         XDestroyWindow(m_display, m_window);
860         XFree(m_visual);
861 }
862
863
864
865
866 /**
867  * Tries to install a rendering context in this window.
868  * @param type  The type of rendering context installed.
869  * @return Indication as to whether installation has succeeded.
870  */
871         GHOST_TSuccess 
872 GHOST_WindowX11::
873 installDrawingContext(
874         GHOST_TDrawingContextType type
875 ){
876         // only support openGL for now.
877         GHOST_TSuccess success;
878         switch (type) {
879         case GHOST_kDrawingContextTypeOpenGL:
880                 m_context = glXCreateContext(m_display, m_visual, s_firstContext, True);
881                 if (m_context !=NULL) {
882                         if (!s_firstContext) {
883                                 s_firstContext = m_context;
884                         }
885                         glXMakeCurrent(m_display, m_window,m_context);                                          
886                         success = GHOST_kSuccess;
887                 } else {
888                         success = GHOST_kFailure;
889                 }
890
891                 break;
892
893         case GHOST_kDrawingContextTypeNone:
894                 success = GHOST_kSuccess;
895                 break;
896
897         default:
898                 success = GHOST_kFailure;
899         }
900         return success;
901 }
902
903
904
905 /**
906  * Removes the current drawing context.
907  * @return Indication as to whether removal has succeeded.
908  */
909         GHOST_TSuccess 
910 GHOST_WindowX11::
911 removeDrawingContext(
912 ){
913         GHOST_TSuccess success;
914
915         if (m_context != NULL) {
916                 glXDestroyContext(m_display, m_context);
917                 success = GHOST_kSuccess;
918         } else {
919                 success = GHOST_kFailure;
920         }
921         return success; 
922 }
923
924
925         Cursor
926 GHOST_WindowX11::
927 getStandardCursor(
928         GHOST_TStandardCursor g_cursor
929 ){
930         unsigned int xcursor_id;
931
932 #define GtoX(gcurs, xcurs)      case gcurs: xcursor_id = xcurs
933         switch (g_cursor) {
934         GtoX(GHOST_kStandardCursorRightArrow, XC_arrow); break;
935         GtoX(GHOST_kStandardCursorLeftArrow, XC_top_left_arrow); break;
936         GtoX(GHOST_kStandardCursorInfo, XC_hand1); break;
937         GtoX(GHOST_kStandardCursorDestroy, XC_pirate); break;
938         GtoX(GHOST_kStandardCursorHelp, XC_question_arrow); break; 
939         GtoX(GHOST_kStandardCursorCycle, XC_exchange); break;
940         GtoX(GHOST_kStandardCursorSpray, XC_spraycan); break;
941         GtoX(GHOST_kStandardCursorWait, XC_watch); break;
942         GtoX(GHOST_kStandardCursorText, XC_xterm); break;
943         GtoX(GHOST_kStandardCursorCrosshair, XC_crosshair); break;
944         GtoX(GHOST_kStandardCursorUpDown, XC_sb_v_double_arrow); break;
945         GtoX(GHOST_kStandardCursorLeftRight, XC_sb_h_double_arrow); break;
946         GtoX(GHOST_kStandardCursorTopSide, XC_top_side); break;
947         GtoX(GHOST_kStandardCursorBottomSide, XC_bottom_side); break;
948         GtoX(GHOST_kStandardCursorLeftSide, XC_left_side); break;
949         GtoX(GHOST_kStandardCursorRightSide, XC_right_side); break;
950         GtoX(GHOST_kStandardCursorTopLeftCorner, XC_top_left_corner); break;
951         GtoX(GHOST_kStandardCursorTopRightCorner, XC_top_right_corner); break;
952         GtoX(GHOST_kStandardCursorBottomRightCorner, XC_bottom_right_corner); break;
953         GtoX(GHOST_kStandardCursorBottomLeftCorner, XC_bottom_left_corner); break;
954         GtoX(GHOST_kStandardCursorPencil, XC_pencil); break;
955         default:
956                 xcursor_id = 0;
957         }
958 #undef GtoX
959
960         if (xcursor_id) {
961                 Cursor xcursor = m_standard_cursors[xcursor_id];
962                 
963                 if (!xcursor) {
964                         xcursor = XCreateFontCursor(m_display, xcursor_id);
965
966                         m_standard_cursors[xcursor_id] = xcursor;
967                 }
968                 
969                 return xcursor;
970         } else {
971                 return None;
972         }
973 }
974
975         Cursor 
976 GHOST_WindowX11::
977 getEmptyCursor(
978 ) {
979         if (!m_empty_cursor) {
980                 Pixmap blank;
981                 XColor dummy;
982                 char data[1] = {0};
983                         
984                 /* make a blank cursor */
985                 blank = XCreateBitmapFromData (
986                         m_display, 
987                         RootWindow(m_display,DefaultScreen(m_display)),
988                         data, 1, 1
989                 );
990
991                 m_empty_cursor = XCreatePixmapCursor(m_display, blank, blank, &dummy, &dummy, 0, 0);
992                 XFreePixmap(m_display, blank);
993         }
994
995         return m_empty_cursor;
996 }
997
998         GHOST_TSuccess
999 GHOST_WindowX11::
1000 setWindowCursorVisibility(
1001         bool visible
1002 ){
1003         Cursor xcursor;
1004         
1005         if (visible) {
1006                 xcursor = getStandardCursor( getCursorShape() );
1007         } else {
1008                 xcursor = getEmptyCursor();
1009         }
1010
1011         XDefineCursor(m_display, m_window, xcursor);
1012         XFlush(m_display);
1013         
1014         return GHOST_kSuccess;
1015 }
1016
1017         GHOST_TSuccess
1018 GHOST_WindowX11::
1019 setWindowCursorShape(
1020         GHOST_TStandardCursor shape
1021 ){
1022         Cursor xcursor = getStandardCursor( shape );
1023         
1024         XDefineCursor(m_display, m_window, xcursor);
1025         XFlush(m_display);
1026
1027         return GHOST_kSuccess;
1028 }
1029
1030         GHOST_TSuccess
1031 GHOST_WindowX11::
1032 setWindowCustomCursorShape(
1033         GHOST_TUns8 bitmap[16][2], 
1034         GHOST_TUns8 mask[16][2], 
1035         int hotX, 
1036         int hotY
1037 ){
1038
1039 setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask, 
1040                                                                         16, 16, hotX, hotY, 0, 1);
1041         return GHOST_kSuccess;
1042 }
1043
1044         GHOST_TSuccess
1045 GHOST_WindowX11::
1046 setWindowCustomCursorShape(     
1047         GHOST_TUns8 *bitmap, 
1048         GHOST_TUns8 *mask, 
1049         int sizex, 
1050         int sizey, 
1051         int hotX, 
1052         int hotY, 
1053         int fg_color, 
1054         int bg_color
1055 ){
1056         Pixmap bitmap_pix, mask_pix;
1057         XColor fg, bg;
1058         
1059         if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
1060                 "White", &fg, &fg) == 0) return GHOST_kFailure;
1061         if(XAllocNamedColor(m_display, DefaultColormap(m_display, DefaultScreen(m_display)),
1062                 "Black", &bg, &bg) == 0) return GHOST_kFailure;
1063
1064         if (m_custom_cursor) {
1065                 XFreeCursor(m_display, m_custom_cursor);
1066         }
1067
1068         bitmap_pix = XCreateBitmapFromData(m_display, m_window, (char*) bitmap, sizex, sizey);
1069         mask_pix = XCreateBitmapFromData(m_display, m_window, (char*) mask, sizex, sizey);
1070                 
1071         m_custom_cursor = XCreatePixmapCursor(m_display, bitmap_pix, mask_pix, &fg, &bg, hotX, hotY);
1072         XDefineCursor(m_display, m_window, m_custom_cursor);
1073         XFlush(m_display);
1074         
1075         XFreePixmap(m_display, bitmap_pix);
1076         XFreePixmap(m_display, mask_pix);
1077
1078         return GHOST_kSuccess;
1079 }
1080
1081 /*
1082
1083 void glutCustomCursor(char *data1, char *data2, int size)
1084 {
1085         Pixmap source, mask;
1086         Cursor cursor;
1087         XColor fg, bg;
1088         
1089         if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
1090                 "White", &fg, &fg) == 0) return;
1091         if(XAllocNamedColor(__glutDisplay, DefaultColormap(__glutDisplay, __glutScreen),
1092                 "Red", &bg, &bg) == 0) return;
1093
1094
1095         source= XCreateBitmapFromData(__glutDisplay, xdraw, data2, size, size);
1096         mask= XCreateBitmapFromData(__glutDisplay, xdraw, data1, size, size);
1097                 
1098         cursor= XCreatePixmapCursor(__glutDisplay, source, mask, &fg, &bg, 7, 7);
1099                 
1100         XFreePixmap(__glutDisplay, source);
1101         XFreePixmap(__glutDisplay, mask);
1102                 
1103         XDefineCursor(__glutDisplay, xdraw, cursor);
1104 }
1105
1106 */