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