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