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