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