comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/X11/Xlibint.h @ 69:33d812a61356

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