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

source code of include/X11/Xlibint.h