| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | #ifndef _X11_XLIBINT_H_ |
| 31 | #define _X11_XLIBINT_H_ 1 |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | #include <stdint.h> |
| 42 | #include <X11/Xlib.h> |
| 43 | #include <X11/Xproto.h> |
| 44 | #include <X11/XlibConf.h> |
| 45 | |
| 46 | #ifdef XTHREADS |
| 47 | #include <X11/Xthreads.h> |
| 48 | #endif |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | #ifdef __clang__ |
| 54 | #pragma clang diagnostic push |
| 55 | #pragma clang diagnostic ignored "-Wpadded" |
| 56 | #endif |
| 57 | |
| 58 | #ifdef WIN32 |
| 59 | #define _XFlush _XFlushIt |
| 60 | #endif |
| 61 | |
| 62 | struct _XGC |
| 63 | { |
| 64 | XExtData *ext_data; |
| 65 | GContext gid; |
| 66 | Bool rects; |
| 67 | Bool dashes; |
| 68 | unsigned long dirty; |
| 69 | XGCValues values; |
| 70 | }; |
| 71 | |
| 72 | struct _XDisplay |
| 73 | { |
| 74 | XExtData *ext_data; |
| 75 | struct _XFreeFuncs *free_funcs; |
| 76 | int fd; |
| 77 | int conn_checker; |
| 78 | int proto_major_version; |
| 79 | int proto_minor_version; |
| 80 | char *vendor; |
| 81 | XID resource_base; |
| 82 | XID resource_mask; |
| 83 | XID resource_id; |
| 84 | int resource_shift; |
| 85 | XID (*resource_alloc)( |
| 86 | struct _XDisplay* |
| 87 | ); |
| 88 | int byte_order; |
| 89 | int bitmap_unit; |
| 90 | int bitmap_pad; |
| 91 | int bitmap_bit_order; |
| 92 | int nformats; |
| 93 | ScreenFormat *pixmap_format; |
| 94 | int vnumber; |
| 95 | int release; |
| 96 | struct _XSQEvent *head, *tail; |
| 97 | int qlen; |
| 98 | unsigned long last_request_read; |
| 99 | unsigned long request; |
| 100 | char *last_req; |
| 101 | char *buffer; |
| 102 | char *bufptr; |
| 103 | char *bufmax; |
| 104 | unsigned max_request_size; |
| 105 | struct _XrmHashBucketRec *db; |
| 106 | int (*synchandler)( |
| 107 | struct _XDisplay* |
| 108 | ); |
| 109 | char *display_name; |
| 110 | int default_screen; |
| 111 | int nscreens; |
| 112 | Screen *screens; |
| 113 | unsigned long motion_buffer; |
| 114 | volatile unsigned long flags; |
| 115 | int min_keycode; |
| 116 | int max_keycode; |
| 117 | KeySym *keysyms; |
| 118 | XModifierKeymap *modifiermap; |
| 119 | int keysyms_per_keycode; |
| 120 | char *xdefaults; |
| 121 | char *scratch_buffer; |
| 122 | unsigned long scratch_length; |
| 123 | int ext_number; |
| 124 | struct _XExten *ext_procs; |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | Bool (*event_vec[128])( |
| 134 | Display * , |
| 135 | XEvent * , |
| 136 | xEvent * |
| 137 | ); |
| 138 | Status (*wire_vec[128])( |
| 139 | Display * , |
| 140 | XEvent * , |
| 141 | xEvent * |
| 142 | ); |
| 143 | KeySym lock_meaning; |
| 144 | struct _XLockInfo *lock; |
| 145 | struct _XInternalAsync *async_handlers; |
| 146 | unsigned long bigreq_size; |
| 147 | struct _XLockPtrs *lock_fns; |
| 148 | void (*idlist_alloc)( |
| 149 | Display * , |
| 150 | XID * , |
| 151 | int |
| 152 | ); |
| 153 | |
| 154 | struct _XKeytrans *key_bindings; |
| 155 | Font cursor_font; |
| 156 | struct _XDisplayAtoms *atoms; |
| 157 | unsigned int mode_switch; |
| 158 | unsigned int num_lock; |
| 159 | struct _XContextDB *context_db; |
| 160 | Bool (**error_vec)( |
| 161 | Display * , |
| 162 | XErrorEvent * , |
| 163 | xError * |
| 164 | ); |
| 165 | |
| 166 | |
| 167 | |
| 168 | struct { |
| 169 | XPointer defaultCCCs; |
| 170 | XPointer clientCmaps; |
| 171 | XPointer perVisualIntensityMaps; |
| 172 | |
| 173 | } cms; |
| 174 | struct _XIMFilter *im_filters; |
| 175 | struct _XSQEvent *qfree; |
| 176 | unsigned long next_event_serial_num; |
| 177 | struct _XExten *flushes; |
| 178 | struct _XConnectionInfo *im_fd_info; |
| 179 | int im_fd_length; |
| 180 | struct _XConnWatchInfo *conn_watchers; |
| 181 | int watcher_count; |
| 182 | XPointer filedes; |
| 183 | int (*savedsynchandler)( |
| 184 | Display * |
| 185 | ); |
| 186 | XID resource_max; |
| 187 | int xcmisc_opcode; |
| 188 | struct _XkbInfoRec *xkb_info; |
| 189 | struct _XtransConnInfo *trans_conn; |
| 190 | struct _X11XCBPrivate *xcb; |
| 191 | |
| 192 | |
| 193 | unsigned int next_cookie; |
| 194 | |
| 195 | Bool (*generic_event_vec[128])( |
| 196 | Display * , |
| 197 | XGenericEventCookie * , |
| 198 | xEvent * ); |
| 199 | |
| 200 | Bool (*generic_event_copy_vec[128])( |
| 201 | Display * , |
| 202 | XGenericEventCookie * , |
| 203 | XGenericEventCookie * ); |
| 204 | void *cookiejar; |
| 205 | #ifndef LONG64 |
| 206 | unsigned long last_request_read_upper32bit; |
| 207 | unsigned long request_upper32bit; |
| 208 | #endif |
| 209 | |
| 210 | struct _XErrorThreadInfo *error_threads; |
| 211 | |
| 212 | XIOErrorExitHandler exit_handler; |
| 213 | void *exit_handler_data; |
| 214 | CARD32 in_ifevent; |
| 215 | #ifdef XTHREADS |
| 216 | xthread_t ifevent_thread; |
| 217 | #endif |
| 218 | }; |
| 219 | |
| 220 | #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | #ifndef LONG64 |
| 228 | |
| 229 | |
| 230 | #define X_DPY_GET_REQUEST(dpy) \ |
| 231 | ( \ |
| 232 | ((uint64_t)(((struct _XDisplay*)dpy)->request)) \ |
| 233 | + (((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) << 32) \ |
| 234 | ) |
| 235 | |
| 236 | #define X_DPY_SET_REQUEST(dpy, value) \ |
| 237 | ( \ |
| 238 | (((struct _XDisplay*)dpy)->request = \ |
| 239 | (value) & 0xFFFFFFFFUL), \ |
| 240 | (((struct _XDisplay*)dpy)->request_upper32bit = \ |
| 241 | ((uint64_t)(value)) >> 32), \ |
| 242 | (void)0 \ |
| 243 | ) |
| 244 | |
| 245 | #define X_DPY_GET_LAST_REQUEST_READ(dpy) \ |
| 246 | ( \ |
| 247 | ((uint64_t)(((struct _XDisplay*)dpy)->last_request_read)) \ |
| 248 | + ( \ |
| 249 | ((uint64_t)( \ |
| 250 | ((struct _XDisplay*)dpy)->last_request_read_upper32bit \ |
| 251 | )) << 32 \ |
| 252 | ) \ |
| 253 | ) |
| 254 | |
| 255 | #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \ |
| 256 | ( \ |
| 257 | (((struct _XDisplay*)dpy)->last_request_read = \ |
| 258 | (value) & 0xFFFFFFFFUL), \ |
| 259 | (((struct _XDisplay*)dpy)->last_request_read_upper32bit = \ |
| 260 | ((uint64_t)(value)) >> 32), \ |
| 261 | (void)0 \ |
| 262 | ) |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) \ |
| 275 | ( \ |
| 276 | ((uint64_t)ulseq) \ |
| 277 | + \ |
| 278 | (( \ |
| 279 | ((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) \ |
| 280 | - (uint64_t)( \ |
| 281 | (ulseq) > (((struct _XDisplay*)dpy)->request) \ |
| 282 | ) \ |
| 283 | ) << 32) \ |
| 284 | ) |
| 285 | |
| 286 | #define X_DPY_REQUEST_INCREMENT(dpy) \ |
| 287 | ( \ |
| 288 | ((struct _XDisplay*)dpy)->request++, \ |
| 289 | ( \ |
| 290 | (((struct _XDisplay*)dpy)->request == 0) ? ( \ |
| 291 | ((struct _XDisplay*)dpy)->request_upper32bit++ \ |
| 292 | ) : 0 \ |
| 293 | ), \ |
| 294 | (void)0 \ |
| 295 | ) |
| 296 | |
| 297 | |
| 298 | #define X_DPY_REQUEST_DECREMENT(dpy) \ |
| 299 | ( \ |
| 300 | ( \ |
| 301 | (((struct _XDisplay*)dpy)->request == 0) ? (\ |
| 302 | ((struct _XDisplay*)dpy)->request--, \ |
| 303 | ((struct _XDisplay*)dpy)->request_upper32bit-- \ |
| 304 | ) : ( \ |
| 305 | ((struct _XDisplay*)dpy)->request-- \ |
| 306 | ) \ |
| 307 | ), \ |
| 308 | (void)0 \ |
| 309 | ) |
| 310 | |
| 311 | #else |
| 312 | |
| 313 | #define X_DPY_GET_REQUEST(dpy) \ |
| 314 | (((struct _XDisplay*)dpy)->request) |
| 315 | #define X_DPY_SET_REQUEST(dpy, value) \ |
| 316 | ((struct _XDisplay*)dpy)->request = (value) |
| 317 | |
| 318 | #define X_DPY_GET_LAST_REQUEST_READ(dpy) \ |
| 319 | (((struct _XDisplay*)dpy)->last_request_read) |
| 320 | #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \ |
| 321 | ((struct _XDisplay*)dpy)->last_request_read = (value) |
| 322 | |
| 323 | #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) ulseq |
| 324 | |
| 325 | #define X_DPY_REQUEST_INCREMENT(dpy) ((struct _XDisplay*)dpy)->request++ |
| 326 | #define X_DPY_REQUEST_DECREMENT(dpy) ((struct _XDisplay*)dpy)->request-- |
| 327 | #endif |
| 328 | |
| 329 | |
| 330 | #ifndef _XEVENT_ |
| 331 | |
| 332 | |
| 333 | |
| 334 | typedef struct _XSQEvent |
| 335 | { |
| 336 | struct _XSQEvent *next; |
| 337 | XEvent event; |
| 338 | unsigned long qserial_num; |
| 339 | } _XQEvent; |
| 340 | #endif |
| 341 | |
| 342 | #include <X11/Xproto.h> |
| 343 | #include <errno.h> |
| 344 | #define _XBCOPYFUNC _Xbcopy |
| 345 | #include <X11/Xfuncs.h> |
| 346 | #include <X11/Xosdefs.h> |
| 347 | |
| 348 | |
| 349 | #ifdef dirty |
| 350 | #undef dirty |
| 351 | #endif |
| 352 | |
| 353 | #include <stdlib.h> |
| 354 | #include <string.h> |
| 355 | |
| 356 | #include <X11/Xfuncproto.h> |
| 357 | |
| 358 | _XFUNCPROTOBEGIN |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | #ifdef XTHREADS |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | typedef struct _LockInfoRec *LockInfoPtr; |
| 371 | |
| 372 | |
| 373 | struct _XLockPtrs { |
| 374 | |
| 375 | void (*lock_display)( |
| 376 | Display *dpy |
| 377 | #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) |
| 378 | , char *file |
| 379 | , int line |
| 380 | #endif |
| 381 | ); |
| 382 | void (*unlock_display)( |
| 383 | Display *dpy |
| 384 | #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) |
| 385 | , char *file |
| 386 | , int line |
| 387 | #endif |
| 388 | ); |
| 389 | }; |
| 390 | |
| 391 | #if defined(WIN32) && !defined(_XLIBINT_) |
| 392 | #define _XCreateMutex_fn (*_XCreateMutex_fn_p) |
| 393 | #define _XFreeMutex_fn (*_XFreeMutex_fn_p) |
| 394 | #define _XLockMutex_fn (*_XLockMutex_fn_p) |
| 395 | #define _XUnlockMutex_fn (*_XUnlockMutex_fn_p) |
| 396 | #define _Xglobal_lock (*_Xglobal_lock_p) |
| 397 | #endif |
| 398 | |
| 399 | |
| 400 | extern void (*_XCreateMutex_fn)( |
| 401 | LockInfoPtr |
| 402 | ); |
| 403 | extern void (*_XFreeMutex_fn)( |
| 404 | LockInfoPtr |
| 405 | ); |
| 406 | extern void (*_XLockMutex_fn)( |
| 407 | LockInfoPtr |
| 408 | #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) |
| 409 | , char * |
| 410 | , int |
| 411 | #endif |
| 412 | ); |
| 413 | extern void (*_XUnlockMutex_fn)( |
| 414 | LockInfoPtr |
| 415 | #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) |
| 416 | , char * |
| 417 | , int |
| 418 | #endif |
| 419 | ); |
| 420 | |
| 421 | extern LockInfoPtr _Xglobal_lock; |
| 422 | |
| 423 | #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) |
| 424 | #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__) |
| 425 | #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__) |
| 426 | #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__) |
| 427 | #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__) |
| 428 | #else |
| 429 | |
| 430 | #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d) |
| 431 | #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d) |
| 432 | #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock) |
| 433 | #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock) |
| 434 | #endif |
| 435 | #define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock) |
| 436 | #define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock) |
| 437 | |
| 438 | #else |
| 439 | #define LockDisplay(dis) |
| 440 | #define _XLockMutex(lock) |
| 441 | #define _XUnlockMutex(lock) |
| 442 | #define UnlockDisplay(dis) |
| 443 | #define _XCreateMutex(lock) |
| 444 | #define _XFreeMutex(lock) |
| 445 | #endif |
| 446 | |
| 447 | #define Xfree(ptr) free((ptr)) |
| 448 | |
| 449 | |
| 450 | |
| 451 | |
| 452 | |
| 453 | |
| 454 | |
| 455 | #if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__) |
| 456 | |
| 457 | # define Xmalloc(size) malloc((size_t)((size) == 0 ? 1 : (size))) |
| 458 | # define Xrealloc(ptr, size) realloc((ptr), (size_t)((size) == 0 ? 1 : (size))) |
| 459 | # define Xcalloc(nelem, elsize) calloc((size_t)((nelem) == 0 ? 1 : (nelem)), (size_t)(elsize)) |
| 460 | |
| 461 | #else |
| 462 | |
| 463 | # define Xmalloc(size) malloc((size_t)(size)) |
| 464 | # define Xrealloc(ptr, size) realloc((ptr), (size_t)(size)) |
| 465 | # define Xcalloc(nelem, elsize) calloc((size_t)(nelem), (size_t)(elsize)) |
| 466 | |
| 467 | #endif |
| 468 | |
| 469 | #include <stddef.h> |
| 470 | |
| 471 | #define LOCKED 1 |
| 472 | #define UNLOCKED 0 |
| 473 | |
| 474 | #ifndef BUFSIZE |
| 475 | #define BUFSIZE 2048 |
| 476 | #endif |
| 477 | #ifndef PTSPERBATCH |
| 478 | #define PTSPERBATCH 1024 |
| 479 | #endif |
| 480 | #ifndef WLNSPERBATCH |
| 481 | #define WLNSPERBATCH 50 |
| 482 | #endif |
| 483 | #ifndef ZLNSPERBATCH |
| 484 | #define ZLNSPERBATCH 1024 |
| 485 | #endif |
| 486 | #ifndef WRCTSPERBATCH |
| 487 | #define WRCTSPERBATCH 10 |
| 488 | #endif |
| 489 | #ifndef ZRCTSPERBATCH |
| 490 | #define ZRCTSPERBATCH 256 |
| 491 | #endif |
| 492 | #ifndef FRCTSPERBATCH |
| 493 | #define FRCTSPERBATCH 256 |
| 494 | #endif |
| 495 | #ifndef FARCSPERBATCH |
| 496 | #define FARCSPERBATCH 256 |
| 497 | #endif |
| 498 | #ifndef CURSORFONT |
| 499 | #define CURSORFONT "cursor" |
| 500 | #endif |
| 501 | |
| 502 | |
| 503 | |
| 504 | |
| 505 | #define XlibDisplayIOError (1L << 0) |
| 506 | #define XlibDisplayClosing (1L << 1) |
| 507 | #define XlibDisplayNoXkb (1L << 2) |
| 508 | #define XlibDisplayPrivSync (1L << 3) |
| 509 | #define XlibDisplayProcConni (1L << 4) |
| 510 | #define XlibDisplayReadEvents (1L << 5) |
| 511 | #define XlibDisplayReply (1L << 5) |
| 512 | #define XlibDisplayWriting (1L << 6) |
| 513 | #define XlibDisplayDfltRMDB (1L << 7) |
| 514 | |
| 515 | |
| 516 | |
| 517 | |
| 518 | |
| 519 | |
| 520 | #define WORD64ALIGN |
| 521 | |
| 522 | |
| 523 | |
| 524 | |
| 525 | |
| 526 | |
| 527 | |
| 528 | |
| 529 | |
| 530 | |
| 531 | |
| 532 | |
| 533 | extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); |
| 534 | |
| 535 | |
| 536 | |
| 537 | |
| 538 | #define GetReqSized(name, sz, req) \ |
| 539 | req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) |
| 540 | |
| 541 | |
| 542 | |
| 543 | |
| 544 | |
| 545 | |
| 546 | |
| 547 | |
| 548 | |
| 549 | |
| 550 | #define GetReq(name, req) \ |
| 551 | GetReqSized(name, SIZEOF(x##name##Req), req) |
| 552 | |
| 553 | |
| 554 | |
| 555 | |
| 556 | #define GetReqExtra(name, n, req) \ |
| 557 | GetReqSized(name, SIZEOF(x##name##Req) + n, req) |
| 558 | |
| 559 | |
| 560 | |
| 561 | |
| 562 | |
| 563 | |
| 564 | |
| 565 | #define GetResReq(name, rid, req) \ |
| 566 | req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ |
| 567 | if (req) req->id = (rid) |
| 568 | |
| 569 | |
| 570 | |
| 571 | |
| 572 | |
| 573 | |
| 574 | #define GetEmptyReq(name, req) \ |
| 575 | req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) |
| 576 | |
| 577 | |
| 578 | |
| 579 | |
| 580 | |
| 581 | |
| 582 | |
| 583 | |
| 584 | |
| 585 | #ifdef LONG64 |
| 586 | #define MakeBigReq(req,n) \ |
| 587 | { \ |
| 588 | CARD64 _BRdat; \ |
| 589 | CARD32 _BRlen = (CARD32) (req->length - 1); \ |
| 590 | req->length = 0; \ |
| 591 | _BRdat = ((CARD32 *)req)[_BRlen]; \ |
| 592 | memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ |
| 593 | ((CARD32 *)req)[1] = _BRlen + (CARD32) (n) + 2; \ |
| 594 | Data32(dpy, &_BRdat, 4); \ |
| 595 | } |
| 596 | #else |
| 597 | #define MakeBigReq(req,n) \ |
| 598 | { \ |
| 599 | CARD32 _BRdat; \ |
| 600 | CARD32 _BRlen = req->length - 1; \ |
| 601 | req->length = 0; \ |
| 602 | _BRdat = ((CARD32 *)req)[_BRlen]; \ |
| 603 | memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ |
| 604 | ((CARD32 *)req)[1] = _BRlen + (CARD32) (n) + 2; \ |
| 605 | Data32(dpy, &_BRdat, 4); \ |
| 606 | } |
| 607 | #endif |
| 608 | |
| 609 | |
| 610 | |
| 611 | |
| 612 | |
| 613 | |
| 614 | |
| 615 | |
| 616 | #ifndef __clang_analyzer__ |
| 617 | #define SetReqLen(req,n,badlen) \ |
| 618 | if ((req->length + n) > (unsigned)65535) { \ |
| 619 | if (dpy->bigreq_size) { \ |
| 620 | MakeBigReq(req,n) \ |
| 621 | } else { \ |
| 622 | n = badlen; \ |
| 623 | req->length = (CARD16) (req->length + n); \ |
| 624 | } \ |
| 625 | } else \ |
| 626 | req->length = (CARD16) (req->length + n) |
| 627 | #else |
| 628 | #define SetReqLen(req,n,badlen) \ |
| 629 | req->length += n |
| 630 | #endif |
| 631 | |
| 632 | #define SyncHandle() \ |
| 633 | if (dpy->synchandler) (*dpy->synchandler)(dpy) |
| 634 | |
| 635 | extern void _XFlushGCCache(Display *dpy, GC gc); |
| 636 | #define FlushGC(dpy, gc) \ |
| 637 | if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) |
| 638 | |
| 639 | |
| 640 | |
| 641 | |
| 642 | |
| 643 | |
| 644 | |
| 645 | |
| 646 | #ifndef DataRoutineIsProcedure |
| 647 | #define Data(dpy, data, len) do {\ |
| 648 | if (dpy->bufptr + (len) <= dpy->bufmax) {\ |
| 649 | memcpy(dpy->bufptr, data, (size_t)(len));\ |
| 650 | dpy->bufptr += ((size_t)((len) + 3) & (size_t)~3);\ |
| 651 | } else\ |
| 652 | _XSend(dpy, (_Xconst char*)(data), (long)(len));\ |
| 653 | } while (0) |
| 654 | #endif |
| 655 | |
| 656 | |
| 657 | |
| 658 | |
| 659 | |
| 660 | |
| 661 | |
| 662 | |
| 663 | |
| 664 | |
| 665 | |
| 666 | |
| 667 | |
| 668 | |
| 669 | |
| 670 | |
| 671 | #define BufAlloc(type, ptr, n) do { \ |
| 672 | if (dpy->bufptr + (n) > dpy->bufmax) \ |
| 673 | _XFlush (dpy); \ |
| 674 | ptr = (type) dpy->bufptr; \ |
| 675 | memset(ptr, '\0', (size_t)(n)); \ |
| 676 | dpy->bufptr += (n); \ |
| 677 | } while (0) |
| 678 | |
| 679 | #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) |
| 680 | #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) |
| 681 | #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) |
| 682 | #ifdef LONG64 |
| 683 | #define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)(data), (unsigned)(len)) |
| 684 | extern int _XData32( |
| 685 | Display *dpy, |
| 686 | _Xconst long *data, |
| 687 | unsigned len |
| 688 | ); |
| 689 | extern void _XRead32( |
| 690 | Display *dpy, |
| 691 | long *data, |
| 692 | long len |
| 693 | ); |
| 694 | #else |
| 695 | #define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (long)(len)) |
| 696 | #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) |
| 697 | #endif |
| 698 | |
| 699 | #define PackData16(dpy,data,len) Data16 (dpy, data, len) |
| 700 | #define PackData32(dpy,data,len) Data32 (dpy, data, len) |
| 701 | |
| 702 | |
| 703 | #define PackData(dpy,data,len) PackData16 (dpy, data, len) |
| 704 | |
| 705 | #define min(a,b) (((a) < (b)) ? (a) : (b)) |
| 706 | #define max(a,b) (((a) > (b)) ? (a) : (b)) |
| 707 | |
| 708 | #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ |
| 709 | (((cs)->rbearing|(cs)->lbearing| \ |
| 710 | (cs)->ascent|(cs)->descent) == 0)) |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
| 715 | |
| 716 | |
| 717 | |
| 718 | |
| 719 | #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \ |
| 720 | do { \ |
| 721 | cs = def; \ |
| 722 | if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ |
| 723 | if (fs->per_char == NULL) { \ |
| 724 | cs = &fs->min_bounds; \ |
| 725 | } else { \ |
| 726 | cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ |
| 727 | if (CI_NONEXISTCHAR(cs)) cs = def; \ |
| 728 | } \ |
| 729 | } \ |
| 730 | } while (0) |
| 731 | |
| 732 | #define CI_GET_DEFAULT_INFO_1D(fs,cs) \ |
| 733 | CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs) |
| 734 | |
| 735 | |
| 736 | |
| 737 | |
| 738 | |
| 739 | |
| 740 | |
| 741 | #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \ |
| 742 | do { \ |
| 743 | cs = def; \ |
| 744 | if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ |
| 745 | col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ |
| 746 | if (fs->per_char == NULL) { \ |
| 747 | cs = &fs->min_bounds; \ |
| 748 | } else { \ |
| 749 | cs = &fs->per_char[((row - fs->min_byte1) * \ |
| 750 | (fs->max_char_or_byte2 - \ |
| 751 | fs->min_char_or_byte2 + 1)) + \ |
| 752 | (col - fs->min_char_or_byte2)]; \ |
| 753 | if (CI_NONEXISTCHAR(cs)) cs = def; \ |
| 754 | } \ |
| 755 | } \ |
| 756 | } while (0) |
| 757 | |
| 758 | #define CI_GET_DEFAULT_INFO_2D(fs,cs) \ |
| 759 | do { \ |
| 760 | unsigned int r = (fs->default_char >> 8); \ |
| 761 | unsigned int c = (fs->default_char & 0xff); \ |
| 762 | CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \ |
| 763 | } while (0) |
| 764 | |
| 765 | |
| 766 | |
| 767 | #define OneDataCard32(dpy,dstaddr,srcvar) \ |
| 768 | do { *(CARD32 *)(dstaddr) = (srcvar); } while (0) |
| 769 | |
| 770 | |
| 771 | typedef struct _XInternalAsync { |
| 772 | struct _XInternalAsync *next; |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | |
| 779 | |
| 780 | |
| 781 | |
| 782 | Bool (*handler)( |
| 783 | Display* , |
| 784 | xReply* , |
| 785 | char* , |
| 786 | int , |
| 787 | XPointer |
| 788 | ); |
| 789 | XPointer data; |
| 790 | } _XAsyncHandler; |
| 791 | |
| 792 | |
| 793 | |
| 794 | |
| 795 | |
| 796 | |
| 797 | typedef struct _XAsyncEState { |
| 798 | unsigned long min_sequence_number; |
| 799 | unsigned long max_sequence_number; |
| 800 | unsigned char error_code; |
| 801 | unsigned char major_opcode; |
| 802 | unsigned short minor_opcode; |
| 803 | unsigned char last_error_received; |
| 804 | int error_count; |
| 805 | } _XAsyncErrorState; |
| 806 | |
| 807 | extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); |
| 808 | #define DeqAsyncHandler(dpy,handler) do { \ |
| 809 | if (dpy->async_handlers == (handler)) \ |
| 810 | dpy->async_handlers = (handler)->next; \ |
| 811 | else \ |
| 812 | _XDeqAsyncHandler(dpy, handler); \ |
| 813 | } while (0) |
| 814 | |
| 815 | typedef void (*FreeFuncType) ( |
| 816 | Display* |
| 817 | ); |
| 818 | |
| 819 | typedef int (*FreeModmapType) ( |
| 820 | XModifierKeymap* |
| 821 | ); |
| 822 | |
| 823 | |
| 824 | |
| 825 | |
| 826 | typedef struct _XFreeFuncs { |
| 827 | FreeFuncType atoms; |
| 828 | FreeModmapType modifiermap; |
| 829 | FreeFuncType key_bindings; |
| 830 | FreeFuncType context_db; |
| 831 | FreeFuncType defaultCCCs; |
| 832 | FreeFuncType clientCmaps; |
| 833 | FreeFuncType intensityMaps; |
| 834 | FreeFuncType im_filters; |
| 835 | FreeFuncType xkb; |
| 836 | } _XFreeFuncRec; |
| 837 | |
| 838 | |
| 839 | typedef int (*CreateGCType) ( |
| 840 | Display* , |
| 841 | GC , |
| 842 | XExtCodes* |
| 843 | ); |
| 844 | |
| 845 | typedef int (*CopyGCType)( |
| 846 | Display* , |
| 847 | GC , |
| 848 | XExtCodes* |
| 849 | ); |
| 850 | |
| 851 | typedef int (*FlushGCType) ( |
| 852 | Display* , |
| 853 | GC , |
| 854 | XExtCodes* |
| 855 | ); |
| 856 | |
| 857 | typedef int (*FreeGCType) ( |
| 858 | Display* , |
| 859 | GC , |
| 860 | XExtCodes* |
| 861 | ); |
| 862 | |
| 863 | typedef int (*CreateFontType) ( |
| 864 | Display* , |
| 865 | XFontStruct* , |
| 866 | XExtCodes* |
| 867 | ); |
| 868 | |
| 869 | typedef int (*FreeFontType) ( |
| 870 | Display* , |
| 871 | XFontStruct* , |
| 872 | XExtCodes* |
| 873 | ); |
| 874 | |
| 875 | typedef int (*CloseDisplayType) ( |
| 876 | Display* , |
| 877 | XExtCodes* |
| 878 | ); |
| 879 | |
| 880 | typedef int (*ErrorType) ( |
| 881 | Display* , |
| 882 | xError* , |
| 883 | XExtCodes* , |
| 884 | int* |
| 885 | ); |
| 886 | |
| 887 | typedef char* (*ErrorStringType) ( |
| 888 | Display* , |
| 889 | int , |
| 890 | XExtCodes* , |
| 891 | char* , |
| 892 | int |
| 893 | ); |
| 894 | |
| 895 | typedef void (*PrintErrorType)( |
| 896 | Display* , |
| 897 | XErrorEvent* , |
| 898 | void* |
| 899 | ); |
| 900 | |
| 901 | typedef void (*BeforeFlushType)( |
| 902 | Display* , |
| 903 | XExtCodes* , |
| 904 | _Xconst char* , |
| 905 | long |
| 906 | ); |
| 907 | |
| 908 | |
| 909 | |
| 910 | |
| 911 | typedef struct _XExten { |
| 912 | struct _XExten *next; |
| 913 | XExtCodes codes; |
| 914 | CreateGCType create_GC; |
| 915 | CopyGCType copy_GC; |
| 916 | FlushGCType flush_GC; |
| 917 | FreeGCType free_GC; |
| 918 | CreateFontType create_Font; |
| 919 | FreeFontType free_Font; |
| 920 | CloseDisplayType close_display; |
| 921 | ErrorType error; |
| 922 | ErrorStringType error_string; |
| 923 | char *name; |
| 924 | PrintErrorType error_values; |
| 925 | BeforeFlushType before_flush; |
| 926 | struct _XExten *next_flush; |
| 927 | } _XExtension; |
| 928 | |
| 929 | |
| 930 | |
| 931 | #ifdef DataRoutineIsProcedure |
| 932 | extern void Data(Display *dpy, char *data, long len); |
| 933 | #endif |
| 934 | extern int _XError( |
| 935 | Display* , |
| 936 | xError* |
| 937 | ); |
| 938 | extern int _XIOError( |
| 939 | Display* |
| 940 | ); |
| 941 | extern int (*_XIOErrorFunction)( |
| 942 | Display* |
| 943 | ); |
| 944 | extern int (*_XErrorFunction)( |
| 945 | Display* , |
| 946 | XErrorEvent* |
| 947 | ); |
| 948 | extern void _XEatData( |
| 949 | Display* , |
| 950 | unsigned long |
| 951 | ) _X_COLD; |
| 952 | extern void _XEatDataWords( |
| 953 | Display* , |
| 954 | unsigned long |
| 955 | ) _X_COLD; |
| 956 | #if defined(__SUNPRO_C) |
| 957 | # pragma rarely_called(_XEatData, _XEatDataWords) |
| 958 | #endif |
| 959 | extern char *_XAllocScratch( |
| 960 | Display* , |
| 961 | unsigned long |
| 962 | ); |
| 963 | extern char *_XAllocTemp( |
| 964 | Display* , |
| 965 | unsigned long |
| 966 | ); |
| 967 | extern void _XFreeTemp( |
| 968 | Display* , |
| 969 | char* , |
| 970 | unsigned long |
| 971 | ); |
| 972 | extern Visual *_XVIDtoVisual( |
| 973 | Display* , |
| 974 | VisualID |
| 975 | ); |
| 976 | extern unsigned long _XSetLastRequestRead( |
| 977 | Display* , |
| 978 | xGenericReply* |
| 979 | ); |
| 980 | extern int _XGetHostname( |
| 981 | char* , |
| 982 | int |
| 983 | ); |
| 984 | extern Screen *_XScreenOfWindow( |
| 985 | Display* , |
| 986 | Window |
| 987 | ); |
| 988 | extern Bool _XAsyncErrorHandler( |
| 989 | Display* , |
| 990 | xReply* , |
| 991 | char* , |
| 992 | int , |
| 993 | XPointer |
| 994 | ); |
| 995 | extern char *_XGetAsyncReply( |
| 996 | Display* , |
| 997 | char* , |
| 998 | xReply* , |
| 999 | char* , |
| 1000 | int , |
| 1001 | int , |
| 1002 | Bool |
| 1003 | ); |
| 1004 | extern void _XGetAsyncData( |
| 1005 | Display* , |
| 1006 | char * , |
| 1007 | char * , |
| 1008 | int , |
| 1009 | int , |
| 1010 | int , |
| 1011 | int |
| 1012 | ); |
| 1013 | extern void _XFlush( |
| 1014 | Display* |
| 1015 | ); |
| 1016 | extern int _XEventsQueued( |
| 1017 | Display* , |
| 1018 | int |
| 1019 | ); |
| 1020 | extern void _XReadEvents( |
| 1021 | Display* |
| 1022 | ); |
| 1023 | extern int _XRead( |
| 1024 | Display* , |
| 1025 | char* , |
| 1026 | long |
| 1027 | ); |
| 1028 | extern void _XReadPad( |
| 1029 | Display* , |
| 1030 | char* , |
| 1031 | long |
| 1032 | ); |
| 1033 | extern void _XSend( |
| 1034 | Display* , |
| 1035 | _Xconst char* , |
| 1036 | long |
| 1037 | ); |
| 1038 | extern Status _XReply( |
| 1039 | Display* , |
| 1040 | xReply* , |
| 1041 | int , |
| 1042 | Bool |
| 1043 | ); |
| 1044 | extern void _XEnq( |
| 1045 | Display* , |
| 1046 | xEvent* |
| 1047 | ); |
| 1048 | extern void _XDeq( |
| 1049 | Display* , |
| 1050 | _XQEvent* , |
| 1051 | _XQEvent* |
| 1052 | ); |
| 1053 | |
| 1054 | extern Bool _XUnknownWireEvent( |
| 1055 | Display* , |
| 1056 | XEvent* , |
| 1057 | xEvent* |
| 1058 | ); |
| 1059 | |
| 1060 | extern Bool _XUnknownWireEventCookie( |
| 1061 | Display* , |
| 1062 | XGenericEventCookie* , |
| 1063 | xEvent* |
| 1064 | ); |
| 1065 | |
| 1066 | extern Bool _XUnknownCopyEventCookie( |
| 1067 | Display* , |
| 1068 | XGenericEventCookie* , |
| 1069 | XGenericEventCookie* |
| 1070 | ); |
| 1071 | |
| 1072 | extern Status _XUnknownNativeEvent( |
| 1073 | Display* , |
| 1074 | XEvent* , |
| 1075 | xEvent* |
| 1076 | ); |
| 1077 | |
| 1078 | extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event); |
| 1079 | extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we); |
| 1080 | extern Bool _XPollfdCacheInit(Display *dpy); |
| 1081 | extern void _XPollfdCacheAdd(Display *dpy, int fd); |
| 1082 | extern void _XPollfdCacheDel(Display *dpy, int fd); |
| 1083 | extern XID _XAllocID(Display *dpy); |
| 1084 | extern void _XAllocIDs(Display *dpy, XID *ids, int count); |
| 1085 | |
| 1086 | extern int _XFreeExtData( |
| 1087 | XExtData* |
| 1088 | ); |
| 1089 | |
| 1090 | extern int (*XESetCreateGC( |
| 1091 | Display* , |
| 1092 | int , |
| 1093 | int (*) ( |
| 1094 | Display* , |
| 1095 | GC , |
| 1096 | XExtCodes* |
| 1097 | ) |
| 1098 | ))( |
| 1099 | Display*, GC, XExtCodes* |
| 1100 | ); |
| 1101 | |
| 1102 | extern int (*XESetCopyGC( |
| 1103 | Display* , |
| 1104 | int , |
| 1105 | int (*) ( |
| 1106 | Display* , |
| 1107 | GC , |
| 1108 | XExtCodes* |
| 1109 | ) |
| 1110 | ))( |
| 1111 | Display*, GC, XExtCodes* |
| 1112 | ); |
| 1113 | |
| 1114 | extern int (*XESetFlushGC( |
| 1115 | Display* , |
| 1116 | int , |
| 1117 | int (*) ( |
| 1118 | Display* , |
| 1119 | GC , |
| 1120 | XExtCodes* |
| 1121 | ) |
| 1122 | ))( |
| 1123 | Display*, GC, XExtCodes* |
| 1124 | ); |
| 1125 | |
| 1126 | extern int (*XESetFreeGC( |
| 1127 | Display* , |
| 1128 | int , |
| 1129 | int (*) ( |
| 1130 | Display* , |
| 1131 | GC , |
| 1132 | XExtCodes* |
| 1133 | ) |
| 1134 | ))( |
| 1135 | Display*, GC, XExtCodes* |
| 1136 | ); |
| 1137 | |
| 1138 | extern int (*XESetCreateFont( |
| 1139 | Display* , |
| 1140 | int , |
| 1141 | int (*) ( |
| 1142 | Display* , |
| 1143 | XFontStruct* , |
| 1144 | XExtCodes* |
| 1145 | ) |
| 1146 | ))( |
| 1147 | Display*, XFontStruct*, XExtCodes* |
| 1148 | ); |
| 1149 | |
| 1150 | extern int (*XESetFreeFont( |
| 1151 | Display* , |
| 1152 | int , |
| 1153 | int (*) ( |
| 1154 | Display* , |
| 1155 | XFontStruct* , |
| 1156 | XExtCodes* |
| 1157 | ) |
| 1158 | ))( |
| 1159 | Display*, XFontStruct*, XExtCodes* |
| 1160 | ); |
| 1161 | |
| 1162 | extern int (*XESetCloseDisplay( |
| 1163 | Display* , |
| 1164 | int , |
| 1165 | int (*) ( |
| 1166 | Display* , |
| 1167 | XExtCodes* |
| 1168 | ) |
| 1169 | ))( |
| 1170 | Display*, XExtCodes* |
| 1171 | ); |
| 1172 | |
| 1173 | extern int (*XESetError( |
| 1174 | Display* , |
| 1175 | int , |
| 1176 | int (*) ( |
| 1177 | Display* , |
| 1178 | xError* , |
| 1179 | XExtCodes* , |
| 1180 | int* |
| 1181 | ) |
| 1182 | ))( |
| 1183 | Display*, xError*, XExtCodes*, int* |
| 1184 | ); |
| 1185 | |
| 1186 | extern char* (*XESetErrorString( |
| 1187 | Display* , |
| 1188 | int , |
| 1189 | char* (*) ( |
| 1190 | Display* , |
| 1191 | int , |
| 1192 | XExtCodes* , |
| 1193 | char* , |
| 1194 | int |
| 1195 | ) |
| 1196 | ))( |
| 1197 | Display*, int, XExtCodes*, char*, int |
| 1198 | ); |
| 1199 | |
| 1200 | extern void (*XESetPrintErrorValues ( |
| 1201 | Display* , |
| 1202 | int , |
| 1203 | void (*)( |
| 1204 | Display* , |
| 1205 | XErrorEvent* , |
| 1206 | void* |
| 1207 | ) |
| 1208 | ))( |
| 1209 | Display*, XErrorEvent*, void* |
| 1210 | ); |
| 1211 | |
| 1212 | extern Bool (*XESetWireToEvent( |
| 1213 | Display* , |
| 1214 | int , |
| 1215 | Bool (*) ( |
| 1216 | Display* , |
| 1217 | XEvent* , |
| 1218 | xEvent* |
| 1219 | ) |
| 1220 | ))( |
| 1221 | Display*, XEvent*, xEvent* |
| 1222 | ); |
| 1223 | |
| 1224 | extern Bool (*XESetWireToEventCookie( |
| 1225 | Display* , |
| 1226 | int , |
| 1227 | Bool (*) ( |
| 1228 | Display* , |
| 1229 | XGenericEventCookie* , |
| 1230 | xEvent* |
| 1231 | ) |
| 1232 | ))( |
| 1233 | Display*, XGenericEventCookie*, xEvent* |
| 1234 | ); |
| 1235 | |
| 1236 | extern Bool (*XESetCopyEventCookie( |
| 1237 | Display* , |
| 1238 | int , |
| 1239 | Bool (*) ( |
| 1240 | Display* , |
| 1241 | XGenericEventCookie* , |
| 1242 | XGenericEventCookie* |
| 1243 | ) |
| 1244 | ))( |
| 1245 | Display*, XGenericEventCookie*, XGenericEventCookie* |
| 1246 | ); |
| 1247 | |
| 1248 | |
| 1249 | extern Status (*XESetEventToWire( |
| 1250 | Display* , |
| 1251 | int , |
| 1252 | Status (*) ( |
| 1253 | Display* , |
| 1254 | XEvent* , |
| 1255 | xEvent* |
| 1256 | ) |
| 1257 | ))( |
| 1258 | Display*, XEvent*, xEvent* |
| 1259 | ); |
| 1260 | |
| 1261 | extern Bool (*XESetWireToError( |
| 1262 | Display* , |
| 1263 | int , |
| 1264 | Bool (*) ( |
| 1265 | Display* , |
| 1266 | XErrorEvent* , |
| 1267 | xError* |
| 1268 | ) |
| 1269 | ))( |
| 1270 | Display*, XErrorEvent*, xError* |
| 1271 | ); |
| 1272 | |
| 1273 | extern void (*XESetBeforeFlush( |
| 1274 | Display* , |
| 1275 | int , |
| 1276 | void (*) ( |
| 1277 | Display* , |
| 1278 | XExtCodes* , |
| 1279 | _Xconst char* , |
| 1280 | long |
| 1281 | ) |
| 1282 | ))( |
| 1283 | Display*, XExtCodes*, _Xconst char*, long |
| 1284 | ); |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | typedef void (*_XInternalConnectionProc)( |
| 1289 | Display* , |
| 1290 | int , |
| 1291 | XPointer |
| 1292 | ); |
| 1293 | |
| 1294 | |
| 1295 | extern Status _XRegisterInternalConnection( |
| 1296 | Display* , |
| 1297 | int , |
| 1298 | _XInternalConnectionProc , |
| 1299 | XPointer |
| 1300 | ); |
| 1301 | |
| 1302 | extern void _XUnregisterInternalConnection( |
| 1303 | Display* , |
| 1304 | int |
| 1305 | ); |
| 1306 | |
| 1307 | extern void _XProcessInternalConnection( |
| 1308 | Display* , |
| 1309 | struct _XConnectionInfo* |
| 1310 | ); |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | struct _XConnectionInfo { |
| 1315 | int fd; |
| 1316 | _XInternalConnectionProc read_callback; |
| 1317 | XPointer call_data; |
| 1318 | XPointer *watch_data; |
| 1319 | struct _XConnectionInfo *next; |
| 1320 | }; |
| 1321 | |
| 1322 | struct _XConnWatchInfo { |
| 1323 | XConnectionWatchProc fn; |
| 1324 | XPointer client_data; |
| 1325 | struct _XConnWatchInfo *next; |
| 1326 | }; |
| 1327 | |
| 1328 | extern int _XTextHeight( |
| 1329 | XFontStruct* , |
| 1330 | _Xconst char* , |
| 1331 | int |
| 1332 | ); |
| 1333 | |
| 1334 | extern int _XTextHeight16( |
| 1335 | XFontStruct* , |
| 1336 | _Xconst XChar2b* , |
| 1337 | int |
| 1338 | ); |
| 1339 | |
| 1340 | #if defined(WIN32) |
| 1341 | |
| 1342 | extern int _XOpenFile( |
| 1343 | _Xconst char* , |
| 1344 | int |
| 1345 | ); |
| 1346 | |
| 1347 | extern int _XOpenFileMode( |
| 1348 | _Xconst char* , |
| 1349 | int , |
| 1350 | mode_t |
| 1351 | ); |
| 1352 | |
| 1353 | extern void* _XFopenFile( |
| 1354 | _Xconst char* , |
| 1355 | _Xconst char* |
| 1356 | ); |
| 1357 | |
| 1358 | extern int _XAccessFile( |
| 1359 | _Xconst char* |
| 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 | |
| 1368 | extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event); |
| 1369 | |
| 1370 | extern int _XF86LoadQueryLocaleFont( |
| 1371 | Display* , |
| 1372 | _Xconst char* , |
| 1373 | XFontStruct** , |
| 1374 | Font* |
| 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 | |
| 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 |