Blender V2.61 - r43446

GHOST_WindowX11.cpp

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00033 #include "GHOST_WindowX11.h"
00034 #include "GHOST_SystemX11.h"
00035 #include "STR_String.h"
00036 #include "GHOST_Debug.h"
00037 
00038 // For standard X11 cursors
00039 #include <X11/cursorfont.h>
00040 #include <X11/Xatom.h>
00041 
00042 #if defined(__sun__) || defined( __sun ) || defined (__sparc) || defined (__sparc__) || defined (_AIX)
00043 #include <strings.h>
00044 #endif
00045 
00046 #include <cstring>
00047 #include <cstdio>
00048 
00049 #include <algorithm>
00050 #include <string>
00051 
00052 // For obscure full screen mode stuuf
00053 // lifted verbatim from blut.
00054 
00055 typedef struct {
00056     long flags;
00057     long functions;
00058     long decorations;
00059     long input_mode;
00060 } MotifWmHints;
00061 
00062 #define MWM_HINTS_DECORATIONS         (1L << 1)
00063 
00064 
00065 // #define GHOST_X11_GRAB
00066 
00067 /*
00068  * A Client can't change the window property, that is
00069  * the work of the window manager. In case, we send
00070  * a ClientMessage to the RootWindow with the property
00071  * and the Action (WM-spec define this):
00072  */
00073 #define _NET_WM_STATE_REMOVE 0
00074 #define _NET_WM_STATE_ADD 1
00075 #define _NET_WM_STATE_TOGGLE 2
00076 
00077 /*
00078 import bpy
00079 I = bpy.data.images['blender.png'] # the 48x48 icon
00080 
00081 # Write to a file that can be 
00082 # used within static unsigned char BLENDER_ICON_48x48x24[] = {...}
00083 f = open('/myicon.txt', 'w')
00084 for j in xrange(48):
00085         for k in xrange(48):
00086                 v = I.getPixelI(j,47-k)
00087                 v.pop()
00088                 for p in v:
00089                         f.write(str(hex(p))+',')
00090 
00091         f.write('\n')
00092 */
00093 
00094 // See the python script above to regenerate the 48x48 icon within blender
00095 #define BLENDER_ICON_WIDTH 48
00096 #define BLENDER_ICON_HEIGHT 48
00097 static unsigned char BLENDER_ICON_48x48x24[] = {
00098 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00099 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00100 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00101 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00102 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00103 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00104 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00105 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00106 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00107 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00108 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00109 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00110 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00111 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00112 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00113 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00114 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00115 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00116 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00117 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00118 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00119 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00120 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,
00121 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,
00122 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,
00123 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,
00124 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,
00125 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,
00126 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,
00127 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,
00128 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,
00129 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,
00130 0xff,0x0,0xff,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,
00131 0xff,0x0,0xff,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,
00132 0xff,0x0,0xff,0xff,0x0,0xff,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,
00133 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00134 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00135 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00136 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00137 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00138 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00139 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00140 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00141 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00142 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00143 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00144 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00145 0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,0xff,0x0,0xff,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,
00146 };
00147 
00148 
00149 GLXContext GHOST_WindowX11::s_firstContext = NULL;
00150 
00151 GHOST_WindowX11::
00152 GHOST_WindowX11(
00153     GHOST_SystemX11 *system,
00154     Display * display,
00155     const STR_String& title, 
00156     GHOST_TInt32 left,
00157     GHOST_TInt32 top,
00158     GHOST_TUns32 width, 
00159     GHOST_TUns32 height,
00160     GHOST_TWindowState state,
00161     const GHOST_TEmbedderWindowID parentWindow,
00162     GHOST_TDrawingContextType type,
00163     const bool stereoVisual,
00164     const GHOST_TUns16 numOfAASamples
00165 ) :
00166     GHOST_Window(width,height,state,type,stereoVisual,numOfAASamples),
00167     m_context(NULL),
00168     m_display(display),
00169     m_normal_state(GHOST_kWindowStateNormal),
00170     m_system (system),
00171     m_valid_setup (false),
00172     m_invalid_window(false),
00173     m_empty_cursor(None),
00174     m_custom_cursor(None)
00175 {
00176     
00177     // Set up the minimum atrributes that we require and see if
00178     // X can find us a visual matching those requirements.
00179 
00180     int attributes[40], i, samples;
00181     Atom atoms[2];
00182     int natom;
00183     int glxVersionMajor, glxVersionMinor; // As in GLX major.minor
00184 
00185 #ifdef WITH_X11_XINPUT
00186     /* initialize incase X11 fails to load */
00187     memset(&m_xtablet, 0, sizeof(m_xtablet));
00188 #endif
00189 
00190     m_visual= NULL;
00191 
00192     if (!glXQueryVersion(m_display, &glxVersionMajor, &glxVersionMinor)) {
00193         printf("%s:%d: X11 glXQueryVersion() failed, verify working openGL system!\n", __FILE__, __LINE__);
00194         
00195         /* exit if this is the first window */
00196         if(s_firstContext==NULL) {
00197             printf("initial window could not find the GLX extension, exit!\n");
00198             exit(1);
00199         }
00200 
00201         return;
00202     }
00203 
00204     /* Find the display with highest samples, starting at level requested */
00205     for (samples = m_numOfAASamples; samples >= 0; samples--) {
00206         i = 0; /* Reusing attributes array, so reset counter */
00207 
00208         if(m_stereoVisual)
00209             attributes[i++] = GLX_STEREO;
00210 
00211         attributes[i++] = GLX_RGBA;
00212         attributes[i++] = GLX_DOUBLEBUFFER;
00213         attributes[i++] = GLX_RED_SIZE;   attributes[i++] = 1;
00214         attributes[i++] = GLX_BLUE_SIZE;  attributes[i++] = 1;
00215         attributes[i++] = GLX_GREEN_SIZE; attributes[i++] = 1;
00216         attributes[i++] = GLX_DEPTH_SIZE; attributes[i++] = 1;
00217         /* GLX >= 1.4 required for multi-sample */
00218         if(samples && (glxVersionMajor >= 1) && (glxVersionMinor >= 4)) {
00219             attributes[i++] = GLX_SAMPLE_BUFFERS; attributes[i++] = 1;
00220             attributes[i++] = GLX_SAMPLES; attributes[i++] = samples;
00221         }
00222         attributes[i] = None;
00223 
00224         m_visual = glXChooseVisual(m_display, DefaultScreen(m_display), attributes);
00225 
00226         /* Any sample level or even zero, which means oversampling disabled, is good
00227            but we need a valid visual to continue */
00228         if (m_visual == NULL) {
00229             if (samples == 0) {
00230                 /* All options exhausted, cannot continue */
00231                 printf("%s:%d: X11 glXChooseVisual() failed, verify working openGL system!\n", __FILE__, __LINE__);
00232                 
00233                 if(s_firstContext==NULL) {
00234                     printf("initial window could not find the GLX extension, exit!\n");
00235                     exit(1);
00236                 }
00237                 
00238                 return;
00239             }
00240         } else {
00241             if (m_numOfAASamples && (m_numOfAASamples > samples)) {
00242                 printf("%s:%d: oversampling requested %i but using %i samples\n",
00243                        __FILE__, __LINE__, m_numOfAASamples, samples);
00244             }
00245             break;
00246         }
00247     }
00248 
00249     // Create a bunch of attributes needed to create an X window.
00250 
00251 
00252     // First create a colormap for the window and visual. 
00253     // This seems pretty much a legacy feature as we are in rgba mode anyway.
00254 
00255     XSetWindowAttributes xattributes;
00256     memset(&xattributes, 0, sizeof(xattributes));
00257 
00258     xattributes.colormap= XCreateColormap(
00259         m_display, 
00260         RootWindow(m_display, m_visual->screen),
00261         m_visual->visual,
00262         AllocNone
00263     );
00264 
00265     xattributes.border_pixel= 0;
00266 
00267     // Specify which events we are interested in hearing.   
00268 
00269     xattributes.event_mask= 
00270         ExposureMask | StructureNotifyMask | 
00271         KeyPressMask | KeyReleaseMask |
00272         EnterWindowMask | LeaveWindowMask |
00273         ButtonPressMask | ButtonReleaseMask |
00274         PointerMotionMask | FocusChangeMask | PropertyChangeMask;
00275 
00276     // create the window!
00277 
00278     ;
00279     if (parentWindow == 0) {
00280         m_window = 
00281             XCreateWindow(
00282                 m_display, 
00283                 RootWindow(m_display, m_visual->screen), 
00284                 left,
00285                 top,
00286                 width,
00287                 height,
00288                 0, // no border.
00289                 m_visual->depth,
00290                 InputOutput, 
00291                 m_visual->visual,
00292                 CWBorderPixel|CWColormap|CWEventMask, 
00293                 &xattributes
00294             );
00295     } else {
00296 
00297         Window root_return;
00298         int x_return,y_return;
00299         unsigned int w_return,h_return,border_w_return,depth_return;
00300         
00301         XGetGeometry(m_display, parentWindow, &root_return, &x_return, &y_return,
00302             &w_return, &h_return, &border_w_return, &depth_return );
00303 
00304         left = 0;
00305         top = 0;
00306         width = w_return;
00307         height = h_return;
00308 
00309 
00310         m_window = XCreateWindow(
00311                 m_display, 
00312                 parentWindow,  // reparent against embedder 
00313                 left,
00314                 top,
00315                 width,
00316                 height,
00317                 0, // no border.
00318                 m_visual->depth,
00319                 InputOutput, 
00320                 m_visual->visual,
00321                 CWBorderPixel|CWColormap|CWEventMask, 
00322                 &xattributes
00323             );
00324 
00325         XSelectInput(m_display , parentWindow, SubstructureNotifyMask);
00326         
00327     }   
00328     
00329     /*
00330      * One of the problem with WM-spec is that can't set a property
00331      * to a window that isn't mapped. That is why we can't "just
00332      * call setState" here.
00333      *
00334      * To fix this, we first need know that the window is really
00335      * map waiting for the MapNotify event.
00336      *
00337      * So, m_post_init indicate that we need wait for the MapNotify
00338      * event and then set the Window state to the m_post_state.
00339      */
00340     if ((state != GHOST_kWindowStateNormal) && (state != GHOST_kWindowStateMinimized)) {
00341         m_post_init = True;
00342         m_post_state = state;
00343     }
00344     else {
00345         m_post_init = False;
00346         m_post_state = GHOST_kWindowStateNormal;
00347     }
00348     
00349     // Create some hints for the window manager on how
00350     // we want this window treated.
00351 
00352     XSizeHints * xsizehints = XAllocSizeHints();
00353     xsizehints->flags = PPosition | PSize | PMinSize | PMaxSize;
00354     xsizehints->x = left;
00355     xsizehints->y = top;
00356     xsizehints->width = width;
00357     xsizehints->height = height;
00358     xsizehints->min_width= 320;     // size hints, could be made apart of the ghost api
00359     xsizehints->min_height= 240;    // limits are also arbitrary, but should not allow 1x1 window
00360     xsizehints->max_width= 65535;
00361     xsizehints->max_height= 65535;
00362     XSetWMNormalHints(m_display, m_window, xsizehints);
00363     XFree(xsizehints);
00364 
00365     XClassHint * xclasshint = XAllocClassHint();
00366     int len = title.Length() +1 ;
00367     char *wmclass = (char *)malloc(sizeof(char) * len);
00368     strncpy(wmclass, (const char*)title, sizeof(char) * len);
00369     xclasshint->res_name = wmclass;
00370     xclasshint->res_class = wmclass;
00371     XSetClassHint(m_display, m_window, xclasshint);
00372     free(wmclass);
00373     XFree(xclasshint);
00374 
00375     /* The basic for a good ICCCM "work" */
00376     if (m_system->m_wm_protocols) {
00377         natom= 0;
00378 
00379         if (m_system->m_delete_window_atom) {
00380             atoms[natom]= m_system->m_delete_window_atom;
00381             natom++;
00382         }
00383 
00384         if (m_system->m_wm_take_focus) {
00385             atoms[natom]= m_system->m_wm_take_focus;
00386             natom++;
00387         }
00388 
00389         if (natom) {
00390             /* printf("Register atoms: %d\n", natom); */
00391             XSetWMProtocols(m_display, m_window, atoms, natom);
00392         }
00393     }
00394 
00395 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
00396     m_xic = XCreateIC(m_system->getX11_XIM(), XNClientWindow, m_window, XNFocusWindow, m_window,
00397                       XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
00398                       XNResourceName, GHOST_X11_RES_NAME, XNResourceClass,
00399                       GHOST_X11_RES_CLASS, NULL);
00400 #endif
00401 
00402     // Set the window icon
00403     XWMHints *xwmhints = XAllocWMHints();
00404     XImage *x_image, *mask_image;
00405     Pixmap icon_pixmap, mask_pixmap;
00406     icon_pixmap = XCreatePixmap(display, m_window, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 24);
00407     mask_pixmap = XCreatePixmap(display, m_window, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 1);
00408     GC gc_icon = XCreateGC(display, icon_pixmap, 0, NULL);
00409     GC gc_mask = XCreateGC(display, mask_pixmap, 0, NULL);
00410     
00411     x_image = XCreateImage( display, m_visual->visual, 24, ZPixmap, 0, NULL, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 32, 0 );
00412     mask_image = XCreateImage( display, m_visual->visual, 1, ZPixmap, 0, NULL,  BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT, 8, 0);
00413     
00414     x_image->data = (char *)malloc(x_image->bytes_per_line * BLENDER_ICON_HEIGHT);
00415     mask_image->data = (char *)malloc( mask_image->bytes_per_line * BLENDER_ICON_HEIGHT);
00416     
00417     /* copy the BLENDER_ICON_48x48x24 into the XImage */
00418     unsigned char *col = BLENDER_ICON_48x48x24;
00419     int px, py;
00420     for (px=0; px<BLENDER_ICON_WIDTH; px++) {
00421         for (py=0; py<BLENDER_ICON_HEIGHT; py++, col+=3) {
00422             /* mask out pink */
00423             if (col[0]==255 && col[1] == 0 && col[2]== 255) {
00424                 XPutPixel(mask_image, px, py, 0 );
00425             } else {
00426                 XPutPixel(x_image, px, py, (col[0]<<16)+(col[1]<<8)+col[2] );
00427                 XPutPixel(mask_image, px, py, 1 );
00428             }
00429         }
00430     }
00431     
00432     XPutImage(display, icon_pixmap, gc_icon, x_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
00433     XPutImage(display, mask_pixmap, gc_mask, mask_image, 0, 0, 0, 0, BLENDER_ICON_WIDTH, BLENDER_ICON_HEIGHT);
00434     
00435     // Now the pixmap is ok to assign to the window as a hint
00436     xwmhints->icon_pixmap = icon_pixmap;
00437     xwmhints->icon_mask = mask_pixmap;
00438     XFreeGC (display, gc_icon);
00439     XFreeGC (display, gc_mask);
00440     XDestroyImage( x_image ); /* frees x_image->data too */
00441     XDestroyImage( mask_image );
00442     
00443     xwmhints->initial_state = NormalState;
00444     xwmhints->input= True;
00445     xwmhints->flags= InputHint|IconPixmapHint|IconMaskHint|StateHint;
00446     XSetWMHints(display, m_window, xwmhints );
00447     XFree(xwmhints);
00448     // done setting the icon
00449 
00450     setTitle(title);
00451 
00452 #ifdef WITH_X11_XINPUT
00453     initXInputDevices();
00454 #endif
00455 
00456     // now set up the rendering context.
00457     if (installDrawingContext(type) == GHOST_kSuccess) {
00458         m_valid_setup = true;
00459         GHOST_PRINT("Created window\n");
00460     }
00461 
00462     XMapWindow(m_display, m_window);
00463     GHOST_PRINT("Mapped window\n");
00464 
00465     XFlush(m_display);
00466 }
00467 
00468 #ifdef WITH_X11_XINPUT
00469 /* 
00470     Dummy function to get around IO Handler exiting if device invalid
00471     Basically it will not crash blender now if you have a X device that 
00472     is configured but not plugged in.
00473 
00474 */
00475 static int ApplicationErrorHandler(Display *display, XErrorEvent *theEvent)
00476 {
00477     fprintf(stderr, "Ignoring Xlib error: error code %d request code %d\n",
00478         theEvent->error_code, theEvent->request_code) ;
00479 
00480     /* No exit! - but keep lint happy */
00481     return 0 ;
00482 }
00483 
00484 /* These C functions are copied from Wine 1.1.13's wintab.c */
00485 #define BOOL int
00486 #define TRUE 1
00487 #define FALSE 0
00488 
00489 static bool match_token(const char *haystack, const char *needle)
00490 {
00491     const char *p, *q;
00492     for (p = haystack; *p; )
00493     {
00494         while (*p && isspace(*p))
00495             p++;
00496         if (! *p)
00497             break;
00498 
00499         for (q = needle; *q && *p && tolower(*p) == tolower(*q); q++)
00500             p++;
00501         if (! *q && (isspace(*p) || !*p))
00502             return TRUE;
00503 
00504         while (*p && ! isspace(*p))
00505             p++;
00506     }
00507     return FALSE;
00508 }
00509 
00510 
00511 /*  Determining if an X device is a Tablet style device is an imperfect science.
00512 **  We rely on common conventions around device names as well as the type reported
00513 **  by Wacom tablets.  This code will likely need to be expanded for alternate tablet types
00514 **
00515 **  Wintab refers to any device that interacts with the tablet as a cursor,
00516 **  (stylus, eraser, tablet mouse, airbrush, etc)
00517 **  this is not to be confused with wacom x11 configuration "cursor" device.
00518 **  Wacoms x11 config "cursor" refers to its device slot (which we mirror with
00519 **  our gSysCursors) for puck like devices (tablet mice essentially).
00520 */
00521 #if 0 // unused
00522 static BOOL is_tablet_cursor(const char *name, const char *type)
00523 {
00524     int i;
00525     static const char *tablet_cursor_whitelist[] = {
00526         "wacom",
00527         "wizardpen",
00528         "acecad",
00529         "tablet",
00530         "cursor",
00531         "stylus",
00532         "eraser",
00533         "pad",
00534         NULL
00535     };
00536 
00537     for (i=0; tablet_cursor_whitelist[i] != NULL; i++) {
00538         if (name && match_token(name, tablet_cursor_whitelist[i]))
00539             return TRUE;
00540         if (type && match_token(type, tablet_cursor_whitelist[i]))
00541             return TRUE;
00542     }
00543     return FALSE;
00544 }
00545 #endif
00546 static BOOL is_stylus(const char *name, const char *type)
00547 {
00548     int i;
00549     static const char* tablet_stylus_whitelist[] = {
00550         "stylus",
00551         "wizardpen",
00552         "acecad",
00553         NULL
00554     };
00555 
00556     for (i=0; tablet_stylus_whitelist[i] != NULL; i++) {
00557         if (name && match_token(name, tablet_stylus_whitelist[i]))
00558             return TRUE;
00559         if (type && match_token(type, tablet_stylus_whitelist[i]))
00560             return TRUE;
00561     }
00562 
00563     return FALSE;
00564 }
00565 
00566 static BOOL is_eraser(const char *name, const char *type)
00567 {
00568     if (name && match_token(name, "eraser"))
00569         return TRUE;
00570     if (type && match_token(type, "eraser"))
00571         return TRUE;
00572     return FALSE;
00573 }
00574 #undef BOOL
00575 #undef TRUE
00576 #undef FALSE
00577 /* end code copied from wine */
00578 
00579 void GHOST_WindowX11::initXInputDevices()
00580 {
00581     static XErrorHandler old_handler = (XErrorHandler) 0 ;
00582     XExtensionVersion *version = XGetExtensionVersion(m_display, INAME);
00583 
00584     if(version && (version != (XExtensionVersion*)NoSuchExtension)) {
00585         if(version->present) {
00586             int device_count;
00587             XDeviceInfo* device_info = XListInputDevices(m_display, &device_count);
00588             m_xtablet.StylusDevice = NULL;
00589             m_xtablet.EraserDevice = NULL;
00590             m_xtablet.CommonData.Active= GHOST_kTabletModeNone;
00591 
00592             /* Install our error handler to override Xlib's termination behavior */
00593             old_handler = XSetErrorHandler(ApplicationErrorHandler) ;
00594 
00595             for(int i=0; i<device_count; ++i) {
00596                 char *device_type = device_info[i].type ? XGetAtomName(m_display, device_info[i].type) : NULL;
00597                 
00598 //              printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
00599 
00600 
00601                 if(m_xtablet.StylusDevice==NULL && is_stylus(device_info[i].name, device_type)) {
00602 //                  printf("\tfound stylus\n");
00603                     m_xtablet.StylusID= device_info[i].id;
00604                     m_xtablet.StylusDevice = XOpenDevice(m_display, m_xtablet.StylusID);
00605 
00606                     if (m_xtablet.StylusDevice != NULL) {
00607                         /* Find how many pressure levels tablet has */
00608                         XAnyClassPtr ici = device_info[i].inputclassinfo;
00609                         for(int j=0; j<m_xtablet.StylusDevice->num_classes; ++j) {
00610                             if(ici->c_class==ValuatorClass) {
00611 //                              printf("\t\tfound ValuatorClass\n");
00612                                 XValuatorInfo* xvi = (XValuatorInfo*)ici;
00613                                 m_xtablet.PressureLevels = xvi->axes[2].max_value;
00614                             
00615                                 /* this is assuming that the tablet has the same tilt resolution in both
00616                                  * positive and negative directions. It would be rather weird if it didn't.. */
00617                                 m_xtablet.XtiltLevels = xvi->axes[3].max_value;
00618                                 m_xtablet.YtiltLevels = xvi->axes[4].max_value;
00619                                 break;
00620                             }
00621                         
00622                             ici = (XAnyClassPtr)(((char *)ici) + ici->length);
00623                         }
00624                     } else {
00625                         m_xtablet.StylusID= 0;
00626                     }
00627                 }
00628                 else if(m_xtablet.EraserDevice==NULL && is_eraser(device_info[i].name, device_type)) {
00629 //                  printf("\tfound eraser\n");
00630                     m_xtablet.EraserID= device_info[i].id;
00631                     m_xtablet.EraserDevice = XOpenDevice(m_display, m_xtablet.EraserID);
00632                     if (m_xtablet.EraserDevice == NULL) m_xtablet.EraserID= 0;
00633                 }
00634 
00635                 if(device_type) {
00636                     XFree((void*)device_type);
00637                 }
00638             }
00639 
00640             /* Restore handler */
00641             (void) XSetErrorHandler(old_handler) ;
00642 
00643             XFreeDeviceList(device_info);
00644 
00645 
00646             XEventClass xevents[10], ev;
00647             int dcount = 0;
00648 
00649             if(m_xtablet.StylusDevice) {
00650                 DeviceMotionNotify(m_xtablet.StylusDevice, m_xtablet.MotionEvent, ev);
00651                 if(ev) xevents[dcount++] = ev;
00652                 ProximityIn(m_xtablet.StylusDevice, m_xtablet.ProxInEvent, ev);
00653                 if(ev) xevents[dcount++] = ev;
00654                 ProximityOut(m_xtablet.StylusDevice, m_xtablet.ProxOutEvent, ev);
00655                 if(ev) xevents[dcount++] = ev;
00656             }
00657             if(m_xtablet.EraserDevice) {
00658                 DeviceMotionNotify(m_xtablet.EraserDevice, m_xtablet.MotionEvent, ev);
00659                 if(ev) xevents[dcount++] = ev;
00660                 ProximityIn(m_xtablet.EraserDevice, m_xtablet.ProxInEvent, ev);
00661                 if(ev) xevents[dcount++] = ev;
00662                 ProximityOut(m_xtablet.EraserDevice, m_xtablet.ProxOutEvent, ev);
00663                 if(ev) xevents[dcount++] = ev;
00664             }
00665 
00666             XSelectExtensionEvent(m_display, m_window, xevents, dcount);
00667         }
00668         XFree(version);
00669     }
00670 }
00671 
00672 #endif /* WITH_X11_XINPUT */
00673 
00674     Window 
00675 GHOST_WindowX11::
00676 getXWindow(
00677 ){
00678     return m_window;
00679 }
00680 
00681     bool 
00682 GHOST_WindowX11::
00683 getValid(
00684 ) const {
00685     return m_valid_setup;
00686 }
00687 
00688     void 
00689 GHOST_WindowX11::
00690 setTitle(
00691     const STR_String& title
00692 ){
00693     Atom name = XInternAtom(m_display, "_NET_WM_NAME", 0);
00694     Atom utf8str = XInternAtom(m_display, "UTF8_STRING", 0);
00695     XChangeProperty(m_display, m_window,
00696                     name, utf8str, 8, PropModeReplace,
00697                     (const unsigned char*) title.ReadPtr(),
00698                     title.Length());
00699 
00700 // This should convert to valid x11 string
00701 //  and getTitle would need matching change
00702     XStoreName(m_display,m_window,title);
00703 
00704     XFlush(m_display);
00705 }
00706 
00707     void 
00708 GHOST_WindowX11::
00709 getTitle(
00710     STR_String& title
00711 ) const {
00712     char *name = NULL;
00713     
00714     XFetchName(m_display,m_window,&name);
00715     title= name?name:"untitled";
00716     XFree(name);
00717 }
00718     
00719     void 
00720 GHOST_WindowX11::
00721 getWindowBounds(
00722     GHOST_Rect& bounds
00723 ) const {
00724         // Getting the window bounds under X11 is not
00725         // really supported (nor should it be desired).
00726     getClientBounds(bounds);
00727 }
00728 
00729     void 
00730 GHOST_WindowX11::
00731 getClientBounds(
00732     GHOST_Rect& bounds
00733 ) const {
00734     Window root_return;
00735     int x_return,y_return;
00736     unsigned int w_return,h_return,border_w_return,depth_return;
00737     GHOST_TInt32 screen_x, screen_y;
00738     
00739     XGetGeometry(m_display,m_window,&root_return,&x_return,&y_return,
00740         &w_return,&h_return,&border_w_return,&depth_return);
00741 
00742     clientToScreen(0, 0, screen_x, screen_y);
00743     
00744     bounds.m_l = screen_x;
00745     bounds.m_r = bounds.m_l + w_return;
00746     bounds.m_t = screen_y;
00747     bounds.m_b = bounds.m_t + h_return;
00748 
00749 }
00750 
00751     GHOST_TSuccess 
00752 GHOST_WindowX11::
00753 setClientWidth(
00754     GHOST_TUns32 width
00755 ){  
00756     XWindowChanges values;
00757     unsigned int value_mask= CWWidth;       
00758     values.width = width;
00759     XConfigureWindow(m_display,m_window,value_mask,&values);
00760 
00761     return GHOST_kSuccess;
00762 }
00763 
00764     GHOST_TSuccess 
00765 GHOST_WindowX11::
00766 setClientHeight(
00767     GHOST_TUns32 height
00768 ){
00769     XWindowChanges values;
00770     unsigned int value_mask= CWHeight;      
00771     values.height = height;
00772     XConfigureWindow(m_display,m_window,value_mask,&values);
00773     return GHOST_kSuccess;
00774 
00775 }
00776 
00777     GHOST_TSuccess 
00778 GHOST_WindowX11::
00779 setClientSize(
00780     GHOST_TUns32 width,
00781     GHOST_TUns32 height
00782 ){
00783     XWindowChanges values;
00784     unsigned int value_mask= CWWidth | CWHeight;        
00785     values.width = width;
00786     values.height = height;
00787     XConfigureWindow(m_display,m_window,value_mask,&values);
00788     return GHOST_kSuccess;
00789 
00790 }   
00791 
00792     void 
00793 GHOST_WindowX11::
00794 screenToClient(
00795     GHOST_TInt32 inX,
00796     GHOST_TInt32 inY,
00797     GHOST_TInt32& outX,
00798     GHOST_TInt32& outY
00799 ) const {
00800     // This is correct!
00801 
00802     int ax,ay;
00803     Window temp;
00804 
00805     XTranslateCoordinates(
00806             m_display,
00807             RootWindow(m_display, m_visual->screen),
00808             m_window,
00809             inX,
00810             inY,
00811             &ax,
00812             &ay,
00813             &temp
00814         );
00815     outX = ax;
00816     outY = ay;
00817 }
00818          
00819     void 
00820 GHOST_WindowX11::
00821 clientToScreen(
00822     GHOST_TInt32 inX,
00823     GHOST_TInt32 inY,
00824     GHOST_TInt32& outX,
00825     GHOST_TInt32& outY
00826 ) const {
00827     int ax,ay;
00828     Window temp;
00829 
00830     XTranslateCoordinates(
00831             m_display,
00832             m_window,
00833             RootWindow(m_display, m_visual->screen),
00834             inX,
00835             inY,
00836             &ax,
00837             &ay,
00838             &temp
00839         );
00840     outX = ax;
00841     outY = ay;
00842 }
00843 
00844 void GHOST_WindowX11::icccmSetState(int state)
00845 {
00846     XEvent xev;
00847 
00848     if (state != IconicState)
00849         return;
00850 
00851     xev.xclient.type = ClientMessage;
00852     xev.xclient.serial = 0;
00853     xev.xclient.send_event = True;
00854     xev.xclient.display = m_display;
00855     xev.xclient.window = m_window;
00856     xev.xclient.format = 32;
00857     xev.xclient.message_type = m_system->m_wm_change_state;
00858     xev.xclient.data.l[0] = state;
00859     XSendEvent (m_display, RootWindow(m_display, DefaultScreen(m_display)),
00860         False, SubstructureNotifyMask | SubstructureRedirectMask, &xev);
00861 }
00862 
00863 int GHOST_WindowX11::icccmGetState(void) const
00864 {
00865     unsigned char *prop_ret;
00866     unsigned long bytes_after, num_ret;
00867     Atom type_ret;
00868     int format_ret, st;
00869 
00870     prop_ret = NULL;
00871     st = XGetWindowProperty(m_display, m_window, m_system->m_wm_state, 0,
00872             0x7fffffff, False, m_system->m_wm_state, &type_ret,
00873             &format_ret, &num_ret, &bytes_after, &prop_ret);
00874 
00875     if ((st == Success) && (prop_ret) && (num_ret == 2))
00876         st = prop_ret[0];
00877     else
00878         st = NormalState;
00879 
00880     if (prop_ret)
00881         XFree(prop_ret);
00882     return (st);
00883 }
00884 
00885 void GHOST_WindowX11::netwmMaximized(bool set)
00886 {
00887     XEvent xev;
00888 
00889     xev.xclient.type = ClientMessage;
00890     xev.xclient.serial = 0;
00891     xev.xclient.send_event = True;
00892     xev.xclient.window = m_window;
00893     xev.xclient.message_type = m_system->m_net_state;
00894     xev.xclient.format = 32;
00895 
00896     if (set == True)
00897         xev.xclient.data.l[0] = _NET_WM_STATE_ADD;
00898     else
00899         xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
00900 
00901     xev.xclient.data.l[1] = m_system->m_net_max_horz;
00902     xev.xclient.data.l[2] = m_system->m_net_max_vert;
00903     xev.xclient.data.l[3] = 0;
00904     xev.xclient.data.l[4] = 0;
00905     XSendEvent(m_display, RootWindow(m_display, DefaultScreen(m_display)),
00906         False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
00907 }
00908 
00909 bool GHOST_WindowX11::netwmIsMaximized(void) const
00910 {
00911     unsigned char *prop_ret;
00912     unsigned long bytes_after, num_ret, i;
00913     Atom type_ret;
00914     bool st;
00915     int format_ret, ret, count;
00916 
00917     prop_ret = NULL;
00918     st = False;
00919     ret = XGetWindowProperty(m_display, m_window, m_system->m_net_state, 0,
00920             0x7fffffff, False, XA_ATOM, &type_ret, &format_ret,
00921             &num_ret, &bytes_after, &prop_ret);
00922     if ((ret == Success) && (prop_ret) && (format_ret == 32)) {
00923         count = 0;
00924         for (i = 0; i < num_ret; i++) {
00925             if (((unsigned long *) prop_ret)[i] == m_system->m_net_max_horz)
00926                 count++;
00927             if (((unsigned long *) prop_ret)[i] == m_system->m_net_max_vert)
00928                 count++;
00929             if (count == 2) {
00930                 st = True;
00931                 break;
00932             }
00933         }
00934     }
00935 
00936     if (prop_ret)
00937         XFree(prop_ret);
00938     return (st);
00939 }
00940 
00941 void GHOST_WindowX11::netwmFullScreen(bool set)
00942 {
00943     XEvent xev;
00944 
00945     xev.xclient.type = ClientMessage;
00946     xev.xclient.serial = 0;
00947     xev.xclient.send_event = True;
00948     xev.xclient.window = m_window;
00949     xev.xclient.message_type = m_system->m_net_state;
00950     xev.xclient.format = 32;
00951 
00952     if (set == True)
00953         xev.xclient.data.l[0] = _NET_WM_STATE_ADD;
00954     else
00955         xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE;
00956 
00957     xev.xclient.data.l[1] = m_system->m_net_fullscreen;
00958     xev.xclient.data.l[2] = 0;
00959     xev.xclient.data.l[3] = 0;
00960     xev.xclient.data.l[4] = 0;
00961     XSendEvent(m_display, RootWindow(m_display, DefaultScreen(m_display)),
00962         False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
00963 }
00964 
00965 bool GHOST_WindowX11::netwmIsFullScreen(void) const
00966 {
00967     unsigned char *prop_ret;
00968     unsigned long bytes_after, num_ret, i;
00969     Atom type_ret;
00970     bool st;
00971     int format_ret, ret;
00972 
00973     prop_ret = NULL;
00974     st = False;
00975     ret = XGetWindowProperty(m_display, m_window, m_system->m_net_state, 0,
00976             0x7fffffff, False, XA_ATOM, &type_ret, &format_ret,
00977             &num_ret, &bytes_after, &prop_ret);
00978     if ((ret == Success) && (prop_ret) && (format_ret == 32)) {
00979         for (i = 0; i < num_ret; i++) {
00980             if (((unsigned long *) prop_ret)[i] == m_system->m_net_fullscreen) {
00981                 st = True;
00982                 break;
00983             }
00984         }
00985     }
00986 
00987     if (prop_ret)
00988         XFree(prop_ret);
00989     return (st);
00990 }
00991 
00992 void GHOST_WindowX11::motifFullScreen(bool set)
00993 {
00994     MotifWmHints hints;
00995 
00996     hints.flags = MWM_HINTS_DECORATIONS;
00997     if (set == True)
00998         hints.decorations = 0;
00999     else
01000         hints.decorations = 1;
01001 
01002     XChangeProperty(m_display, m_window, m_system->m_motif,
01003             m_system->m_motif, 32, PropModeReplace,
01004             (unsigned char *) &hints, 4);
01005 }
01006 
01007 bool GHOST_WindowX11::motifIsFullScreen(void) const
01008 {
01009     unsigned char *prop_ret;
01010     unsigned long bytes_after, num_ret;
01011     MotifWmHints *hints;
01012     Atom type_ret;
01013     bool state;
01014     int format_ret, st;
01015 
01016     prop_ret = NULL;
01017     state = False;
01018     st = XGetWindowProperty(m_display, m_window, m_system->m_motif, 0,
01019                 0x7fffffff, False, m_system->m_motif,
01020                 &type_ret, &format_ret, &num_ret,
01021                 &bytes_after, &prop_ret);
01022     if ((st == Success) && (prop_ret)) {
01023         hints = (MotifWmHints *) prop_ret;
01024         if (hints->flags & MWM_HINTS_DECORATIONS) {
01025             if (!hints->decorations)
01026                 state = True;
01027         }
01028     }
01029 
01030     if (prop_ret)
01031         XFree(prop_ret);
01032     return (state);
01033 }
01034 
01035 GHOST_TWindowState GHOST_WindowX11::getState() const
01036 {
01037     GHOST_TWindowState state_ret;
01038     int state;
01039 
01040     state_ret = GHOST_kWindowStateNormal;
01041     state = icccmGetState();
01042     /*
01043      * In the Iconic and Withdrawn state, the window
01044      * is unmaped, so only need return a Minimized state.
01045      */
01046     if ((state == IconicState) || (state == WithdrawnState))
01047         state_ret = GHOST_kWindowStateMinimized;
01048     else if (netwmIsMaximized() == True)
01049         state_ret = GHOST_kWindowStateMaximized;
01050     else if (netwmIsFullScreen() == True)
01051         state_ret = GHOST_kWindowStateFullScreen;
01052     else if (motifIsFullScreen() == True)
01053         state_ret = GHOST_kWindowStateFullScreen;
01054     return (state_ret);
01055 }
01056 
01057 GHOST_TSuccess GHOST_WindowX11::setState(GHOST_TWindowState state)
01058 {
01059     GHOST_TWindowState cur_state;
01060     bool is_max, is_full, is_motif_full;
01061 
01062     cur_state = getState();
01063         if (state == (int)cur_state)
01064         return GHOST_kSuccess;
01065 
01066     if (cur_state != GHOST_kWindowStateMinimized) {
01067         /*
01068          * The window don't have this property's
01069          * if it's not mapped.
01070          */
01071         is_max = netwmIsMaximized();
01072         is_full = netwmIsFullScreen();
01073     }
01074     else {
01075         is_max = False;
01076         is_full = False;
01077     }
01078 
01079     is_motif_full = motifIsFullScreen();
01080 
01081     if (state == GHOST_kWindowStateNormal)
01082         state = m_normal_state;
01083 
01084     if (state == GHOST_kWindowStateNormal) {
01085         if (is_max == True)
01086             netwmMaximized(False);
01087         if (is_full == True)
01088             netwmFullScreen(False);
01089         if (is_motif_full == True)
01090             motifFullScreen(False);
01091         icccmSetState(NormalState);
01092         return (GHOST_kSuccess);
01093     }
01094 
01095     if (state == GHOST_kWindowStateFullScreen) {
01096         /*
01097          * We can't change to full screen if the window
01098          * isn't mapped.
01099          */
01100         if (cur_state == GHOST_kWindowStateMinimized)
01101             return (GHOST_kFailure);
01102 
01103         m_normal_state = cur_state;
01104 
01105         if (is_max == True)
01106             netwmMaximized(False);
01107         if (is_full == False)
01108             netwmFullScreen(True);
01109         if (is_motif_full == False)
01110             motifFullScreen(True);
01111         return (GHOST_kSuccess);
01112     }
01113 
01114     if (state == GHOST_kWindowStateMaximized) {
01115         /*
01116          * We can't change to Maximized if the window
01117          * isn't mapped.
01118          */
01119         if (cur_state == GHOST_kWindowStateMinimized)
01120             return (GHOST_kFailure);
01121 
01122         if (is_full == True)
01123             netwmFullScreen(False);
01124         if (is_motif_full == True)
01125             motifFullScreen(False);
01126         if (is_max == False)
01127             netwmMaximized(True);
01128         return (GHOST_kSuccess);
01129     }
01130 
01131     if (state == GHOST_kWindowStateMinimized) {
01132         /*
01133          * The window manager need save the current state of
01134          * the window (maximized, full screen, etc).
01135          */
01136         icccmSetState(IconicState);
01137         return (GHOST_kSuccess);
01138     }
01139 
01140     return (GHOST_kFailure);
01141 }
01142 
01143 #include <iostream>
01144 using namespace std;
01145 
01146     GHOST_TSuccess 
01147 GHOST_WindowX11::
01148 setOrder(
01149     GHOST_TWindowOrder order
01150 ){
01151     if (order == GHOST_kWindowOrderTop) {
01152         XWindowAttributes attr;   
01153         Atom atom;
01154 
01155         /* We use both XRaiseWindow and _NET_ACTIVE_WINDOW, since some
01156            window managers ignore the former (e.g. kwin from kde) and others
01157            don't implement the latter (e.g. fluxbox pre 0.9.9) */
01158 
01159         XRaiseWindow(m_display, m_window);
01160 
01161         atom = XInternAtom(m_display, "_NET_ACTIVE_WINDOW", True);
01162 
01163         if (atom != None) {
01164             Window root;
01165             XEvent xev;
01166             long eventmask;
01167 
01168             xev.xclient.type = ClientMessage;
01169             xev.xclient.serial = 0;
01170             xev.xclient.send_event = True;
01171             xev.xclient.window = m_window;
01172             xev.xclient.message_type = atom;
01173 
01174             xev.xclient.format = 32;
01175             xev.xclient.data.l[0] = 1;
01176             xev.xclient.data.l[1] = CurrentTime;
01177             xev.xclient.data.l[2] = m_window;
01178             xev.xclient.data.l[3] = 0;
01179             xev.xclient.data.l[4] = 0;
01180 
01181             root = RootWindow(m_display, m_visual->screen),
01182             eventmask = SubstructureRedirectMask | SubstructureNotifyMask;
01183 
01184             XSendEvent(m_display, root, False, eventmask, &xev);
01185         }
01186 
01187         XGetWindowAttributes(m_display, m_window, &attr);
01188 
01189         /* iconized windows give bad match error */
01190         if (attr.map_state == IsViewable)
01191             XSetInputFocus(m_display, m_window, RevertToPointerRoot,
01192                          CurrentTime);
01193         XFlush(m_display);
01194     } else if (order == GHOST_kWindowOrderBottom) {
01195         XLowerWindow(m_display,m_window);
01196         XFlush(m_display);
01197     } else {
01198         return GHOST_kFailure;
01199     }
01200     
01201     return GHOST_kSuccess;
01202 }
01203 
01204     GHOST_TSuccess 
01205 GHOST_WindowX11::
01206 swapBuffers(
01207 ){
01208     if (getDrawingContextType() == GHOST_kDrawingContextTypeOpenGL) {
01209         glXSwapBuffers(m_display,m_window);
01210         return GHOST_kSuccess;
01211     } else {
01212         return GHOST_kFailure;
01213     }
01214 }
01215 
01216     GHOST_TSuccess 
01217 GHOST_WindowX11::
01218 activateDrawingContext(
01219 ){
01220     if (m_context !=NULL) {
01221         glXMakeCurrent(m_display, m_window,m_context);                      
01222         return GHOST_kSuccess;
01223     } 
01224     return GHOST_kFailure;
01225 }
01226 
01227     GHOST_TSuccess
01228 GHOST_WindowX11::
01229 invalidate(
01230 ){
01231 
01232     // So the idea of this function is to generate an expose event
01233     // for the window.
01234     // Unfortunately X does not handle expose events for you and 
01235     // it is the client's job to refresh the dirty part of the window.
01236     // We need to queue up invalidate calls and generate GHOST events 
01237     // for them in the system.
01238 
01239     // We implement this by setting a boolean in this class to concatenate 
01240     // all such calls into a single event for this window.
01241 
01242     // At the same time we queue the dirty windows in the system class
01243     // and generate events for them at the next processEvents call.
01244 
01245     if (m_invalid_window == false) {
01246         m_system->addDirtyWindow(this);
01247         m_invalid_window = true;
01248     } 
01249  
01250     return GHOST_kSuccess;
01251 }
01252 
01258     void
01259 GHOST_WindowX11::
01260 validate(
01261 ){
01262     m_invalid_window = false;
01263 }   
01264  
01265  
01271 GHOST_WindowX11::
01272 ~GHOST_WindowX11(
01273 ){
01274     static Atom Primary_atom, Clipboard_atom;
01275     Window p_owner, c_owner;
01276     /*Change the owner of the Atoms to None if we are the owner*/
01277     Primary_atom = XInternAtom(m_display, "PRIMARY", False);
01278     Clipboard_atom = XInternAtom(m_display, "CLIPBOARD", False);
01279     
01280     p_owner = XGetSelectionOwner(m_display, Primary_atom);
01281     c_owner = XGetSelectionOwner(m_display, Clipboard_atom);
01282     
01283     std::map<unsigned int, Cursor>::iterator it = m_standard_cursors.begin();
01284     for (; it != m_standard_cursors.end(); it++) {
01285         XFreeCursor(m_display, it->second);
01286     }
01287 
01288     if (m_empty_cursor) {
01289         XFreeCursor(m_display, m_empty_cursor);
01290     }
01291     if (m_custom_cursor) {
01292         XFreeCursor(m_display, m_custom_cursor);
01293     }
01294 
01295 #ifdef WITH_X11_XINPUT
01296     /* close tablet devices */
01297     if(m_xtablet.StylusDevice)
01298         XCloseDevice(m_display, m_xtablet.StylusDevice);
01299     
01300     if(m_xtablet.EraserDevice)
01301         XCloseDevice(m_display, m_xtablet.EraserDevice);
01302 #endif /* WITH_X11_XINPUT */
01303 
01304     if (m_context != s_firstContext) {
01305         glXDestroyContext(m_display, m_context);
01306     }
01307     
01308     if (p_owner == m_window) {
01309         XSetSelectionOwner(m_display, Primary_atom, None, CurrentTime);
01310     }
01311     if (c_owner == m_window) {
01312         XSetSelectionOwner(m_display, Clipboard_atom, None, CurrentTime);
01313     }
01314     
01315 #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING)
01316     if (m_xic) {
01317         XDestroyIC(m_xic);
01318     }
01319 #endif
01320 
01321 
01322     XDestroyWindow(m_display, m_window);
01323     XFree(m_visual);
01324 }
01325 
01326 
01327 
01328 
01334     GHOST_TSuccess 
01335 GHOST_WindowX11::
01336 installDrawingContext(
01337     GHOST_TDrawingContextType type
01338 ){
01339     // only support openGL for now.
01340     GHOST_TSuccess success;
01341     switch (type) {
01342     case GHOST_kDrawingContextTypeOpenGL:
01343         m_context = glXCreateContext(m_display, m_visual, s_firstContext, True);
01344         if (m_context !=NULL) {
01345             if (!s_firstContext) {
01346                 s_firstContext = m_context;
01347             }
01348             glXMakeCurrent(m_display, m_window,m_context);
01349             glClearColor(0.447, 0.447, 0.447, 0);
01350             glClear(GL_COLOR_BUFFER_BIT);
01351             success = GHOST_kSuccess;
01352         } else {
01353             success = GHOST_kFailure;
01354         }
01355 
01356         break;
01357 
01358     case GHOST_kDrawingContextTypeNone:
01359         success = GHOST_kSuccess;
01360         break;
01361 
01362     default:
01363         success = GHOST_kFailure;
01364     }
01365     return success;
01366 }
01367 
01368 
01369 
01374     GHOST_TSuccess 
01375 GHOST_WindowX11::
01376 removeDrawingContext(
01377 ){
01378     GHOST_TSuccess success;
01379 
01380     if (m_context != NULL) {
01381         glXDestroyContext(m_display, m_context);
01382         success = GHOST_kSuccess;
01383     } else {
01384         success = GHOST_kFailure;
01385     }
01386     return success; 
01387 }
01388 
01389 
01390     Cursor
01391 GHOST_WindowX11::
01392 getStandardCursor(
01393     GHOST_TStandardCursor g_cursor
01394 ){
01395     unsigned int xcursor_id;
01396 
01397 #define GtoX(gcurs, xcurs)  case gcurs: xcursor_id = xcurs
01398     switch (g_cursor) {
01399     GtoX(GHOST_kStandardCursorRightArrow, XC_arrow); break;
01400     GtoX(GHOST_kStandardCursorLeftArrow, XC_top_left_arrow); break;
01401     GtoX(GHOST_kStandardCursorInfo, XC_hand1); break;
01402     GtoX(GHOST_kStandardCursorDestroy, XC_pirate); break;
01403     GtoX(GHOST_kStandardCursorHelp, XC_question_arrow); break; 
01404     GtoX(GHOST_kStandardCursorCycle, XC_exchange); break;
01405     GtoX(GHOST_kStandardCursorSpray, XC_spraycan); break;
01406     GtoX(GHOST_kStandardCursorWait, XC_watch); break;
01407     GtoX(GHOST_kStandardCursorText, XC_xterm); break;
01408     GtoX(GHOST_kStandardCursorCrosshair, XC_crosshair); break;
01409     GtoX(GHOST_kStandardCursorUpDown, XC_sb_v_double_arrow); break;
01410     GtoX(GHOST_kStandardCursorLeftRight, XC_sb_h_double_arrow); break;
01411     GtoX(GHOST_kStandardCursorTopSide, XC_top_side); break;
01412     GtoX(GHOST_kStandardCursorBottomSide, XC_bottom_side); break;
01413     GtoX(GHOST_kStandardCursorLeftSide, XC_left_side); break;
01414     GtoX(GHOST_kStandardCursorRightSide, XC_right_side); break;
01415     GtoX(GHOST_kStandardCursorTopLeftCorner, XC_top_left_corner); break;
01416     GtoX(GHOST_kStandardCursorTopRightCorner, XC_top_right_corner); break;
01417     GtoX(GHOST_kStandardCursorBottomRightCorner, XC_bottom_right_corner); break;
01418     GtoX(GHOST_kStandardCursorBottomLeftCorner, XC_bottom_left_corner); break;
01419     GtoX(GHOST_kStandardCursorPencil, XC_pencil); break;
01420     GtoX(GHOST_kStandardCursorCopy, XC_arrow); break;
01421     default:
01422         xcursor_id = 0;
01423     }
01424 #undef GtoX
01425 
01426     if (xcursor_id) {
01427         Cursor xcursor = m_standard_cursors[xcursor_id];
01428         
01429         if (!xcursor) {
01430             xcursor = XCreateFontCursor(m_display, xcursor_id);
01431 
01432             m_standard_cursors[xcursor_id] = xcursor;
01433         }
01434         
01435         return xcursor;
01436     } else {
01437         return None;
01438     }
01439 }
01440 
01441     Cursor 
01442 GHOST_WindowX11::
01443 getEmptyCursor(
01444 ) {
01445     if (!m_empty_cursor) {
01446         Pixmap blank;
01447         XColor dummy;
01448         char data[1] = {0};
01449             
01450         /* make a blank cursor */
01451         blank = XCreateBitmapFromData (
01452             m_display, 
01453             RootWindow(m_display,DefaultScreen(m_display)),
01454             data, 1, 1
01455         );
01456 
01457         m_empty_cursor = XCreatePixmapCursor(m_display, blank, blank, &dummy, &dummy, 0, 0);
01458         XFreePixmap(m_display, blank);
01459     }
01460 
01461     return m_empty_cursor;
01462 }
01463 
01464     GHOST_TSuccess
01465 GHOST_WindowX11::
01466 setWindowCursorVisibility(
01467     bool visible
01468 ){
01469     Cursor xcursor;
01470     
01471     if (visible) {
01472         xcursor = getStandardCursor( getCursorShape() );
01473     } else {
01474         xcursor = getEmptyCursor();
01475     }
01476 
01477     XDefineCursor(m_display, m_window, xcursor);
01478     XFlush(m_display);
01479     
01480     return GHOST_kSuccess;
01481 }
01482 
01483     GHOST_TSuccess
01484 GHOST_WindowX11::
01485 setWindowCursorGrab(
01486     GHOST_TGrabCursorMode mode
01487 ){
01488     if(mode != GHOST_kGrabDisable) {
01489         if(mode != GHOST_kGrabNormal) {
01490             m_system->getCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
01491             setCursorGrabAccum(0, 0);
01492 
01493             if(mode == GHOST_kGrabHide)
01494                 setWindowCursorVisibility(false);
01495 
01496         }
01497 #ifdef GHOST_X11_GRAB
01498         XGrabPointer(m_display, m_window, False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
01499                      GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
01500 #endif
01501     }
01502     else {
01503         if (m_cursorGrab==GHOST_kGrabHide) {
01504             m_system->setCursorPosition(m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
01505             setWindowCursorVisibility(true);
01506         }
01507 
01508         if(m_cursorGrab != GHOST_kGrabNormal) {
01509             /* use to generate a mouse move event, otherwise the last event
01510              * blender gets can be outside the screen causing menus not to show
01511              * properly unless the user moves the mouse */
01512             XWarpPointer(m_display,None,None,0,0,0,0,0,0);
01513         }
01514 
01515         /* Almost works without but important otherwise the mouse GHOST location can be incorrect on exit */
01516         setCursorGrabAccum(0, 0);
01517         m_cursorGrabBounds.m_l= m_cursorGrabBounds.m_r= -1; /* disable */
01518 #ifdef GHOST_X11_GRAB
01519         XUngrabPointer(m_display, CurrentTime);
01520 #endif
01521     }
01522 
01523     XFlush(m_display);
01524     
01525     return GHOST_kSuccess;
01526 }
01527 
01528     GHOST_TSuccess
01529 GHOST_WindowX11::
01530 setWindowCursorShape(
01531     GHOST_TStandardCursor shape
01532 ){
01533     Cursor xcursor = getStandardCursor( shape );
01534     
01535     XDefineCursor(m_display, m_window, xcursor);
01536     XFlush(m_display);
01537 
01538     return GHOST_kSuccess;
01539 }
01540 
01541     GHOST_TSuccess
01542 GHOST_WindowX11::
01543 setWindowCustomCursorShape(
01544     GHOST_TUns8 bitmap[16][2], 
01545     GHOST_TUns8 mask[16][2], 
01546     int hotX, 
01547     int hotY
01548 ){
01549 
01550 setWindowCustomCursorShape((GHOST_TUns8*)bitmap, (GHOST_TUns8*)mask, 
01551                                     16, 16, hotX, hotY, 0, 1);
01552     return GHOST_kSuccess;
01553 }
01554 
01555     GHOST_TSuccess
01556 GHOST_WindowX11::
01557 setWindowCustomCursorShape( 
01558     GHOST_TUns8 *bitmap, 
01559     GHOST_TUns8 *mask, 
01560     int sizex, 
01561     int sizey, 
01562     int hotX, 
01563     int hotY, 
01564     int fg_color, 
01565     int bg_color
01566 ){
01567     Colormap colormap= DefaultColormap(m_display, DefaultScreen(m_display));
01568     Pixmap bitmap_pix, mask_pix;
01569     XColor fg, bg;
01570     
01571     if(XAllocNamedColor(m_display, colormap, "White", &fg, &fg) == 0) return GHOST_kFailure;
01572     if(XAllocNamedColor(m_display, colormap, "Black", &bg, &bg) == 0) return GHOST_kFailure;
01573 
01574     if (m_custom_cursor) {
01575         XFreeCursor(m_display, m_custom_cursor);
01576     }
01577 
01578     bitmap_pix = XCreateBitmapFromData(m_display, m_window, (char*) bitmap, sizex, sizey);
01579     mask_pix = XCreateBitmapFromData(m_display, m_window, (char*) mask, sizex, sizey);
01580         
01581     m_custom_cursor = XCreatePixmapCursor(m_display, bitmap_pix, mask_pix, &fg, &bg, hotX, hotY);
01582     XDefineCursor(m_display, m_window, m_custom_cursor);
01583     XFlush(m_display);
01584     
01585     XFreePixmap(m_display, bitmap_pix);
01586     XFreePixmap(m_display, mask_pix);
01587 
01588     XFreeColors(m_display, colormap, &fg.pixel, 1, 0L);
01589     XFreeColors(m_display, colormap, &bg.pixel, 1, 0L);
01590 
01591     return GHOST_kSuccess;
01592 }