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