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