1 /* $XFree86: xc/lib/X11/Xlibint.h,v 3.7 1996/12/23 05:59:50 dawes Exp $ */
2 /* $XConsortium: Xlibint.h /main/114 1996/10/22 14:24:29 kaleb $ */
6 Copyright (c) 1984, 1985, 1987, 1989 X Consortium
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
16 The above copyright notice and this permission notice shall be included
17 in all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
23 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 OTHER DEALINGS IN THE SOFTWARE.
27 Except as contained in this notice, the name of the X Consortium shall
28 not be used in advertising or otherwise to promote the sale, use or
29 other dealings in this Software without prior written authorization
30 from the X Consortium.
35 * Xlibint.h - Header definition and support file for the internal
36 * support routines used by the C subroutine interface
37 * library (Xlib) to the X Window System.
39 * Warning, there be dragons here....
45 #define _XFlush _XFlushIt
49 * If your BytesReadable correctly detects broken connections, then
50 * you should NOT define XCONN_CHECK_FREQ.
52 #ifndef XCONN_CHECK_FREQ
53 #define XCONN_CHECK_FREQ 256
58 XExtData *ext_data; /* hook for extension to hang data */
59 GContext gid; /* protocol ID for graphics context */
60 Bool rects; /* boolean: TRUE if clipmask is list of rectangles */
61 Bool dashes; /* boolean: TRUE if dash-list is really a list */
62 unsigned long dirty;/* cache dirty bits */
63 XGCValues values; /* shadow structure of values */
68 XExtData *ext_data; /* hook for extension to hang data */
69 struct _XFreeFuncs *free_funcs; /* internal free functions */
70 int fd; /* Network socket. */
71 int conn_checker; /* ugly thing used by _XEventsQueued */
72 int proto_major_version;/* maj. version of server's X protocol */
73 int proto_minor_version;/* minor version of server's X protocol */
74 char *vendor; /* vendor of the server hardware */
75 XID resource_base; /* resource ID base */
76 XID resource_mask; /* resource ID mask bits */
77 XID resource_id; /* allocator current ID */
78 int resource_shift; /* allocator shift to correct bits */
79 XID (*resource_alloc)( /* allocator function */
80 #if NeedFunctionPrototypes
84 int byte_order; /* screen byte order, LSBFirst, MSBFirst */
85 int bitmap_unit; /* padding and data requirements */
86 int bitmap_pad; /* padding requirements on bitmaps */
87 int bitmap_bit_order; /* LeastSignificant or MostSignificant */
88 int nformats; /* number of pixmap formats in list */
89 ScreenFormat *pixmap_format; /* pixmap format list */
90 int vnumber; /* Xlib's X protocol version number. */
91 int release; /* release of the server */
92 struct _XSQEvent *head, *tail; /* Input event queue. */
93 int qlen; /* Length of input event queue */
94 unsigned long last_request_read; /* seq number of last event read */
95 unsigned long request; /* sequence number of last request. */
96 char *last_req; /* beginning of last request, or dummy */
97 char *buffer; /* Output buffer starting address. */
98 char *bufptr; /* Output buffer index pointer. */
99 char *bufmax; /* Output buffer maximum+1 address. */
100 unsigned max_request_size; /* maximum number 32 bit words in request*/
101 struct _XrmHashBucketRec *db;
102 int (*synchandler)( /* Synchronization handler */
103 #if NeedFunctionPrototypes
107 char *display_name; /* "host:display" string used on this connect*/
108 int default_screen; /* default screen for operations */
109 int nscreens; /* number of screens on this server*/
110 Screen *screens; /* pointer to list of screens */
111 unsigned long motion_buffer; /* size of motion buffer */
112 unsigned long flags; /* internal connection flags */
113 int min_keycode; /* minimum defined keycode */
114 int max_keycode; /* maximum defined keycode */
115 KeySym *keysyms; /* This server's keysyms */
116 XModifierKeymap *modifiermap; /* This server's modifier keymap */
117 int keysyms_per_keycode;/* number of rows */
118 char *xdefaults; /* contents of defaults from server */
119 char *scratch_buffer; /* place to hang scratch buffer */
120 unsigned long scratch_length; /* length of scratch buffer */
121 int ext_number; /* extension number on this display */
122 struct _XExten *ext_procs; /* extensions initialized on this display */
124 * the following can be fixed size, as the protocol defines how
125 * much address space is available.
126 * While this could be done using the extension vector, there
127 * may be MANY events processed, so a search through the extension
128 * list to find the right procedure for each event might be
129 * expensive if many extensions are being used.
131 Bool (*event_vec[128])(); /* vector for wire to event */
132 Status (*wire_vec[128])(); /* vector for event to wire */
133 KeySym lock_meaning; /* for XLookupString */
134 struct _XLockInfo *lock; /* multi-thread state, display lock */
135 struct _XInternalAsync *async_handlers; /* for internal async */
136 unsigned long bigreq_size; /* max size of big requests */
137 struct _XLockPtrs *lock_fns; /* pointers to threads functions */
138 void (*idlist_alloc)(); /* XID list allocator function */
139 /* things above this line should not move, for binary compatibility */
140 struct _XKeytrans *key_bindings; /* for XLookupString */
141 Font cursor_font; /* for XCreateFontCursor */
142 struct _XDisplayAtoms *atoms; /* for XInternAtom */
143 unsigned int mode_switch; /* keyboard group modifiers */
144 unsigned int num_lock; /* keyboard numlock modifiers */
145 struct _XContextDB *context_db; /* context database */
146 Bool (**error_vec)(); /* vector for wire to error */
151 XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */
152 XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */
153 XPointer perVisualIntensityMaps;
154 /* linked list of XcmsIntensityMap */
156 struct _XIMFilter *im_filters;
157 struct _XSQEvent *qfree; /* unallocated event queue elements */
158 unsigned long next_event_serial_num; /* inserted into next queue elt */
159 struct _XExten *flushes; /* Flush hooks */
160 struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */
161 int im_fd_length; /* number of im_fd_info */
162 struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */
163 int watcher_count; /* number of conn_watchers */
164 XPointer filedes; /* struct pollfd cache for _XWaitForReadable */
165 int (*savedsynchandler)(); /* user synchandler when Xlib usurps */
166 XID resource_max; /* allocator max ID */
167 int xcmisc_opcode; /* major opcode for XC-MISC */
168 struct _XkbInfoRec *xkb_info; /* XKB info */
169 struct _XtransConnInfo *trans_conn; /* transport connection object */
172 #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
175 * define the following if you want the Data macro to be a procedure instead
178 #define DataRoutineIsProcedure
183 * _QEvent datatype for use in input queueing.
185 typedef struct _XSQEvent
187 struct _XSQEvent *next;
189 unsigned long qserial_num; /* so multi-threaded code can find new ones */
193 #ifdef XTHREADS /* for xReply */
197 #if NeedFunctionPrototypes /* prototypes require event type definitions */
201 #include <X11/Xproto.h>
203 #define _SGI_MP_SOURCE /* turn this on to get MP safe errno */
206 #define _XBCOPYFUNC _Xbcopy
207 #include <X11/Xfuncs.h>
208 #include <X11/Xosdefs.h>
210 /* Utek leaves kernel macros around in include files (bleah) */
215 #ifndef X_NOT_STDC_ENV
219 char *malloc(), *realloc(), *calloc();
229 * The following definitions can be used for locking requests in multi-threaded
233 /* Author: Stephen Gildea, MIT X Consortium
235 * declarations for C Threads locking
238 #include <X11/Xfuncproto.h>
241 /* used by all, including extensions; do not move */
242 void (*lock_display)();
243 void (*unlock_display)();
246 typedef struct _LockInfoRec *LockInfoPtr;
248 #if defined(WIN32) && !defined(_XLIBINT_)
249 #define _XCreateMutex_fn (*_XCreateMutex_fn_p)
250 #define _XFreeMutex_fn (*_XFreeMutex_fn_p)
251 #define _XLockMutex_fn (*_XLockMutex_fn_p)
252 #define _XUnlockMutex_fn (*_XUnlockMutex_fn_p)
253 #define _Xglobal_lock (*_Xglobal_lock_p)
257 extern void (*_XCreateMutex_fn)(
258 #if NeedFunctionPrototypes
259 LockInfoPtr /* lock */
262 extern void (*_XFreeMutex_fn)(
263 #if NeedFunctionPrototypes
264 LockInfoPtr /* lock */
267 extern void (*_XLockMutex_fn)(
268 #if NeedFunctionPrototypes
269 LockInfoPtr /* lock */
270 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
276 extern void (*_XUnlockMutex_fn)(
277 #if NeedFunctionPrototypes
278 LockInfoPtr /* lock */
279 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
286 extern LockInfoPtr _Xglobal_lock;
288 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
289 #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
290 #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
291 #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
292 #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
294 /* used everywhere, so must be fast if not using threads */
295 #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
296 #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
297 #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
298 #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
300 #define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
301 #define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
304 #define LockDisplay(dis)
305 #define _XLockMutex(lock)
306 #define _XUnlockMutex(lock)
307 #define UnlockDisplay(dis)
308 #define _XCreateMutex(lock)
309 #define _XFreeMutex(lock)
312 #define Xfree(ptr) free((ptr))
315 * Note that some machines do not return a valid pointer for malloc(0), in
316 * which case we provide an alternate under the control of the
317 * define MALLOC_0_RETURNS_NULL. This is necessary because some
318 * Xlib code expects malloc(0) to return a valid pointer to storage.
320 #ifdef MALLOC_0_RETURNS_NULL
322 # define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
323 # define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
324 # define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
328 # define Xmalloc(size) malloc((size))
329 # define Xrealloc(ptr, size) realloc((ptr), (size))
330 # define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
340 #ifdef X_NOT_STDC_ENV
341 extern int errno; /* Internal system error number. */
345 #define BUFSIZE 2048 /* X output buffer size. */
348 #define PTSPERBATCH 1024 /* point batching */
351 #define WLNSPERBATCH 50 /* wide line batching */
354 #define ZLNSPERBATCH 1024 /* thin line batching */
356 #ifndef WRCTSPERBATCH
357 #define WRCTSPERBATCH 10 /* wide line rectangle batching */
359 #ifndef ZRCTSPERBATCH
360 #define ZRCTSPERBATCH 256 /* thin line rectangle batching */
362 #ifndef FRCTSPERBATCH
363 #define FRCTSPERBATCH 256 /* filled rectangle batching */
365 #ifndef FARCSPERBATCH
366 #define FARCSPERBATCH 256 /* filled arc batching */
369 #define CURSORFONT "cursor" /* standard cursor fonts */
375 #define XlibDisplayIOError (1L << 0)
376 #define XlibDisplayClosing (1L << 1)
377 #define XlibDisplayNoXkb (1L << 2)
378 #define XlibDisplayPrivSync (1L << 3)
379 #define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */
380 #define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */
381 #define XlibDisplayReply (1L << 5) /* in _XReply */
382 #define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */
385 * X Protocol packetizing macros.
388 /* Need to start requests on 64 bit word boundaries
389 * on a CRAY computer so add a NoOp (127) if needed.
390 * A character pointer on a CRAY computer will be non-zero
391 * after shifting right 61 bits of it is not pointing to
395 #define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\
396 dpy->last_req = dpy->bufptr;\
397 *(dpy->bufptr) = X_NoOperation;\
398 *(dpy->bufptr+1) = 0;\
399 *(dpy->bufptr+2) = 0;\
400 *(dpy->bufptr+3) = 1;\
404 #else /* else does not require alignment on 64-bit boundaries */
410 * GetReq - Get the next available X request packet in the buffer and
413 * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
414 * "req" is the name of the request pointer.
418 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
419 #define GetReq(name, req) \
421 if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
423 req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
424 req->reqType = X_##name;\
425 req->length = (SIZEOF(x##name##Req))>>2;\
426 dpy->bufptr += SIZEOF(x##name##Req);\
429 #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
430 #define GetReq(name, req) \
432 if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
434 req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
435 req->reqType = X_/**/name;\
436 req->length = (SIZEOF(x/**/name/**/Req))>>2;\
437 dpy->bufptr += SIZEOF(x/**/name/**/Req);\
441 /* GetReqExtra is the same as GetReq, but allocates "n" additional
442 bytes after the request. "n" must be a multiple of 4! */
444 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
445 #define GetReqExtra(name, n, req) \
447 if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\
449 req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
450 req->reqType = X_##name;\
451 req->length = (SIZEOF(x##name##Req) + n)>>2;\
452 dpy->bufptr += SIZEOF(x##name##Req) + n;\
455 #define GetReqExtra(name, n, req) \
457 if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\
459 req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
460 req->reqType = X_/**/name;\
461 req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\
462 dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\
468 * GetResReq is for those requests that have a resource ID
469 * (Window, Pixmap, GContext, etc.) as their single argument.
470 * "rid" is the name of the resource.
473 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
474 #define GetResReq(name, rid, req) \
476 if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
478 req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
479 req->reqType = X_##name;\
482 dpy->bufptr += SIZEOF(xResourceReq);\
485 #define GetResReq(name, rid, req) \
487 if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
489 req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
490 req->reqType = X_/**/name;\
493 dpy->bufptr += SIZEOF(xResourceReq);\
498 * GetEmptyReq is for those requests that have no arguments
501 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
502 #define GetEmptyReq(name, req) \
504 if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
506 req = (xReq *) (dpy->last_req = dpy->bufptr);\
507 req->reqType = X_##name;\
509 dpy->bufptr += SIZEOF(xReq);\
512 #define GetEmptyReq(name, req) \
514 if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
516 req = (xReq *) (dpy->last_req = dpy->bufptr);\
517 req->reqType = X_/**/name;\
519 dpy->bufptr += SIZEOF(xReq);\
524 #define MakeBigReq(req,n) \
527 unsigned long _BRlen = req->length - 1; \
529 memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \
530 memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
531 memcpy(((char *)req) + 4, _BRdat, 4); \
532 Data32(dpy, (long *)&_BRdat, 4); \
535 #define MakeBigReq(req,n) \
538 CARD32 _BRlen = req->length - 1; \
540 _BRdat = ((CARD32 *)req)[_BRlen]; \
541 memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
542 ((CARD32 *)req)[1] = _BRlen + n + 2; \
543 Data32(dpy, &_BRdat, 4); \
547 #define SetReqLen(req,n,badlen) \
548 if ((req->length + n) > (unsigned)65535) { \
549 if (dpy->bigreq_size) { \
558 #define SyncHandle() \
559 if (dpy->synchandler) (*dpy->synchandler)(dpy)
561 extern void _XFlushGCCache();
562 #define FlushGC(dpy, gc) \
563 if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
565 * Data - Place data in the buffer and pad the end to provide
566 * 32 bit word alignment. Transmit if the buffer fills.
568 * "dpy" is a pointer to a Display.
569 * "data" is a pinter to a data buffer.
570 * "len" is the length of the data buffer.
572 #ifndef DataRoutineIsProcedure
573 #define Data(dpy, data, len) \
574 if (dpy->bufptr + (len) <= dpy->bufmax) {\
575 memcpy(dpy->bufptr, data, (int)len);\
576 dpy->bufptr += ((len) + 3) & ~3;\
578 _XSend(dpy, data, len)
579 #endif /* DataRoutineIsProcedure */
582 /* Allocate bytes from the buffer. No padding is done, so if
583 * the length is not a multiple of 4, the caller must be
584 * careful to leave the buffer aligned after sending the
587 * "type" is the type of the pointer being assigned to.
588 * "ptr" is the pointer being assigned to.
589 * "n" is the number of bytes to allocate.
593 * BufAlloc (xTextElt *, elt, nbytes)
596 #define BufAlloc(type, ptr, n) \
597 if (dpy->bufptr + (n) > dpy->bufmax) \
599 ptr = (type) dpy->bufptr; \
603 #define Data16(dpy, data, len) _XData16(dpy, (short *)data, len)
604 #define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
606 #define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
607 #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
608 #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
610 #define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
612 #define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
613 #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
615 #endif /* not WORD64 */
617 #define PackData16(dpy,data,len) Data16 (dpy, data, len)
618 #define PackData32(dpy,data,len) Data32 (dpy, data, len)
620 /* Xlib manual is bogus */
621 #define PackData(dpy,data,len) PackData16 (dpy, data, len)
623 #define min(a,b) (((a) < (b)) ? (a) : (b))
624 #define max(a,b) (((a) > (b)) ? (a) : (b))
626 #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
627 (((cs)->rbearing|(cs)->lbearing| \
628 (cs)->ascent|(cs)->descent) == 0))
631 * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
632 * character. If the character is in the column and exists, then return the
633 * appropriate metrics (note that fonts with common per-character metrics will
634 * return min_bounds). If none of these hold true, try again with the default
637 #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
640 if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
641 if (fs->per_char == NULL) { \
642 cs = &fs->min_bounds; \
644 cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
645 if (CI_NONEXISTCHAR(cs)) cs = def; \
650 #define CI_GET_DEFAULT_INFO_1D(fs,cs) \
651 CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
656 * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and
657 * column. This is used for fonts that have more than row zero.
659 #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
662 if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
663 col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
664 if (fs->per_char == NULL) { \
665 cs = &fs->min_bounds; \
667 cs = &fs->per_char[((row - fs->min_byte1) * \
668 (fs->max_char_or_byte2 - \
669 fs->min_char_or_byte2 + 1)) + \
670 (col - fs->min_char_or_byte2)]; \
671 if (CI_NONEXISTCHAR(cs)) cs = def; \
676 #define CI_GET_DEFAULT_INFO_2D(fs,cs) \
678 unsigned int r = (fs->default_char >> 8); \
679 unsigned int c = (fs->default_char & 0xff); \
680 CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
686 /* for when 32-bit alignment is not good enough */
687 #define OneDataCard32(dpy,dstaddr,srcvar) \
688 { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }
692 /* srcvar must be a variable for large architecture version */
693 #define OneDataCard32(dpy,dstaddr,srcvar) \
694 { *(CARD32 *)(dstaddr) = (srcvar); }
696 #endif /* MUSTCOPY */
698 typedef struct _XInternalAsync {
699 struct _XInternalAsync *next;
702 * rep is the generic reply that caused this handler
703 * to be invoked. It must also be passed to _XGetAsyncReply.
704 * buf and len are opaque values that must be passed to
705 * _XGetAsyncReply or _XGetAsyncData.
706 * data is the closure stored in this struct.
707 * The handler returns True iff it handled this reply.
710 #if NeedNestedPrototypes
721 typedef struct _XAsyncEState {
722 unsigned long min_sequence_number;
723 unsigned long max_sequence_number;
724 unsigned char error_code;
725 unsigned char major_opcode;
726 unsigned short minor_opcode;
727 unsigned char last_error_received;
731 extern void _XDeqAsyncHandler();
732 #define DeqAsyncHandler(dpy,handler) { \
733 if (dpy->async_handlers == (handler)) \
734 dpy->async_handlers = (handler)->next; \
736 _XDeqAsyncHandler(dpy, handler); \
740 * This structure is private to the library.
742 typedef struct _XFreeFuncs {
743 void (*atoms)(); /* _XFreeAtomTable */
744 int (*modifiermap)(); /* XFreeModifierMap */
745 void (*key_bindings)(); /* _XFreeKeyBindings */
746 void (*context_db)(); /* _XFreeContextDB */
747 void (*defaultCCCs)(); /* _XcmsFreeDefaultCCCs */
748 void (*clientCmaps)(); /* _XcmsFreeClientCmaps */
749 void (*intensityMaps)(); /* _XcmsFreeIntensityMaps */
750 void (*im_filters)(); /* _XFreeIMFilters */
751 void (*xkb)(); /* _XkbFreeInfo */
755 * This structure is private to the library.
757 typedef struct _XExten { /* private to extension mechanism */
758 struct _XExten *next; /* next in list */
759 XExtCodes codes; /* public information, all extension told */
760 int (*create_GC)(); /* routine to call when GC created */
761 int (*copy_GC)(); /* routine to call when GC copied */
762 int (*flush_GC)(); /* routine to call when GC flushed */
763 int (*free_GC)(); /* routine to call when GC freed */
764 int (*create_Font)(); /* routine to call when Font created */
765 int (*free_Font)(); /* routine to call when Font freed */
766 int (*close_display)(); /* routine to call when connection closed */
767 int (*error)(); /* who to call when an error occurs */
768 char *(*error_string)(); /* routine to supply error string */
769 char *name; /* name of this extension */
770 void (*error_values)(); /* routine to supply error values */
771 void (*before_flush)(); /* routine to call when sending data */
772 struct _XExten *next_flush; /* next in list of those with flushes */
775 /* extension hooks */
779 #ifdef DataRoutineIsProcedure
783 #if NeedFunctionPrototypes
788 extern int _XIOError(
789 #if NeedFunctionPrototypes
793 extern int (*_XIOErrorFunction)(
794 #if NeedNestedPrototypes
798 extern int (*_XErrorFunction)(
799 #if NeedNestedPrototypes
801 XErrorEvent* /* error_event */
804 extern void _XEatData(
805 #if NeedFunctionPrototypes
807 unsigned long /* n */
810 extern char *_XAllocScratch(
811 #if NeedFunctionPrototypes
813 unsigned long /* nbytes */
816 extern char *_XAllocTemp(
817 #if NeedFunctionPrototypes
819 unsigned long /* nbytes */
822 extern void _XFreeTemp(
823 #if NeedFunctionPrototypes
826 unsigned long /* nbytes */
829 extern Visual *_XVIDtoVisual(
830 #if NeedFunctionPrototypes
835 extern unsigned long _XSetLastRequestRead(
836 #if NeedFunctionPrototypes
838 xGenericReply* /* rep */
841 extern int _XGetHostname(
842 #if NeedFunctionPrototypes
847 extern Screen *_XScreenOfWindow(
848 #if NeedFunctionPrototypes
853 extern Bool _XAsyncErrorHandler(
854 #if NeedFunctionPrototypes
862 extern char *_XGetAsyncReply(
863 #if NeedFunctionPrototypes
874 #if NeedFunctionPrototypes
878 extern int _XEventsQueued(
879 #if NeedFunctionPrototypes
884 extern void _XReadEvents(
885 #if NeedFunctionPrototypes
890 #if NeedFunctionPrototypes
896 extern void _XReadPad(
897 #if NeedFunctionPrototypes
904 #if NeedFunctionPrototypes
906 _Xconst char* /* data */,
910 extern Status _XReply(
911 #if NeedFunctionPrototypes
919 #if NeedFunctionPrototypes
925 #if NeedFunctionPrototypes
927 _XQEvent* /* prev */,
932 extern int (*XESetCreateGC(
933 #if NeedFunctionPrototypes
934 Display* /* display */,
937 #if NeedNestedPrototypes
938 Display* /* display */,
940 XExtCodes* /* codes */
945 #if NeedNestedPrototypes
946 Display*, GC, XExtCodes*
950 extern int (*XESetCopyGC(
951 #if NeedFunctionPrototypes
952 Display* /* display */,
955 #if NeedNestedPrototypes
956 Display* /* display */,
958 XExtCodes* /* codes */
963 #if NeedNestedPrototypes
964 Display*, GC, XExtCodes*
968 extern int (*XESetFlushGC(
969 #if NeedFunctionPrototypes
970 Display* /* display */,
973 #if NeedNestedPrototypes
974 Display* /* display */,
976 XExtCodes* /* codes */
981 #if NeedNestedPrototypes
982 Display*, GC, XExtCodes*
986 extern int (*XESetFreeGC(
987 #if NeedFunctionPrototypes
988 Display* /* display */,
991 #if NeedNestedPrototypes
992 Display* /* display */,
994 XExtCodes* /* codes */
999 #if NeedNestedPrototypes
1000 Display*, GC, XExtCodes*
1004 extern int (*XESetCreateFont(
1005 #if NeedFunctionPrototypes
1006 Display* /* display */,
1007 int /* extension */,
1009 #if NeedNestedPrototypes
1010 Display* /* display */,
1011 XFontStruct* /* fs */,
1012 XExtCodes* /* codes */
1017 #if NeedNestedPrototypes
1018 Display*, XFontStruct*, XExtCodes*
1022 extern int (*XESetFreeFont(
1023 #if NeedFunctionPrototypes
1024 Display* /* display */,
1025 int /* extension */,
1027 #if NeedNestedPrototypes
1028 Display* /* display */,
1029 XFontStruct* /* fs */,
1030 XExtCodes* /* codes */
1035 #if NeedNestedPrototypes
1036 Display*, XFontStruct*, XExtCodes*
1040 extern int (*XESetCloseDisplay(
1041 #if NeedFunctionPrototypes
1042 Display* /* display */,
1043 int /* extension */,
1045 #if NeedNestedPrototypes
1046 Display* /* display */,
1047 XExtCodes* /* codes */
1052 #if NeedNestedPrototypes
1053 Display*, XExtCodes*
1057 extern int (*XESetError(
1058 #if NeedFunctionPrototypes
1059 Display* /* display */,
1060 int /* extension */,
1062 #if NeedNestedPrototypes
1063 Display* /* display */,
1065 XExtCodes* /* codes */,
1071 #if NeedNestedPrototypes
1072 Display*, xError*, XExtCodes*, int*
1076 extern char* (*XESetErrorString(
1077 #if NeedFunctionPrototypes
1078 Display* /* display */,
1079 int /* extension */,
1081 #if NeedNestedPrototypes
1082 Display* /* display */,
1084 XExtCodes* /* codes */,
1091 #if NeedNestedPrototypes
1092 Display*, int, XExtCodes*, char*, int
1096 extern void (*XESetPrintErrorValues (
1097 #if NeedFunctionPrototypes
1098 Display* /* display */,
1099 int /* extension */,
1101 #if NeedNestedPrototypes
1102 Display* /* display */,
1103 XErrorEvent* /* ev */,
1109 #if NeedNestedPrototypes
1110 Display*, XErrorEvent*, void*
1114 extern Bool (*XESetWireToEvent(
1115 #if NeedFunctionPrototypes
1116 Display* /* display */,
1117 int /* event_number */,
1119 #if NeedNestedPrototypes
1120 Display* /* display */,
1127 #if NeedNestedPrototypes
1128 Display*, XEvent*, xEvent*
1132 extern Status (*XESetEventToWire(
1133 #if NeedFunctionPrototypes
1134 Display* /* display */,
1135 int /* event_number */,
1137 #if NeedNestedPrototypes
1138 Display* /* display */,
1145 #if NeedNestedPrototypes
1146 Display*, XEvent*, xEvent*
1150 extern Bool (*XESetWireToError(
1151 #if NeedFunctionPrototypes
1152 Display* /* display */,
1153 int /* error_number */,
1155 #if NeedNestedPrototypes
1156 Display* /* display */,
1157 XErrorEvent* /* he */,
1163 #if NeedNestedPrototypes
1164 Display*, XErrorEvent*, xError*
1168 extern void (*XESetBeforeFlush(
1169 #if NeedFunctionPrototypes
1170 Display* /* display */,
1171 int /* error_number */,
1173 #if NeedNestedPrototypes
1174 Display* /* display */,
1175 XExtCodes* /* codes */,
1182 #if NeedNestedPrototypes
1183 Display*, XExtCodes*, char*, long
1187 /* internal connections for IMs */
1189 typedef void (*_XInternalConnectionProc)(
1190 #if NeedFunctionPrototypes
1193 XPointer /* call_data */
1198 extern Status _XRegisterInternalConnection(
1199 #if NeedFunctionPrototypes
1202 _XInternalConnectionProc /* callback */,
1203 XPointer /* call_data */
1207 extern void _XUnregisterInternalConnection(
1208 #if NeedFunctionPrototypes
1214 /* Display structure has pointers to these */
1216 struct _XConnectionInfo { /* info from _XRegisterInternalConnection */
1218 _XInternalConnectionProc read_callback;
1220 XPointer *watch_data; /* set/used by XConnectionWatchProc */
1221 struct _XConnectionInfo *next;
1224 struct _XConnWatchInfo { /* info from XAddConnectionWatch */
1225 XConnectionWatchProc fn;
1226 XPointer client_data;
1227 struct _XConnWatchInfo *next;
1231 extern char* __XOS2RedirRoot(
1232 #if NeedFunctionPrototypes
1238 extern int _XTextHeight(
1239 #if NeedFunctionPrototypes
1240 XFontStruct* /* font_struct */,
1241 _Xconst char* /* string */,
1246 extern int _XTextHeight16(
1247 #if NeedFunctionPrototypes
1248 XFontStruct* /* font_struct */,
1249 _Xconst XChar2b* /* string */,