1 module derelict.x11.Xlibint; 2 3 version(linux): 4 /* 5 * Xlibint.h - Header definition and support file for the internal 6 * support routines used by the C subroutine interface 7 * library (Xlib) to the X Window System. 8 * 9 * Warning, there be dragons here.... 10 */ 11 import std.stdio; 12 import core.stdc.string : memcpy; 13 import core.stdc.config; 14 import core.stdc.stdio : fopen; 15 import core.stdc.stdlib : free, malloc, calloc, realloc; 16 17 import derelict.x11.X : XID, GContext, KeySym, Font, VisualID, Window; 18 import derelict.x11.Xmd : CARD32; 19 import derelict.x11.Xlib : _XrmHashBucketRec, Bool,Screen, ScreenFormat, Status, Visual, XChar2b, XCharStruct, 20 XConnectionWatchProc, XEvent, XErrorEvent, XExtCodes, XExtData, XFontStruct, XGCValues, 21 XGenericEventCookie, XModifierKeymap, XPointer, XRectangle, XSetWindowAttributes, XWindowAttributes; 22 import derelict.x11.Xtos; 23 import derelict.x11.Xproto; /* to declare xEvent */ 24 25 extern (C) nothrow @nogc: 26 27 /* 28 * If your BytesReadable correctly detects broken connections, then 29 * you should NOT define XCONN_CHECK_FREQ. 30 */ 31 const uint XCONN_CHECK_FREQ = 256; 32 33 struct _XGC{ 34 XExtData* ext_data; /* hook for extension to hang data */ 35 GContext gid; /* protocol ID for graphics context */ 36 Bool rects; /* boolean: TRUE if clipmask is list of rectangles */ 37 Bool dashes; /* boolean: TRUE if dash-list is really a list */ 38 c_ulong dirty; /* cache dirty bits */ 39 XGCValues values; /* shadow structure of values */ 40 } 41 alias _XGC* GC; 42 43 struct _XLockInfo{} 44 struct _XDisplayAtoms{} 45 struct _XContextDB{} 46 struct _XIMFilter{} 47 struct _XkbInfoRec{} 48 struct _XtransConnInfo{} 49 struct _X11XCBPrivate{} 50 //~ struct _XLockPtrs{} -- define in version XTHREAD 51 struct _XKeytrans{} 52 53 struct _XDisplay{ 54 XExtData* ext_data; /* hook for extension to hang data */ 55 _XFreeFuncs* free_funcs; /* internal free functions */ 56 int fd; /* Network socket. */ 57 int conn_checker; /* ugly thing used by _XEventsQueued */ 58 int proto_major_version; /* maj. version of server's X protocol */ 59 int proto_minor_version; /* minor version of server's X protocol */ 60 char* c_vendor; /* vendor of the server hardware */ 61 XID resource_base; /* resource ID base */ 62 XID resource_mask; /* resource ID mask bits */ 63 XID resource_id; /* allocator current ID */ 64 int resource_shift; /* allocator shift to correct bits */ 65 extern (C) nothrow XID function( _XDisplay* )resource_alloc;/* allocator function */ 66 int byte_order; /* screen byte order, LSBFirst, MSBFirst */ 67 int bitmap_unit; /* padding and data requirements */ 68 int bitmap_pad; /* padding requirements on bitmaps */ 69 int bitmap_bit_order; /* LeastSignificant or MostSignificant */ 70 int nformats; /* number of pixmap formats in list */ 71 ScreenFormat* pixmap_format; /* pixmap format list */ 72 int vnumber; /* Xlib's X protocol version number. */ 73 int release; /* release of the server */ 74 _XSQEvent* head, tail; /* Input event queue. */ 75 int qlen; /* Length of input event queue */ 76 c_ulong last_request_read; /* seq number of last event read */ 77 c_ulong request; /* sequence number of last request. */ 78 char* last_req; /* beginning of last request, or dummy */ 79 char* buffer; /* Output buffer starting address. */ 80 char* bufptr; /* Output buffer index pointer. */ 81 char* bufmax; /* Output buffer maximum+1 address. */ 82 uint max_request_size; /* maximum number 32 bit words in request */ 83 _XrmHashBucketRec* db; 84 extern (C) nothrow int function( _XDisplay* ) synchandler;/* Synchronization handler */ 85 char* display_name; /* "host:display" string used on this connect */ 86 int default_screen; /* default screen for operations */ 87 int nscreens; /* number of screens on this server */ 88 Screen* screens; /* pointer to list of screens */ 89 c_ulong motion_buffer; /* size of motion buffer */ 90 c_ulong flags; /* internal connection flags */ 91 int min_keycode; /* minimum defined keycode */ 92 int max_keycode; /* maximum defined keycode */ 93 KeySym* keysyms; /* This server's keysyms */ 94 XModifierKeymap* modifiermap; /* This server's modifier keymap */ 95 int keysyms_per_keycode; /* number of rows */ 96 char* xdefaults; /* contents of defaults from server */ 97 char* scratch_buffer; /* place to hang scratch buffer */ 98 c_ulong scratch_length; /* length of scratch buffer */ 99 int ext_number; /* extension number on this display */ 100 _XExten* ext_procs; /* extensions initialized on this display */ 101 /* 102 * the following can be fixed size, as the protocol defines how 103 * much address space is available. 104 * While this could be done using the extension vector, there 105 * may be MANY events processed, so a search through the extension 106 * list to find the right procedure for each event might be 107 * expensive if many extensions are being used. 108 */ 109 extern (C) nothrow @nogc Bool function( /* vector for wire to event */ 110 Display* /* dpy */, 111 XEvent* /* re */, 112 xEvent* /* event */ 113 )[128] event_vec; 114 extern (C) nothrow @nogc Status function( /* vector for event to wire */ 115 Display* /* dpy */, 116 XEvent* /* re */, 117 xEvent* /* event */ 118 )[128] wire_vec; 119 KeySym lock_meaning; /* for XLookupString */ 120 _XLockInfo* lock; /* multi-thread state, display lock */ 121 _XInternalAsync* async_handlers; /* for internal async */ 122 c_ulong bigreq_size; /* max size of big requests */ 123 _XLockPtrs* lock_fns; /* pointers to threads functions */ 124 extern (C) nothrow @nogc void function( /* XID list allocator function */ 125 Display* /* dpy */, 126 XID* /* ids */, 127 int /* count */ 128 ) idlist_alloc; 129 /* things above this line should not move, for binary compatibility */ 130 _XKeytrans* key_bindings; /* for XLookupString */ 131 Font cursor_font; /* for XCreateFontCursor */ 132 _XDisplayAtoms* atoms; /* for XInternAtom */ 133 uint mode_switch; /* keyboard group modifiers */ 134 uint num_lock; /* keyboard numlock modifiers */ 135 _XContextDB* context_db; /* context database */ 136 extern (C) nothrow @nogc Bool function( /* vector for wire to error */ 137 Display* /* display */, 138 XErrorEvent* /* he */, 139 xError* /* we */ 140 ) *error_vec; 141 /* 142 * Xcms information 143 */ 144 struct cms{ 145 XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */ 146 XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */ 147 XPointer perVisualIntensityMaps; 148 /* linked list of XcmsIntensityMap */ 149 }; 150 _XIMFilter* im_filters; 151 _XSQEvent* qfree; /* unallocated event queue elements */ 152 c_ulong next_event_serial_num; /* inserted into next queue elt */ 153 _XExten* flushes; /* Flush hooks */ 154 _XConnectionInfo* im_fd_info; /* _XRegisterInternalConnection */ 155 int im_fd_length; /* number of im_fd_info */ 156 _XConnWatchInfo* conn_watchers; /* XAddConnectionWatch */ 157 int watcher_count; /* number of conn_watchers */ 158 XPointer filedes; /* struct pollfd cache for _XWaitForReadable */ 159 extern (C) nothrow @nogc int function( /* user synchandler when Xlib usurps */ 160 Display * /* dpy */ 161 ) savedsynchandler; 162 XID resource_max; /* allocator max ID */ 163 int xcmisc_opcode; /* major opcode for XC-MISC */ 164 _XkbInfoRec* xkb_info; /* XKB info */ 165 _XtransConnInfo* trans_conn; /* transport connection object */ 166 _X11XCBPrivate* xcb; /* XCB glue private data */ 167 168 /* Generic event cookie handling */ 169 uint next_cookie; /* next event cookie */ 170 /* vector for wire to generic event, index is (extension - 128) */ 171 extern (C) nothrow @nogc Bool function( 172 Display* /* dpy */, 173 XGenericEventCookie* /* Xlib event */, 174 xEvent* /* wire event */ 175 )[128] generic_event_vec; 176 /* vector for event copy, index is (extension - 128) */ 177 extern (C) nothrow @nogc Bool function( 178 Display* /* dpy */, 179 XGenericEventCookie* /* in */, 180 XGenericEventCookie* /* out */ 181 )[128] generic_event_copy_vec; 182 void* cookiejar; /* cookie events returned but not claimed */ 183 }; 184 alias _XDisplay Display; 185 186 void XAllocIDs( Display* dpy, XID* ids, int n){ dpy.idlist_alloc(dpy,ids,n); } 187 188 /* 189 * define the following if you want the Data macro to be a procedure instead. 190 */ 191 enum bool DataRoutineIsProcedure = false; 192 193 /* 194 * _QEvent datatype for use in input queueing. 195 */ 196 struct _XSQEvent{ 197 _XSQEvent* next; 198 XEvent event; 199 c_ulong qserial_num; /* so multi-threaded code can find new ones */ 200 } 201 alias _XSQEvent _XQEvent; 202 version( XTHREADS ){ 203 /* Author: Stephen Gildea, MIT X Consortium 204 * 205 * declarations for C Threads locking 206 */ 207 struct _LockInfoRec{} 208 alias _LockInfoRec* LockInfoPtr; 209 210 version( XTHREADS_WARN ){ 211 struct _XLockPtrs { /* interfaces for locking.c */ 212 /* used by all, including extensions; do not move */ 213 extern (C) nothrow void function( 214 Display* dpy, 215 char* file, 216 int line 217 ) lock_display; 218 extern (C) nothrow void function( 219 Display* dpy, 220 char* file, 221 int line 222 ) unlock_display; 223 } 224 } 225 else version( XTHREADS_FILE_LINE ){ 226 struct _XLockPtrs { /* interfaces for locking.c */ 227 /* used by all, including extensions; do not move */ 228 extern (C) nothrow void function( 229 Display* dpy, 230 char* file, 231 int line 232 ) lock_display; 233 extern (C) nothrow void function( 234 Display* dpy, 235 char* file, 236 int line 237 ) unlock_display; 238 } 239 } 240 else{ 241 struct _XLockPtrs { /* interfaces for locking.c */ 242 /* used by all, including extensions; do not move */ 243 extern (C) nothrow void function( Display* dpy ) lock_display; 244 extern (C) nothrow void function( Display* dpy ) unlock_display; 245 } 246 } 247 248 //~ template _XCreateMutex_fn{ const _XCreateMutex_fn _XCreateMutex_fn = _XCreateMutex_fn_p; } 249 //~ template _XFreeMutex_fn{ const _XFreeMutex_fn _XFreeMutex_fn = _XFreeMutex_fn_p; } 250 //~ template _XLockMutex_fn{ const _XFreeMutex_fn _XFreeMutex_fn = _XLockMutex_fn_p; } 251 //~ template _XUnlockMutex_fn{ const _XUnlockMutex_fn _XUnlockMutex_fn = _XUnlockMutex_fn_p; } 252 //~ template _Xglobal_lock{ const _Xglobal_lock _Xglobal_lock = Xglobal_lock_p; } 253 254 /* in XlibInt.c */ 255 extern void function( 256 LockInfoPtr /* lock */ 257 ) _XCreateMutex_fn; 258 extern void function( 259 LockInfoPtr /* lock */ 260 ) _XFreeMutex_fn; 261 version( XTHREADS_WARN ){ 262 extern void function( 263 LockInfoPtr /* lock */ 264 , char* /* file */ 265 , int /* line */ 266 ) _XLockMutex_fn; 267 } 268 else version( XTHREADS_FILE_LINE ){ 269 extern void function( 270 LockInfoPtr /* lock */ 271 , char* /* file */ 272 , int /* line */ 273 ) _XLockMutex_fn; 274 } 275 else{ 276 extern void function( 277 LockInfoPtr /* lock */ 278 , char* /* file */ 279 , int /* line */ 280 ) _XLockMutex_fn; 281 } 282 version( XTHREADS_WARN ){ 283 extern void function( 284 LockInfoPtr /* lock */ 285 , char* /* file */ 286 , int /* line */ 287 ) _XUnlockMutex_fn; 288 } 289 else version( XTHREADS_FILE_LINE ){ 290 extern void function( 291 LockInfoPtr /* lock */ 292 , char* /* file */ 293 , int /* line */ 294 ) _XUnlockMutex_fn; 295 } 296 else{ 297 extern void function( 298 LockInfoPtr /* lock */ 299 ) _XUnlockMutex_fn; 300 } 301 302 extern LockInfoPtr _Xglobal_lock; 303 304 version(XTHREADS_WARN){ 305 void LockDisplay( Display* d ){ if (d.lock_fns) d.lock_fns.lock_display(d,__FILE__,__LINE__); } 306 void UnlockDisplay( Display* d ){ if (d.lock_fns) d.lock_fns.unlock_display(d,__FILE__,__LINE__); } 307 void _XLockMutex( LockInfoPtr lock ){ if (_XLockMutex_fn) _XLockMutex_fn(lock,__FILE__,__LINE__); } 308 void _XUnlockMutex( LockInfoPtr lock ){ if (_XUnlockMutex_fn) _XUnlockMutex_fn(lock,__FILE__,__LINE__); } 309 } 310 else{ 311 /* used everywhere, so must be fast if not using threads */ 312 void LockDisplay( Display* d ){ if (d.lock_fns) d.lock_fns.lock_display(d); } 313 void UnlockDisplay( Display* d ){ if (d.lock_fns) d.lock_fns.unlock_display(d); } 314 void _XLockMutex( LockInfoPtr lock){ if (_XLockMutex_fn) _XLockMutex_fn(lock); } 315 void _XUnlockMutex( LockInfoPtr lock){ if (_XUnlockMutex_fn) _XUnlockMutex_fn(lock); } 316 } 317 void _XCreateMutex( LockInfoPtr lock ){ if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);} 318 void _XFreeMutex( LockInfoPtr lock ){ if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);} 319 } 320 else{ /* !XTHREADS */ 321 extern LockInfoPtr _Xglobal_lock; // warn put here for skip build error 322 struct _XLockPtrs{} 323 struct _LockInfoRec{} 324 alias _LockInfoRec* LockInfoPtr; 325 void LockDisplay( Display* dis){} 326 void _XLockMutex( LockInfoPtr lock){} 327 void _XUnlockMutex( LockInfoPtr lock){} 328 void UnlockDisplay( Display* dis){} 329 void _XCreateMutex( LockInfoPtr lock){} 330 void _XFreeMutex( LockInfoPtr lock){} 331 } 332 333 void Xfree(void* ptr){ free(ptr); } 334 335 const int LOCKED = 1; 336 const int UNLOCKED = 0; 337 338 const int BUFSIZE = 2048; /* X output buffer size. */ 339 const int PTSPERBATCH = 1024; /* point batching */ 340 const int WLNSPERBATCH = 50; /* wide line batching */ 341 const int ZLNSPERBATCH = 1024; /* thin line batching */ 342 const int WRCTSPERBATCH = 10; /* wide line rectangle batching */ 343 const int ZRCTSPERBATCH = 256; /* thin line rectangle batching */ 344 const int FRCTSPERBATCH = 256; /* filled rectangle batching */ 345 const int FARCSPERBATCH = 256; /* filled arc batching */ 346 const string CURSORFONT = "cursor"; /* standard cursor fonts */ 347 348 349 /* 350 * Display flags 351 */ 352 enum { 353 XlibDisplayIOError = 1L << 0, 354 XlibDisplayClosing = 1L << 1, 355 XlibDisplayNoXkb = 1L << 2, 356 XlibDisplayPrivSync = 1L << 3, 357 XlibDisplayProcConni = 1L << 4, /* in _XProcessInternalConnection */ 358 XlibDisplayReadEvents = 1L << 5, /* in _XReadEvents */ 359 XlibDisplayReply = 1L << 5, /* in _XReply */ 360 XlibDisplayWriting = 1L << 6, /* in _XFlushInt, _XSend */ 361 XlibDisplayDfltRMDB = 1L << 7 /* mark if RM db from XGetDefault */ 362 } 363 364 /* 365 * X Protocol packetizing macros. 366 */ 367 368 /* Need to start requests on 64 bit word boundaries 369 * on a CRAY computer so add a NoOp (127) if needed. 370 * A character pointer on a CRAY computer will be non-zero 371 * after shifting right 61 bits of it is not pointing to 372 * a word boundary. 373 */ 374 //~ version( X86_64 ){ 375 //~ enum WORD64ALIGN = true; 376 //~ if ( cast(c_long) dpy.bufptr >> 61){ 377 //~ dpy.last_req = dpy.bufptr; 378 //~ dpy.bufptr = X_NoOperation; 379 //~ dpy.bufptr+1 = 0; 380 //~ dpy.bufptr+2 = 0; 381 //~ dpy.bufptr+3 = 1; 382 //~ dpy.request++; 383 //~ dpy.bufptr += 4; 384 //~ } 385 //~ } 386 //~ else /* else does not require alignment on 64-bit boundaries */ 387 //~ enum WORD64ALIGN = true; 388 //~ } /* WORD64 */ 389 390 391 /* 392 * GetReq - Get the next available X request packet in the buffer and 393 * return it. 394 * 395 * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc. 396 * "req" is the name of the request pointer. 397 * 398 */ 399 400 //~ #if !defined(UNIXCPP) || defined(ANSICPP) 401 //~ #define GetReq(name, req) 402 //~ WORD64ALIGN\ 403 //~ if ((dpy.bufptr + SIZEOF(x##name##Req)) > dpy.bufmax)\ 404 //~ _XFlush(dpy);\ 405 //~ req = (x##name##Req *)(dpy.last_req = dpy.bufptr);\ 406 //~ req.reqType = X_##name;\ 407 //~ req.length = (SIZEOF(x##name##Req))>>2;\ 408 //~ dpy.bufptr += SIZEOF(x##name##Req);\ 409 //~ dpy.request++ 410 //~ 411 //~ #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ 412 //~ #define GetReq(name, req) 413 //~ WORD64ALIGN\ 414 //~ if ((dpy.bufptr + SIZEOF(x /* */name/*Req)) > dpy.bufmax)\ 415 //~ _XFlush(dpy);\ 416 //~ req = (x /* */name/*Req *)(dpy.last_req = dpy.bufptr);\ 417 //~ req.reqType = X_ /* */name;\ 418 //~ req.length = (SIZEOF(x /* */name/*Req))>>2;\ 419 //~ dpy.bufptr += SIZEOF(x /* */name/*Req);\ 420 //~ dpy.request++ 421 //~ #endif 422 423 /* GetReqExtra is the same as GetReq, but allocates "n" additional 424 bytes after the request. "n" must be a multiple of 4! */ 425 426 //~ #if !defined(UNIXCPP) || defined(ANSICPP) 427 //~ #define GetReqExtra(name, n, req) 428 //~ WORD64ALIGN\ 429 //~ if ((dpy.bufptr + SIZEOF(x##name##Req) + n) > dpy.bufmax)\ 430 //~ _XFlush(dpy);\ 431 //~ req = (x##name##Req *)(dpy.last_req = dpy.bufptr);\ 432 //~ req.reqType = X_##name;\ 433 //~ req.length = (SIZEOF(x##name##Req) + n)>>2;\ 434 //~ dpy.bufptr += SIZEOF(x##name##Req) + n;\ 435 //~ dpy.request++ 436 //~ #else 437 //~ #define GetReqExtra(name, n, req) 438 //~ WORD64ALIGN\ 439 //~ if ((dpy.bufptr + SIZEOF(x /* */name/*Req) + n) > dpy.bufmax)\ 440 //~ _XFlush(dpy);\ 441 //~ req = (x /* */name/*Req *)(dpy.last_req = dpy.bufptr);\ 442 //~ req.reqType = X_ /* */name;\ 443 //~ req.length = (SIZEOF(x /* */name/*Req) + n)>>2;\ 444 //~ dpy.bufptr += SIZEOF(x /* */name/*Req) + n;\ 445 //~ dpy.request++ 446 //~ #endif 447 448 449 /* 450 * GetResReq is for those requests that have a resource ID 451 * (Window, Pixmap, GContext, etc.) as their single argument. 452 * "rid" is the name of the resource. 453 */ 454 455 //~ #if !defined(UNIXCPP) || defined(ANSICPP) 456 //~ #define GetResReq(name, rid, req) 457 //~ WORD64ALIGN\ 458 //~ if ((dpy.bufptr + SIZEOF(xResourceReq)) > dpy.bufmax)\ 459 //~ _XFlush(dpy);\ 460 //~ req = (xResourceReq *) (dpy.last_req = dpy.bufptr);\ 461 //~ req.reqType = X_##name;\ 462 //~ req.length = 2;\ 463 //~ req.id = (rid);\ 464 //~ dpy.bufptr += SIZEOF(xResourceReq);\ 465 //~ dpy.request++ 466 //~ #else 467 //~ #define GetResReq(name, rid, req) 468 //~ WORD64ALIGN\ 469 //~ if ((dpy.bufptr + SIZEOF(xResourceReq)) > dpy.bufmax)\ 470 //~ _XFlush(dpy);\ 471 //~ req = (xResourceReq *) (dpy.last_req = dpy.bufptr);\ 472 //~ req.reqType = X_ /* */name;\ 473 //~ req.length = 2;\ 474 //~ req.id = (rid);\ 475 //~ dpy.bufptr += SIZEOF(xResourceReq);\ 476 //~ dpy.request++ 477 //~ #endif 478 479 /* 480 * GetEmptyReq is for those requests that have no arguments 481 * at all. 482 */ 483 //~ #if !defined(UNIXCPP) || defined(ANSICPP) 484 //~ #define GetEmptyReq(name, req) 485 //~ WORD64ALIGN\ 486 //~ if ((dpy.bufptr + SIZEOF(xReq)) > dpy.bufmax)\ 487 //~ _XFlush(dpy);\ 488 //~ req = (xReq *) (dpy.last_req = dpy.bufptr);\ 489 //~ req.reqType = X_##name;\ 490 //~ req.length = 1;\ 491 //~ dpy.bufptr += SIZEOF(xReq);\ 492 //~ dpy.request++ 493 //~ #else 494 //~ #define GetEmptyReq(name, req) 495 //~ WORD64ALIGN\ 496 //~ if ((dpy.bufptr + SIZEOF(xReq)) > dpy.bufmax)\ 497 //~ _XFlush(dpy);\ 498 //~ req = (xReq *) (dpy.last_req = dpy.bufptr);\ 499 //~ req.reqType = X_ /* */name;\ 500 //~ req.length = 1;\ 501 //~ dpy.bufptr += SIZEOF(xReq);\ 502 //~ dpy.request++ 503 //~ #endif 504 505 //~ static if( WORD64 ){ 506 //~ template MakeBigReq(req,n){ 507 //~ char _BRdat[4]; 508 //~ c_ulong _BRlen = req.length - 1; 509 //~ req.length = 0; 510 //~ memcpy(_BRdat, cast(char)* req + (_BRlen << 2), 4); 511 //~ memmove(cast(char)* req + 8, cast(char)* req + 4, _BRlen << 2); 512 //~ memcpy(cast(char)* req + 4, _BRdat, 4); 513 //~ Data32(dpy, cast(long)* &_BRdat, 4); 514 //~ } 515 //~ } 516 //~ else{ 517 //~ static if( WORD64 ){ 518 //~ template MakeBigReq(req,n){ 519 //~ CARD64 _BRdat; 520 //~ CARD32 _BRlen = req.length - 1; 521 //~ req.length = 0; 522 //~ _BRdat = cast(CARD32)* req[_BRlen]; 523 //~ memmove(cast(char)* req + 8, cast(char)* req + 4, _BRlen << 2); 524 //~ cast(CARD32)* req[1] = _BRlen + n + 2; 525 //~ Data32(dpy, &_BRdat, 4); 526 //~ } 527 //~ } 528 //~ else{ 529 //~ template MakeBigReq(req,n){ 530 //~ CARD32 _BRdat; 531 //~ CARD32 _BRlen = req.length - 1; 532 //~ req.length = 0; 533 //~ _BRdat = cast(CARD32)* req[_BRlen]; 534 //~ memmove(cast(char)* req + 8, cast(char)* req + 4, _BRlen << 2); 535 //~ cast(CARD32)* req[1] = _BRlen + n + 2; 536 //~ Data32(dpy, &_BRdat, 4); 537 //~ } 538 //~ } 539 //~ } 540 541 //~ void SetReqLen(req,n,badlen){ 542 //~ if ((req.length + n) > 65535u){ 543 //~ if (dpy.bigreq_size) { 544 //~ MakeBigReq(req,n); 545 //~ } else { 546 //~ n = badlen; 547 //~ req.length += n; 548 //~ } 549 //~ } else 550 //~ req.length += n; 551 //~ } 552 553 //~ void SyncHandle(){ 554 //~ if (dpy.synchandler) 555 //~ dpy.synchandler(dpy); 556 //~ } 557 558 extern void _XFlushGCCache(Display* dpy, GC gc); 559 void FlushGC(Display* dpy, GC gc){ 560 if (gc.dirty) 561 _XFlushGCCache(dpy, gc); 562 } 563 /* 564 * Data - Place data in the buffer and pad the end to provide 565 * 32 bit word alignment. Transmit if the buffer fills. 566 * 567 * "dpy" is a pointer to a Display. 568 * "data" is a pinter to a data buffer. 569 * "len" is the length of the data buffer. 570 */ 571 static if(!DataRoutineIsProcedure){ 572 void Data( Display* dpy, char* data, uint len) { 573 if (dpy.bufptr + len <= dpy.bufmax){ 574 memcpy(dpy.bufptr, data, cast(int)len); 575 dpy.bufptr += (len + 3) & ~3; 576 } else 577 _XSend(dpy, data, len); 578 } 579 } /* DataRoutineIsProcedure */ 580 581 582 /* Allocate bytes from the buffer. No padding is done, so if 583 * the length is not a multiple of 4, the caller must be 584 * careful to leave the buffer aligned after sending the 585 * current request. 586 * 587 * "type" is the type of the pointer being assigned to. 588 * "ptr" is the pointer being assigned to. 589 * "n" is the number of bytes to allocate. 590 * 591 * Example: 592 * xTextElt* elt; 593 * BufAlloc (xTextElt *, elt, nbytes) 594 */ 595 596 //~ void BufAlloc(T)(ptr, size_t n){ 597 //~ if (dpy.bufptr + n > dpy.bufmax) 598 //~ _XFlush (dpy); 599 //~ ptr = cast(T) dpy.bufptr; 600 //~ memset(ptr, '\0', n); 601 //~ dpy.bufptr += n; 602 //~ } 603 604 static if( WORD64 ){ 605 void Data16( Display* dpy, short* data, uint len) { _XData16(dpy, data, len); } 606 void Data32( Display* dpy, c_long* data, uint len) { _XData32(dpy, data, len); } 607 extern int _XData16( 608 Display* dpy, 609 short* data, 610 uint len 611 ); 612 extern int _XData32( 613 Display* dpy, 614 c_long* data, 615 uint len 616 ); 617 } 618 else{ /* not WORD64 */ 619 void Data16( Display* dpy, short* data, uint len) { Data(dpy, cast(char *) data, len); } 620 void _XRead16Pad( Display* dpy, short* data, uint len) { _XReadPad(dpy, cast(char *) data, len); } 621 void _XRead16( Display* dpy, short* data, uint len) { _XRead(dpy, cast(char *) data, len); } 622 static if(LONG64){ 623 void Data32( Display* dpy, c_long* data, uint len){ _XData32(dpy, data, len); } 624 extern int _XData32( 625 Display* dpy, 626 c_long* data, 627 uint len 628 ); 629 extern void _XRead32( 630 Display* dpy, 631 c_long* data, 632 c_long len 633 ); 634 } 635 else{ 636 void Data32( Display* dpy, int* data, uint len) { Data(dpy, cast(char *) data, len); } 637 void _XRead32( Display* dpy, int* data, uint len) { _XRead(dpy, cast(char *) data, len); } 638 } 639 } 640 641 int max(int a, int b) { return (a < b) ? b : a; } 642 int min(int a, int b) { return (a > b) ? b : a; } 643 644 bool CI_NONEXISTCHAR( XCharStruct* cs ){ 645 return ((cs.width == 0) && ((cs.rbearing|cs.lbearing|cs.ascent|cs.descent) == 0)); 646 } 647 /* 648 * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit 649 * character. If the character is in the column and exists, then return the 650 * appropriate metrics (note that fonts with common per-character metrics will 651 * return min_bounds). If none of these hold true, try again with the default 652 * char. 653 */ 654 void CI_GET_CHAR_INFO_1D( XFontStruct* fs, uint col, XCharStruct* def, XCharStruct* cs){ 655 cs = def; 656 if (col >= fs.min_char_or_char2 && col <= fs.max_char_or_char2) { 657 if (fs.per_char == null) 658 cs = &fs.min_bounds; 659 else { 660 cs = &fs.per_char[(col - fs.min_char_or_char2)]; 661 if ( CI_NONEXISTCHAR(cs) ) 662 cs = def; 663 } 664 } 665 } 666 667 void CI_GET_DEFAULT_INFO_1D( XFontStruct* fs, XCharStruct* cs){ 668 CI_GET_CHAR_INFO_1D (fs, fs.default_char, null, cs); 669 } 670 671 672 673 /* 674 * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and 675 * column. This is used for fonts that have more than row zero. 676 */ 677 void CI_GET_CHAR_INFO_2D( XFontStruct* fs, uint row, uint col, XCharStruct* def, XCharStruct* cs){ 678 cs = def; 679 if (row >= fs.min_char1 && row <= fs.max_char1 && col >= fs.min_char_or_char2 && col <= fs.max_char_or_char2) { 680 if (fs.per_char == null) 681 cs = &fs.min_bounds; 682 else{ 683 cs = &fs.per_char[((row - fs.min_char1) * (fs.max_char_or_char2 - fs.min_char_or_char2 + 1)) + (col - fs.min_char_or_char2)]; 684 if (CI_NONEXISTCHAR(cs)) 685 cs = def; 686 } 687 } 688 } 689 690 void CI_GET_DEFAULT_INFO_2D(XFontStruct* fs, XCharStruct* cs){ 691 uint r = (fs.default_char >> 8); 692 uint c = (fs.default_char & 0xff); 693 CI_GET_CHAR_INFO_2D (fs, r, c, null, cs); 694 } 695 696 version( MUSTCOPY ){ 697 /* for when 32-bit alignment is not good enough */ 698 void OneDataCard32( Display* dpy, c_long* dstaddr, c_ulong srcvar ){ 699 dpy.bufptr -= 4; 700 Data32(dpy, cast(char)* &(srcvar), 4); 701 } 702 } 703 else{ 704 /* srcvar must be a variable for large architecture version */ 705 void OneDataCard32( Display* dpy, c_long* dstaddr, c_ulong srcvar){ 706 *dstaddr = cast(CARD32*)srcvar; 707 } 708 } 709 710 711 struct _XInternalAsync { 712 _XInternalAsync* next; 713 /* 714 * handler arguments: 715 * rep is the generic reply that caused this handler 716 * to be invoked. It must also be passed to _XGetAsyncReply. 717 * buf and len are opaque values that must be passed to 718 * _XGetAsyncReply or _XGetAsyncData. 719 * data is the closure stored in this struct. 720 * The handler returns True iff it handled this reply. 721 */ 722 extern (C) nothrow Bool function( 723 Display* /* dpy */, 724 xReply* /* rep */, 725 char* /* buf */, 726 int /* len */, 727 XPointer /* data */ 728 ) handler; 729 XPointer data; 730 } 731 alias _XInternalAsync _XAsyncHandler; 732 733 struct _XAsyncEState { 734 c_ulong min_sequence_number; 735 c_ulong max_sequence_number; 736 ubyte error_code; 737 ubyte major_opcode; 738 ushort minor_opcode; 739 ubyte last_error_received; 740 int error_count; 741 } 742 alias _XAsyncEState _XAsyncErrorState; 743 744 extern void _XDeqAsyncHandler(Display* dpy, _XAsyncHandler* handler); 745 746 void DeqAsyncHandler( Display* dpy, _XAsyncHandler* handler ){ 747 if (dpy.async_handlers == handler) 748 dpy.async_handlers = handler.next; 749 else 750 _XDeqAsyncHandler(dpy, handler); 751 } 752 753 alias void function( 754 Display* /* display */ 755 ) FreeFuncType; 756 757 alias int function( 758 XModifierKeymap* /* modmap */ 759 ) FreeModmapType; 760 761 /* 762 * This structure is private to the library. 763 */ 764 struct _XFreeFuncs { 765 FreeFuncType atoms; /* _XFreeAtomTable */ 766 FreeModmapType modifiermap; /* XFreeModifierMap */ 767 FreeFuncType key_bindings; /* _XFreeKeyBindings */ 768 FreeFuncType context_db; /* _XFreeContextDB */ 769 FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */ 770 FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */ 771 FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */ 772 FreeFuncType im_filters; /* _XFreeIMFilters */ 773 FreeFuncType xkb; /* _XkbFreeInfo */ 774 } 775 alias _XFreeFuncs _XFreeFuncRec; 776 777 /* types for InitExt.c */ 778 alias int function ( 779 Display* /* display */, 780 GC /* gc */, 781 XExtCodes* /* codes */ 782 ) CreateGCType; 783 784 alias int function( 785 Display* /* display */, 786 GC /* gc */, 787 XExtCodes* /* codes */ 788 ) CopyGCType; 789 790 alias int function ( 791 Display* /* display */, 792 GC /* gc */, 793 XExtCodes* /* codes */ 794 ) FlushGCType; 795 796 alias int function ( 797 Display* /* display */, 798 GC /* gc */, 799 XExtCodes* /* codes */ 800 ) FreeGCType; 801 802 alias int function ( 803 Display* /* display */, 804 XFontStruct* /* fs */, 805 XExtCodes* /* codes */ 806 ) CreateFontType; 807 808 alias int function( 809 Display* /* display */, 810 XFontStruct* /* fs */, 811 XExtCodes* /* codes */ 812 ) FreeFontType; 813 814 alias int function( 815 Display* /* display */, 816 XExtCodes* /* codes */ 817 ) CloseDisplayType; 818 819 alias int function( 820 Display* /* display */, 821 xError* /* err */, 822 XExtCodes* /* codes */, 823 int* /* ret_code */ 824 ) ErrorType; 825 826 alias char* function( 827 Display* /* display */, 828 int /* code */, 829 XExtCodes* /* codes */, 830 char* /* buffer */, 831 int /* nbytes */ 832 ) ErrorStringType; 833 834 alias void function( 835 Display* /* display */, 836 XErrorEvent* /* ev */, 837 void* /* fp */ 838 ) PrintErrorType; 839 840 alias void function( 841 Display* /* display */, 842 XExtCodes* /* codes */, 843 const char* /* data */, 844 c_long /* len */ 845 ) BeforeFlushType; 846 847 /* 848 * This structure is private to the library. 849 */ 850 struct _XExten { /* private to extension mechanism */ 851 _XExten* next; /* next in list */ 852 XExtCodes codes; /* public information, all extension told */ 853 CreateGCType create_GC; /* routine to call when GC created */ 854 CopyGCType copy_GC; /* routine to call when GC copied */ 855 FlushGCType flush_GC; /* routine to call when GC flushed */ 856 FreeGCType free_GC; /* routine to call when GC freed */ 857 CreateFontType create_Font; /* routine to call when Font created */ 858 FreeFontType free_Font; /* routine to call when Font freed */ 859 CloseDisplayType close_display; /* routine to call when connection closed */ 860 ErrorType error; /* who to call when an error occurs */ 861 ErrorStringType error_string; /* routine to supply error string */ 862 char* name; /* name of this extension */ 863 PrintErrorType error_values; /* routine to supply error values */ 864 BeforeFlushType before_flush; /* routine to call when sending data */ 865 _XExten* next_flush; /* next in list of those with flushes */ 866 } 867 alias _XExten _XExtension; 868 869 /* extension hooks */ 870 static if (DataRoutineIsProcedure) 871 { 872 extern void Data(Display* dpy, char* data, c_long len); 873 } 874 875 extern int _XError( 876 Display* /* dpy */, 877 xError* /* rep */ 878 ); 879 extern int _XIOError( 880 Display* /* dpy */ 881 ); 882 extern int function( 883 Display* /* dpy */ 884 ) _XIOErrorFunction; 885 extern int function( 886 Display* /* dpy */, 887 XErrorEvent* /* error_event */ 888 ) _XErrorFunction; 889 extern void _XEatData( 890 Display* /* dpy */, 891 c_ulong /* n */ 892 ); 893 extern char* _XAllocScratch( 894 Display* /* dpy */, 895 c_ulong /* nbytes */ 896 ); 897 extern char* _XAllocTemp( 898 Display* /* dpy */, 899 c_ulong /* nbytes */ 900 ); 901 extern void _XFreeTemp( 902 Display* /* dpy */, 903 char* /* buf */, 904 c_ulong /* nbytes */ 905 ); 906 extern Visual* _XVIDtoVisual( 907 Display* /* dpy */, 908 VisualID /* id */ 909 ); 910 extern c_ulong _XSetLastRequestRead( 911 Display* /* dpy */, 912 xGenericReply* /* rep */ 913 ); 914 extern int _XGetHostname( 915 char* /* buf */, 916 int /* maxlen */ 917 ); 918 extern Screen* _XScreenOfWindow( 919 Display* /* dpy */, 920 Window /* w */ 921 ); 922 extern Bool _XAsyncErrorHandler( 923 Display* /* dpy */, 924 xReply* /* rep */, 925 char* /* buf */, 926 int /* len */, 927 XPointer /* data */ 928 ); 929 extern char* _XGetAsyncReply( 930 Display* /* dpy */, 931 char* /* replbuf */, 932 xReply* /* rep */, 933 char* /* buf */, 934 int /* len */, 935 int /* extra */, 936 Bool /* discard */ 937 ); 938 extern void _XGetAsyncData( 939 Display* /* dpy */, 940 char * /* data */, 941 char * /* buf */, 942 int /* len */, 943 int /* skip */, 944 int /* datalen */, 945 int /* discardtotal */ 946 ); 947 extern void _XFlush( 948 Display* /* dpy */ 949 ); 950 extern int _XEventsQueued( 951 Display* /* dpy */, 952 int /* mode */ 953 ); 954 extern void _XReadEvents( 955 Display* /* dpy */ 956 ); 957 extern int _XRead( 958 Display* /* dpy */, 959 char* /* data */, 960 c_long /* size */ 961 ); 962 extern void _XReadPad( 963 Display* /* dpy */, 964 char* /* data */, 965 c_long /* size */ 966 ); 967 extern void _XSend( 968 Display* /* dpy */, 969 const char* /* data */, 970 c_long /* size */ 971 ); 972 extern Status _XReply( 973 Display* /* dpy */, 974 xReply* /* rep */, 975 int /* extra */, 976 Bool /* discard */ 977 ); 978 extern void _XEnq( 979 Display* /* dpy */, 980 xEvent* /* event */ 981 ); 982 extern void _XDeq( 983 Display* /* dpy */, 984 _XQEvent* /* prev */, 985 _XQEvent* /* qelt */ 986 ); 987 988 extern Bool _XUnknownWireEvent( 989 Display* /* dpy */, 990 XEvent* /* re */, 991 xEvent* /* event */ 992 ); 993 994 extern Bool _XUnknownWireEventCookie( 995 Display* /* dpy */, 996 XGenericEventCookie* /* re */, 997 xEvent* /* event */ 998 ); 999 1000 extern Bool _XUnknownCopyEventCookie( 1001 Display* /* dpy */, 1002 XGenericEventCookie* /* in */, 1003 XGenericEventCookie* /* out */ 1004 ); 1005 1006 extern Status _XUnknownNativeEvent( 1007 Display* /* dpy */, 1008 XEvent* /* re */, 1009 xEvent* /* event */ 1010 ); 1011 1012 extern Bool _XWireToEvent(Display* dpy, XEvent* re, xEvent* event); 1013 extern Bool _XDefaultWireError(Display* display, XErrorEvent* he, xError* we); 1014 extern Bool _XPollfdCacheInit(Display* dpy); 1015 extern void _XPollfdCacheAdd(Display* dpy, int fd); 1016 extern void _XPollfdCacheDel(Display* dpy, int fd); 1017 extern XID _XAllocID(Display* dpy); 1018 extern void _XAllocIDs(Display* dpy, XID* ids, int count); 1019 1020 extern int _XFreeExtData( 1021 XExtData* /* extension */ 1022 ); 1023 1024 extern int function( Display*, GC, XExtCodes* ) XESetCreateGC( 1025 Display* /* display */, 1026 int /* extension */, 1027 int function ( 1028 Display* /* display */, 1029 GC /* gc */, 1030 XExtCodes* /* codes */ 1031 ) /* proc */ 1032 ); 1033 1034 extern int function( Display*, GC, XExtCodes* ) XESetCopyGC( 1035 Display* /* display */, 1036 int /* extension */, 1037 int function ( 1038 Display* /* display */, 1039 GC /* gc */, 1040 XExtCodes* /* codes */ 1041 ) /* proc */ 1042 ); 1043 1044 extern int function( Display*, GC, XExtCodes* ) XESetFlushGC( 1045 Display* /* display */, 1046 int /* extension */, 1047 int function ( 1048 Display* /* display */, 1049 GC /* gc */, 1050 XExtCodes* /* codes */ 1051 ) /* proc */ 1052 ); 1053 1054 extern int function (Display*, GC, XExtCodes* ) XESetFreeGC( 1055 Display* /* display */, 1056 int /* extension */, 1057 int function ( 1058 Display* /* display */, 1059 GC /* gc */, 1060 XExtCodes* /* codes */ 1061 ) /* proc */ 1062 ); 1063 1064 extern int function( Display*, XFontStruct*, XExtCodes* ) XESetCreateFont( 1065 Display* /* display */, 1066 int /* extension */, 1067 int function ( 1068 Display* /* display */, 1069 XFontStruct* /* fs */, 1070 XExtCodes* /* codes */ 1071 ) /* proc */ 1072 ); 1073 1074 extern int function(Display*, XFontStruct*, XExtCodes* ) XESetFreeFont( 1075 Display* /* display */, 1076 int /* extension */, 1077 int function ( 1078 Display* /* display */, 1079 XFontStruct* /* fs */, 1080 XExtCodes* /* codes */ 1081 ) /* proc */ 1082 ); 1083 1084 extern int function( Display*, XExtCodes* ) XESetCloseDisplay( 1085 Display* /* display */, 1086 int /* extension */, 1087 int function ( 1088 Display* /* display */, 1089 XExtCodes* /* codes */ 1090 ) /* proc */ 1091 ); 1092 1093 extern int function( Display*, xError*, XExtCodes*, int* ) XESetError( 1094 Display* /* display */, 1095 int /* extension */, 1096 int function ( 1097 Display* /* display */, 1098 xError* /* err */, 1099 XExtCodes* /* codes */, 1100 int* /* ret_code */ 1101 ) /* proc */ 1102 ); 1103 1104 extern char* function( Display*, int, XExtCodes*, char*, int ) XESetErrorString( 1105 Display* /* display */, 1106 int /* extension */, 1107 char* function ( 1108 Display* /* display */, 1109 int /* code */, 1110 XExtCodes* /* codes */, 1111 char* /* buffer */, 1112 int /* nbytes */ 1113 ) /* proc */ 1114 ); 1115 1116 extern void function( Display*, XErrorEvent*, void* ) XESetPrintErrorValues( 1117 Display* /* display */, 1118 int /* extension */, 1119 void function( 1120 Display* /* display */, 1121 XErrorEvent* /* ev */, 1122 void* /* fp */ 1123 ) /* proc */ 1124 ); 1125 1126 extern Bool function( Display*, XEvent*, xEvent* )XESetWireToEvent( 1127 Display* /* display */, 1128 int /* event_number */, 1129 Bool function ( 1130 Display* /* display */, 1131 XEvent* /* re */, 1132 xEvent* /* event */ 1133 ) /* proc */ 1134 ); 1135 1136 extern Bool function( Display*, XGenericEventCookie*, xEvent* )XESetWireToEventCookie( 1137 Display* /* display */, 1138 int /* extension */, 1139 Bool function ( 1140 Display* /* display */, 1141 XGenericEventCookie* /* re */, 1142 xEvent* /* event */ 1143 ) /* proc */ 1144 ); 1145 1146 extern Bool function( Display*, XGenericEventCookie*, XGenericEventCookie* )XESetCopyEventCookie( 1147 Display* /* display */, 1148 int /* extension */, 1149 Bool function ( 1150 Display* /* display */, 1151 XGenericEventCookie* /* in */, 1152 XGenericEventCookie* /* out */ 1153 ) /* proc */ 1154 ); 1155 1156 1157 extern Status function( Display*, XEvent*, xEvent* ) XESetEventToWire( 1158 Display* /* display */, 1159 int /* event_number */, 1160 Status function ( 1161 Display* /* display */, 1162 XEvent* /* re */, 1163 xEvent* /* event */ 1164 ) /* proc */ 1165 ); 1166 1167 extern Bool function( Display*, XErrorEvent*, xError* ) XESetWireToError( 1168 Display* /* display */, 1169 int /* error_number */, 1170 Bool function ( 1171 Display* /* display */, 1172 XErrorEvent* /* he */, 1173 xError* /* we */ 1174 ) /* proc */ 1175 ); 1176 1177 extern void function( Display*, XExtCodes*, const char*, c_long ) XESetBeforeFlush( 1178 Display* /* display */, 1179 int /* error_number */, 1180 void function ( 1181 Display* /* display */, 1182 XExtCodes* /* codes */, 1183 const char* /* data */, 1184 c_long /* len */ 1185 ) /* proc */ 1186 ); 1187 1188 /* internal connections for IMs */ 1189 1190 alias void function( 1191 Display* /* dpy */, 1192 int /* fd */, 1193 XPointer /* call_data */ 1194 ) _XInternalConnectionProc; 1195 1196 1197 extern Status _XRegisterInternalConnection( 1198 Display* /* dpy */, 1199 int /* fd */, 1200 _XInternalConnectionProc /* callback */, 1201 XPointer /* call_data */ 1202 ); 1203 1204 extern void _XUnregisterInternalConnection( 1205 Display* /* dpy */, 1206 int /* fd */ 1207 ); 1208 1209 extern void _XProcessInternalConnection( 1210 Display* /* dpy */, 1211 _XConnectionInfo* /* conn_info */ 1212 ); 1213 1214 /* Display structure has pointers to these */ 1215 1216 struct _XConnectionInfo { /* info from _XRegisterInternalConnection */ 1217 int fd; 1218 _XInternalConnectionProc read_callback; 1219 XPointer call_data; 1220 XPointer* watch_data; /* set/used by XConnectionWatchProc */ 1221 _XConnectionInfo* next; 1222 }; 1223 1224 struct _XConnWatchInfo { /* info from XAddConnectionWatch */ 1225 XConnectionWatchProc fn; 1226 XPointer client_data; 1227 _XConnWatchInfo* next; 1228 }; 1229 1230 version( Posix ){ 1231 extern char* __XOS2RedirRoot( char* ); 1232 } 1233 1234 extern int _XTextHeight( 1235 XFontStruct* /* font_struct */, 1236 const char* /* string */, 1237 int /* count */ 1238 ); 1239 1240 extern int _XTextHeight16( 1241 XFontStruct* /* font_struct */, 1242 const XChar2b* /* string */, 1243 int /* count */ 1244 ); 1245 1246 alias std.stdio.File.open _XOpenFile; 1247 alias fopen _XFopenFile; 1248 1249 /* EvToWire.c */ 1250 extern Status _XEventToWire(Display* dpy, XEvent* re, xEvent* event); 1251 1252 extern int _XF86LoadQueryLocaleFont( 1253 Display* /* dpy */, 1254 const char* /* name */, 1255 XFontStruct** /* xfp */, 1256 Font* /* fidp */ 1257 ); 1258 1259 extern void _XProcessWindowAttributes( Display* dpy, xChangeWindowAttributesReq* req, c_ulong valuemask, XSetWindowAttributes* attributes); 1260 1261 extern int _XDefaultError( Display* dpy, XErrorEvent* event); 1262 1263 extern int _XDefaultIOError( Display* dpy); 1264 1265 extern void _XSetClipRectangles( Display* dpy, GC gc, int clip_x_origin, int clip_y_origin, XRectangle* rectangles, int n, int ordering ); 1266 1267 Status _XGetWindowAttributes( Display* dpy, Window w, XWindowAttributes* attr); 1268 1269 int _XPutBackEvent( Display* dpy, XEvent* event); 1270 1271 extern Bool _XIsEventCookie( Display* dpy, XEvent* ev ); 1272 1273 extern void _XFreeEventCookies( Display* dpy ); 1274 1275 extern void _XStoreEventCookie( Display* dpy, XEvent* ev ); 1276 1277 extern Bool _XFetchEventCookie( Display* dpy, XGenericEventCookie* ev ); 1278 1279 extern Bool _XCopyEventCookie( Display* dpy, XGenericEventCookie* inEvent, XGenericEventCookie* outEvent ); 1280 1281 /* lcFile.c */ 1282 1283 extern void xlocaledir( char* buf, int buf_len );