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