File indexing completed on 2025-01-18 10:14:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #ifndef _X11_XLIBINT_H_
0031 #define _X11_XLIBINT_H_ 1
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 #include <stdint.h>
0042 #include <X11/Xlib.h>
0043 #include <X11/Xproto.h> /* to declare xEvent */
0044 #include <X11/XlibConf.h> /* for configured options like XTHREADS */
0045
0046 #ifdef XTHREADS
0047 #include <X11/Xthreads.h>
0048 #endif
0049
0050
0051
0052
0053 #ifdef __clang__
0054 #pragma clang diagnostic push
0055 #pragma clang diagnostic ignored "-Wpadded"
0056 #endif
0057
0058 #ifdef WIN32
0059 #define _XFlush _XFlushIt
0060 #endif
0061
0062 struct _XGC
0063 {
0064 XExtData *ext_data;
0065 GContext gid;
0066 Bool rects;
0067 Bool dashes;
0068 unsigned long dirty;
0069 XGCValues values;
0070 };
0071
0072 struct _XDisplay
0073 {
0074 XExtData *ext_data;
0075 struct _XFreeFuncs *free_funcs;
0076 int fd;
0077 int conn_checker;
0078 int proto_major_version;
0079 int proto_minor_version;
0080 char *vendor;
0081 XID resource_base;
0082 XID resource_mask;
0083 XID resource_id;
0084 int resource_shift;
0085 XID (*resource_alloc)(
0086 struct _XDisplay*
0087 );
0088 int byte_order;
0089 int bitmap_unit;
0090 int bitmap_pad;
0091 int bitmap_bit_order;
0092 int nformats;
0093 ScreenFormat *pixmap_format;
0094 int vnumber;
0095 int release;
0096 struct _XSQEvent *head, *tail;
0097 int qlen;
0098 unsigned long last_request_read;
0099 unsigned long request;
0100 char *last_req;
0101 char *buffer;
0102 char *bufptr;
0103 char *bufmax;
0104 unsigned max_request_size;
0105 struct _XrmHashBucketRec *db;
0106 int (*synchandler)(
0107 struct _XDisplay*
0108 );
0109 char *display_name;
0110 int default_screen;
0111 int nscreens;
0112 Screen *screens;
0113 unsigned long motion_buffer;
0114 volatile unsigned long flags;
0115 int min_keycode;
0116 int max_keycode;
0117 KeySym *keysyms;
0118 XModifierKeymap *modifiermap;
0119 int keysyms_per_keycode;
0120 char *xdefaults;
0121 char *scratch_buffer;
0122 unsigned long scratch_length;
0123 int ext_number;
0124 struct _XExten *ext_procs;
0125
0126
0127
0128
0129
0130
0131
0132
0133 Bool (*event_vec[128])(
0134 Display * ,
0135 XEvent * ,
0136 xEvent *
0137 );
0138 Status (*wire_vec[128])(
0139 Display * ,
0140 XEvent * ,
0141 xEvent *
0142 );
0143 KeySym lock_meaning;
0144 struct _XLockInfo *lock;
0145 struct _XInternalAsync *async_handlers;
0146 unsigned long bigreq_size;
0147 struct _XLockPtrs *lock_fns;
0148 void (*idlist_alloc)(
0149 Display * ,
0150 XID * ,
0151 int
0152 );
0153
0154 struct _XKeytrans *key_bindings;
0155 Font cursor_font;
0156 struct _XDisplayAtoms *atoms;
0157 unsigned int mode_switch;
0158 unsigned int num_lock;
0159 struct _XContextDB *context_db;
0160 Bool (**error_vec)(
0161 Display * ,
0162 XErrorEvent * ,
0163 xError *
0164 );
0165
0166
0167
0168 struct {
0169 XPointer defaultCCCs;
0170 XPointer clientCmaps;
0171 XPointer perVisualIntensityMaps;
0172
0173 } cms;
0174 struct _XIMFilter *im_filters;
0175 struct _XSQEvent *qfree;
0176 unsigned long next_event_serial_num;
0177 struct _XExten *flushes;
0178 struct _XConnectionInfo *im_fd_info;
0179 int im_fd_length;
0180 struct _XConnWatchInfo *conn_watchers;
0181 int watcher_count;
0182 XPointer filedes;
0183 int (*savedsynchandler)(
0184 Display *
0185 );
0186 XID resource_max;
0187 int xcmisc_opcode;
0188 struct _XkbInfoRec *xkb_info;
0189 struct _XtransConnInfo *trans_conn;
0190 struct _X11XCBPrivate *xcb;
0191
0192
0193 unsigned int next_cookie;
0194
0195 Bool (*generic_event_vec[128])(
0196 Display * ,
0197 XGenericEventCookie * ,
0198 xEvent * );
0199
0200 Bool (*generic_event_copy_vec[128])(
0201 Display * ,
0202 XGenericEventCookie * ,
0203 XGenericEventCookie * );
0204 void *cookiejar;
0205 #ifndef LONG64
0206 unsigned long last_request_read_upper32bit;
0207 unsigned long request_upper32bit;
0208 #endif
0209
0210 struct _XErrorThreadInfo *error_threads;
0211
0212 XIOErrorExitHandler exit_handler;
0213 void *exit_handler_data;
0214 CARD32 in_ifevent;
0215 #ifdef XTHREADS
0216 xthread_t ifevent_thread;
0217 #endif
0218 };
0219
0220 #define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
0221
0222
0223
0224
0225
0226
0227 #ifndef LONG64
0228
0229
0230 #define X_DPY_GET_REQUEST(dpy) \
0231 ( \
0232 ((uint64_t)(((struct _XDisplay*)dpy)->request)) \
0233 + (((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) << 32) \
0234 )
0235
0236 #define X_DPY_SET_REQUEST(dpy, value) \
0237 ( \
0238 (((struct _XDisplay*)dpy)->request = \
0239 (value) & 0xFFFFFFFFUL), \
0240 (((struct _XDisplay*)dpy)->request_upper32bit = \
0241 ((uint64_t)(value)) >> 32), \
0242 (void)0 \
0243 )
0244
0245 #define X_DPY_GET_LAST_REQUEST_READ(dpy) \
0246 ( \
0247 ((uint64_t)(((struct _XDisplay*)dpy)->last_request_read)) \
0248 + ( \
0249 ((uint64_t)( \
0250 ((struct _XDisplay*)dpy)->last_request_read_upper32bit \
0251 )) << 32 \
0252 ) \
0253 )
0254
0255 #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
0256 ( \
0257 (((struct _XDisplay*)dpy)->last_request_read = \
0258 (value) & 0xFFFFFFFFUL), \
0259 (((struct _XDisplay*)dpy)->last_request_read_upper32bit = \
0260 ((uint64_t)(value)) >> 32), \
0261 (void)0 \
0262 )
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274 #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) \
0275 ( \
0276 ((uint64_t)ulseq) \
0277 + \
0278 (( \
0279 ((uint64_t)(((struct _XDisplay*)dpy)->request_upper32bit)) \
0280 - (uint64_t)( \
0281 (ulseq) > (((struct _XDisplay*)dpy)->request) \
0282 ) \
0283 ) << 32) \
0284 )
0285
0286 #define X_DPY_REQUEST_INCREMENT(dpy) \
0287 ( \
0288 ((struct _XDisplay*)dpy)->request++, \
0289 ( \
0290 (((struct _XDisplay*)dpy)->request == 0) ? ( \
0291 ((struct _XDisplay*)dpy)->request_upper32bit++ \
0292 ) : 0 \
0293 ), \
0294 (void)0 \
0295 )
0296
0297
0298 #define X_DPY_REQUEST_DECREMENT(dpy) \
0299 ( \
0300 ( \
0301 (((struct _XDisplay*)dpy)->request == 0) ? (\
0302 ((struct _XDisplay*)dpy)->request--, \
0303 ((struct _XDisplay*)dpy)->request_upper32bit-- \
0304 ) : ( \
0305 ((struct _XDisplay*)dpy)->request-- \
0306 ) \
0307 ), \
0308 (void)0 \
0309 )
0310
0311 #else
0312
0313 #define X_DPY_GET_REQUEST(dpy) \
0314 (((struct _XDisplay*)dpy)->request)
0315 #define X_DPY_SET_REQUEST(dpy, value) \
0316 ((struct _XDisplay*)dpy)->request = (value)
0317
0318 #define X_DPY_GET_LAST_REQUEST_READ(dpy) \
0319 (((struct _XDisplay*)dpy)->last_request_read)
0320 #define X_DPY_SET_LAST_REQUEST_READ(dpy, value) \
0321 ((struct _XDisplay*)dpy)->last_request_read = (value)
0322
0323 #define X_DPY_WIDEN_UNSIGNED_LONG_SEQ(dpy, ulseq) ulseq
0324
0325 #define X_DPY_REQUEST_INCREMENT(dpy) ((struct _XDisplay*)dpy)->request++
0326 #define X_DPY_REQUEST_DECREMENT(dpy) ((struct _XDisplay*)dpy)->request--
0327 #endif
0328
0329
0330 #ifndef _XEVENT_
0331
0332
0333
0334 typedef struct _XSQEvent
0335 {
0336 struct _XSQEvent *next;
0337 XEvent event;
0338 unsigned long qserial_num;
0339 } _XQEvent;
0340 #endif
0341
0342 #include <X11/Xproto.h>
0343 #include <errno.h>
0344 #define _XBCOPYFUNC _Xbcopy
0345 #include <X11/Xfuncs.h>
0346 #include <X11/Xosdefs.h>
0347
0348
0349 #ifdef dirty
0350 #undef dirty
0351 #endif
0352
0353 #include <stdlib.h>
0354 #include <string.h>
0355
0356 #include <X11/Xfuncproto.h>
0357
0358 _XFUNCPROTOBEGIN
0359
0360
0361
0362
0363
0364 #ifdef XTHREADS
0365
0366
0367
0368
0369
0370 typedef struct _LockInfoRec *LockInfoPtr;
0371
0372
0373 struct _XLockPtrs {
0374
0375 void (*lock_display)(
0376 Display *dpy
0377 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
0378 , char *file
0379 , int line
0380 #endif
0381 );
0382 void (*unlock_display)(
0383 Display *dpy
0384 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
0385 , char *file
0386 , int line
0387 #endif
0388 );
0389 };
0390
0391 #if defined(WIN32) && !defined(_XLIBINT_)
0392 #define _XCreateMutex_fn (*_XCreateMutex_fn_p)
0393 #define _XFreeMutex_fn (*_XFreeMutex_fn_p)
0394 #define _XLockMutex_fn (*_XLockMutex_fn_p)
0395 #define _XUnlockMutex_fn (*_XUnlockMutex_fn_p)
0396 #define _Xglobal_lock (*_Xglobal_lock_p)
0397 #endif
0398
0399
0400 extern void (*_XCreateMutex_fn)(
0401 LockInfoPtr
0402 );
0403 extern void (*_XFreeMutex_fn)(
0404 LockInfoPtr
0405 );
0406 extern void (*_XLockMutex_fn)(
0407 LockInfoPtr
0408 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
0409 , char *
0410 , int
0411 #endif
0412 );
0413 extern void (*_XUnlockMutex_fn)(
0414 LockInfoPtr
0415 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
0416 , char *
0417 , int
0418 #endif
0419 );
0420
0421 extern LockInfoPtr _Xglobal_lock;
0422
0423 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
0424 #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
0425 #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
0426 #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
0427 #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
0428 #else
0429
0430 #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
0431 #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
0432 #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
0433 #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
0434 #endif
0435 #define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
0436 #define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
0437
0438 #else
0439 #define LockDisplay(dis)
0440 #define _XLockMutex(lock)
0441 #define _XUnlockMutex(lock)
0442 #define UnlockDisplay(dis)
0443 #define _XCreateMutex(lock)
0444 #define _XFreeMutex(lock)
0445 #endif
0446
0447 #define Xfree(ptr) free((ptr))
0448
0449
0450
0451
0452
0453
0454
0455 #if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__)
0456
0457 # define Xmalloc(size) malloc((size_t)((size) == 0 ? 1 : (size)))
0458 # define Xrealloc(ptr, size) realloc((ptr), (size_t)((size) == 0 ? 1 : (size)))
0459 # define Xcalloc(nelem, elsize) calloc((size_t)((nelem) == 0 ? 1 : (nelem)), (size_t)(elsize))
0460
0461 #else
0462
0463 # define Xmalloc(size) malloc((size_t)(size))
0464 # define Xrealloc(ptr, size) realloc((ptr), (size_t)(size))
0465 # define Xcalloc(nelem, elsize) calloc((size_t)(nelem), (size_t)(elsize))
0466
0467 #endif
0468
0469 #include <stddef.h>
0470
0471 #define LOCKED 1
0472 #define UNLOCKED 0
0473
0474 #ifndef BUFSIZE
0475 #define BUFSIZE 2048
0476 #endif
0477 #ifndef PTSPERBATCH
0478 #define PTSPERBATCH 1024
0479 #endif
0480 #ifndef WLNSPERBATCH
0481 #define WLNSPERBATCH 50
0482 #endif
0483 #ifndef ZLNSPERBATCH
0484 #define ZLNSPERBATCH 1024
0485 #endif
0486 #ifndef WRCTSPERBATCH
0487 #define WRCTSPERBATCH 10
0488 #endif
0489 #ifndef ZRCTSPERBATCH
0490 #define ZRCTSPERBATCH 256
0491 #endif
0492 #ifndef FRCTSPERBATCH
0493 #define FRCTSPERBATCH 256
0494 #endif
0495 #ifndef FARCSPERBATCH
0496 #define FARCSPERBATCH 256
0497 #endif
0498 #ifndef CURSORFONT
0499 #define CURSORFONT "cursor"
0500 #endif
0501
0502
0503
0504
0505 #define XlibDisplayIOError (1L << 0)
0506 #define XlibDisplayClosing (1L << 1)
0507 #define XlibDisplayNoXkb (1L << 2)
0508 #define XlibDisplayPrivSync (1L << 3)
0509 #define XlibDisplayProcConni (1L << 4)
0510 #define XlibDisplayReadEvents (1L << 5)
0511 #define XlibDisplayReply (1L << 5)
0512 #define XlibDisplayWriting (1L << 6)
0513 #define XlibDisplayDfltRMDB (1L << 7)
0514
0515
0516
0517
0518
0519
0520 #define WORD64ALIGN
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533 extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len);
0534
0535
0536
0537
0538 #define GetReqSized(name, sz, req) \
0539 req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz)
0540
0541
0542
0543
0544
0545
0546
0547
0548
0549
0550 #define GetReq(name, req) \
0551 GetReqSized(name, SIZEOF(x##name##Req), req)
0552
0553
0554
0555
0556 #define GetReqExtra(name, n, req) \
0557 GetReqSized(name, SIZEOF(x##name##Req) + n, req)
0558
0559
0560
0561
0562
0563
0564
0565 #define GetResReq(name, rid, req) \
0566 req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \
0567 if (req) req->id = (rid)
0568
0569
0570
0571
0572
0573
0574 #define GetEmptyReq(name, req) \
0575 req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq))
0576
0577
0578
0579
0580
0581
0582
0583
0584
0585 #ifdef LONG64
0586 #define MakeBigReq(req,n) \
0587 { \
0588 CARD64 _BRdat; \
0589 CARD32 _BRlen = (CARD32) (req->length - 1); \
0590 req->length = 0; \
0591 _BRdat = ((CARD32 *)req)[_BRlen]; \
0592 memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \
0593 ((CARD32 *)req)[1] = _BRlen + (CARD32) (n) + 2; \
0594 Data32(dpy, &_BRdat, 4); \
0595 }
0596 #else
0597 #define MakeBigReq(req,n) \
0598 { \
0599 CARD32 _BRdat; \
0600 CARD32 _BRlen = req->length - 1; \
0601 req->length = 0; \
0602 _BRdat = ((CARD32 *)req)[_BRlen]; \
0603 memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \
0604 ((CARD32 *)req)[1] = _BRlen + (CARD32) (n) + 2; \
0605 Data32(dpy, &_BRdat, 4); \
0606 }
0607 #endif
0608
0609
0610
0611
0612
0613
0614
0615
0616 #ifndef __clang_analyzer__
0617 #define SetReqLen(req,n,badlen) \
0618 if ((req->length + n) > (unsigned)65535) { \
0619 if (dpy->bigreq_size) { \
0620 MakeBigReq(req,n) \
0621 } else { \
0622 n = badlen; \
0623 req->length = (CARD16) (req->length + n); \
0624 } \
0625 } else \
0626 req->length = (CARD16) (req->length + n)
0627 #else
0628 #define SetReqLen(req,n,badlen) \
0629 req->length += n
0630 #endif
0631
0632 #define SyncHandle() \
0633 if (dpy->synchandler) (*dpy->synchandler)(dpy)
0634
0635 extern void _XFlushGCCache(Display *dpy, GC gc);
0636 #define FlushGC(dpy, gc) \
0637 if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
0638
0639
0640
0641
0642
0643
0644
0645
0646 #ifndef DataRoutineIsProcedure
0647 #define Data(dpy, data, len) {\
0648 if (dpy->bufptr + (len) <= dpy->bufmax) {\
0649 memcpy(dpy->bufptr, data, (size_t)(len));\
0650 dpy->bufptr += ((size_t)((len) + 3) & (size_t)~3);\
0651 } else\
0652 _XSend(dpy, (_Xconst char*)(data), (long)(len));\
0653 }
0654 #endif
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671 #define BufAlloc(type, ptr, n) \
0672 if (dpy->bufptr + (n) > dpy->bufmax) \
0673 _XFlush (dpy); \
0674 ptr = (type) dpy->bufptr; \
0675 memset(ptr, '\0', (size_t)(n)); \
0676 dpy->bufptr += (n);
0677
0678 #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
0679 #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
0680 #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
0681 #ifdef LONG64
0682 #define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)(data), (unsigned)(len))
0683 extern int _XData32(
0684 Display *dpy,
0685 _Xconst long *data,
0686 unsigned len
0687 );
0688 extern void _XRead32(
0689 Display *dpy,
0690 long *data,
0691 long len
0692 );
0693 #else
0694 #define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (long)(len))
0695 #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
0696 #endif
0697
0698 #define PackData16(dpy,data,len) Data16 (dpy, data, len)
0699 #define PackData32(dpy,data,len) Data32 (dpy, data, len)
0700
0701
0702 #define PackData(dpy,data,len) PackData16 (dpy, data, len)
0703
0704 #define min(a,b) (((a) < (b)) ? (a) : (b))
0705 #define max(a,b) (((a) > (b)) ? (a) : (b))
0706
0707 #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
0708 (((cs)->rbearing|(cs)->lbearing| \
0709 (cs)->ascent|(cs)->descent) == 0))
0710
0711
0712
0713
0714
0715
0716
0717
0718 #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
0719 { \
0720 cs = def; \
0721 if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
0722 if (fs->per_char == NULL) { \
0723 cs = &fs->min_bounds; \
0724 } else { \
0725 cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
0726 if (CI_NONEXISTCHAR(cs)) cs = def; \
0727 } \
0728 } \
0729 }
0730
0731 #define CI_GET_DEFAULT_INFO_1D(fs,cs) \
0732 CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
0733
0734
0735
0736
0737
0738
0739
0740 #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
0741 { \
0742 cs = def; \
0743 if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
0744 col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
0745 if (fs->per_char == NULL) { \
0746 cs = &fs->min_bounds; \
0747 } else { \
0748 cs = &fs->per_char[((row - fs->min_byte1) * \
0749 (fs->max_char_or_byte2 - \
0750 fs->min_char_or_byte2 + 1)) + \
0751 (col - fs->min_char_or_byte2)]; \
0752 if (CI_NONEXISTCHAR(cs)) cs = def; \
0753 } \
0754 } \
0755 }
0756
0757 #define CI_GET_DEFAULT_INFO_2D(fs,cs) \
0758 { \
0759 unsigned int r = (fs->default_char >> 8); \
0760 unsigned int c = (fs->default_char & 0xff); \
0761 CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
0762 }
0763
0764
0765
0766 #define OneDataCard32(dpy,dstaddr,srcvar) \
0767 { *(CARD32 *)(dstaddr) = (srcvar); }
0768
0769
0770 typedef struct _XInternalAsync {
0771 struct _XInternalAsync *next;
0772
0773
0774
0775
0776
0777
0778
0779
0780
0781 Bool (*handler)(
0782 Display* ,
0783 xReply* ,
0784 char* ,
0785 int ,
0786 XPointer
0787 );
0788 XPointer data;
0789 } _XAsyncHandler;
0790
0791
0792
0793
0794
0795
0796 typedef struct _XAsyncEState {
0797 unsigned long min_sequence_number;
0798 unsigned long max_sequence_number;
0799 unsigned char error_code;
0800 unsigned char major_opcode;
0801 unsigned short minor_opcode;
0802 unsigned char last_error_received;
0803 int error_count;
0804 } _XAsyncErrorState;
0805
0806 extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler);
0807 #define DeqAsyncHandler(dpy,handler) { \
0808 if (dpy->async_handlers == (handler)) \
0809 dpy->async_handlers = (handler)->next; \
0810 else \
0811 _XDeqAsyncHandler(dpy, handler); \
0812 }
0813
0814 typedef void (*FreeFuncType) (
0815 Display*
0816 );
0817
0818 typedef int (*FreeModmapType) (
0819 XModifierKeymap*
0820 );
0821
0822
0823
0824
0825 typedef struct _XFreeFuncs {
0826 FreeFuncType atoms;
0827 FreeModmapType modifiermap;
0828 FreeFuncType key_bindings;
0829 FreeFuncType context_db;
0830 FreeFuncType defaultCCCs;
0831 FreeFuncType clientCmaps;
0832 FreeFuncType intensityMaps;
0833 FreeFuncType im_filters;
0834 FreeFuncType xkb;
0835 } _XFreeFuncRec;
0836
0837
0838 typedef int (*CreateGCType) (
0839 Display* ,
0840 GC ,
0841 XExtCodes*
0842 );
0843
0844 typedef int (*CopyGCType)(
0845 Display* ,
0846 GC ,
0847 XExtCodes*
0848 );
0849
0850 typedef int (*FlushGCType) (
0851 Display* ,
0852 GC ,
0853 XExtCodes*
0854 );
0855
0856 typedef int (*FreeGCType) (
0857 Display* ,
0858 GC ,
0859 XExtCodes*
0860 );
0861
0862 typedef int (*CreateFontType) (
0863 Display* ,
0864 XFontStruct* ,
0865 XExtCodes*
0866 );
0867
0868 typedef int (*FreeFontType) (
0869 Display* ,
0870 XFontStruct* ,
0871 XExtCodes*
0872 );
0873
0874 typedef int (*CloseDisplayType) (
0875 Display* ,
0876 XExtCodes*
0877 );
0878
0879 typedef int (*ErrorType) (
0880 Display* ,
0881 xError* ,
0882 XExtCodes* ,
0883 int*
0884 );
0885
0886 typedef char* (*ErrorStringType) (
0887 Display* ,
0888 int ,
0889 XExtCodes* ,
0890 char* ,
0891 int
0892 );
0893
0894 typedef void (*PrintErrorType)(
0895 Display* ,
0896 XErrorEvent* ,
0897 void*
0898 );
0899
0900 typedef void (*BeforeFlushType)(
0901 Display* ,
0902 XExtCodes* ,
0903 _Xconst char* ,
0904 long
0905 );
0906
0907
0908
0909
0910 typedef struct _XExten {
0911 struct _XExten *next;
0912 XExtCodes codes;
0913 CreateGCType create_GC;
0914 CopyGCType copy_GC;
0915 FlushGCType flush_GC;
0916 FreeGCType free_GC;
0917 CreateFontType create_Font;
0918 FreeFontType free_Font;
0919 CloseDisplayType close_display;
0920 ErrorType error;
0921 ErrorStringType error_string;
0922 char *name;
0923 PrintErrorType error_values;
0924 BeforeFlushType before_flush;
0925 struct _XExten *next_flush;
0926 } _XExtension;
0927
0928
0929
0930 #ifdef DataRoutineIsProcedure
0931 extern void Data(Display *dpy, char *data, long len);
0932 #endif
0933 extern int _XError(
0934 Display* ,
0935 xError*
0936 );
0937 extern int _XIOError(
0938 Display*
0939 );
0940 extern int (*_XIOErrorFunction)(
0941 Display*
0942 );
0943 extern int (*_XErrorFunction)(
0944 Display* ,
0945 XErrorEvent*
0946 );
0947 extern void _XEatData(
0948 Display* ,
0949 unsigned long
0950 ) _X_COLD;
0951 extern void _XEatDataWords(
0952 Display* ,
0953 unsigned long
0954 ) _X_COLD;
0955 #if defined(__SUNPRO_C)
0956 # pragma rarely_called(_XEatData, _XEatDataWords)
0957 #endif
0958 extern char *_XAllocScratch(
0959 Display* ,
0960 unsigned long
0961 );
0962 extern char *_XAllocTemp(
0963 Display* ,
0964 unsigned long
0965 );
0966 extern void _XFreeTemp(
0967 Display* ,
0968 char* ,
0969 unsigned long
0970 );
0971 extern Visual *_XVIDtoVisual(
0972 Display* ,
0973 VisualID
0974 );
0975 extern unsigned long _XSetLastRequestRead(
0976 Display* ,
0977 xGenericReply*
0978 );
0979 extern int _XGetHostname(
0980 char* ,
0981 int
0982 );
0983 extern Screen *_XScreenOfWindow(
0984 Display* ,
0985 Window
0986 );
0987 extern Bool _XAsyncErrorHandler(
0988 Display* ,
0989 xReply* ,
0990 char* ,
0991 int ,
0992 XPointer
0993 );
0994 extern char *_XGetAsyncReply(
0995 Display* ,
0996 char* ,
0997 xReply* ,
0998 char* ,
0999 int ,
1000 int ,
1001 Bool
1002 );
1003 extern void _XGetAsyncData(
1004 Display* ,
1005 char * ,
1006 char * ,
1007 int ,
1008 int ,
1009 int ,
1010 int
1011 );
1012 extern void _XFlush(
1013 Display*
1014 );
1015 extern int _XEventsQueued(
1016 Display* ,
1017 int
1018 );
1019 extern void _XReadEvents(
1020 Display*
1021 );
1022 extern int _XRead(
1023 Display* ,
1024 char* ,
1025 long
1026 );
1027 extern void _XReadPad(
1028 Display* ,
1029 char* ,
1030 long
1031 );
1032 extern void _XSend(
1033 Display* ,
1034 _Xconst char* ,
1035 long
1036 );
1037 extern Status _XReply(
1038 Display* ,
1039 xReply* ,
1040 int ,
1041 Bool
1042 );
1043 extern void _XEnq(
1044 Display* ,
1045 xEvent*
1046 );
1047 extern void _XDeq(
1048 Display* ,
1049 _XQEvent* ,
1050 _XQEvent*
1051 );
1052
1053 extern Bool _XUnknownWireEvent(
1054 Display* ,
1055 XEvent* ,
1056 xEvent*
1057 );
1058
1059 extern Bool _XUnknownWireEventCookie(
1060 Display* ,
1061 XGenericEventCookie* ,
1062 xEvent*
1063 );
1064
1065 extern Bool _XUnknownCopyEventCookie(
1066 Display* ,
1067 XGenericEventCookie* ,
1068 XGenericEventCookie*
1069 );
1070
1071 extern Status _XUnknownNativeEvent(
1072 Display* ,
1073 XEvent* ,
1074 xEvent*
1075 );
1076
1077 extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event);
1078 extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we);
1079 extern Bool _XPollfdCacheInit(Display *dpy);
1080 extern void _XPollfdCacheAdd(Display *dpy, int fd);
1081 extern void _XPollfdCacheDel(Display *dpy, int fd);
1082 extern XID _XAllocID(Display *dpy);
1083 extern void _XAllocIDs(Display *dpy, XID *ids, int count);
1084
1085 extern int _XFreeExtData(
1086 XExtData*
1087 );
1088
1089 extern int (*XESetCreateGC(
1090 Display* ,
1091 int ,
1092 int (*) (
1093 Display* ,
1094 GC ,
1095 XExtCodes*
1096 )
1097 ))(
1098 Display*, GC, XExtCodes*
1099 );
1100
1101 extern int (*XESetCopyGC(
1102 Display* ,
1103 int ,
1104 int (*) (
1105 Display* ,
1106 GC ,
1107 XExtCodes*
1108 )
1109 ))(
1110 Display*, GC, XExtCodes*
1111 );
1112
1113 extern int (*XESetFlushGC(
1114 Display* ,
1115 int ,
1116 int (*) (
1117 Display* ,
1118 GC ,
1119 XExtCodes*
1120 )
1121 ))(
1122 Display*, GC, XExtCodes*
1123 );
1124
1125 extern int (*XESetFreeGC(
1126 Display* ,
1127 int ,
1128 int (*) (
1129 Display* ,
1130 GC ,
1131 XExtCodes*
1132 )
1133 ))(
1134 Display*, GC, XExtCodes*
1135 );
1136
1137 extern int (*XESetCreateFont(
1138 Display* ,
1139 int ,
1140 int (*) (
1141 Display* ,
1142 XFontStruct* ,
1143 XExtCodes*
1144 )
1145 ))(
1146 Display*, XFontStruct*, XExtCodes*
1147 );
1148
1149 extern int (*XESetFreeFont(
1150 Display* ,
1151 int ,
1152 int (*) (
1153 Display* ,
1154 XFontStruct* ,
1155 XExtCodes*
1156 )
1157 ))(
1158 Display*, XFontStruct*, XExtCodes*
1159 );
1160
1161 extern int (*XESetCloseDisplay(
1162 Display* ,
1163 int ,
1164 int (*) (
1165 Display* ,
1166 XExtCodes*
1167 )
1168 ))(
1169 Display*, XExtCodes*
1170 );
1171
1172 extern int (*XESetError(
1173 Display* ,
1174 int ,
1175 int (*) (
1176 Display* ,
1177 xError* ,
1178 XExtCodes* ,
1179 int*
1180 )
1181 ))(
1182 Display*, xError*, XExtCodes*, int*
1183 );
1184
1185 extern char* (*XESetErrorString(
1186 Display* ,
1187 int ,
1188 char* (*) (
1189 Display* ,
1190 int ,
1191 XExtCodes* ,
1192 char* ,
1193 int
1194 )
1195 ))(
1196 Display*, int, XExtCodes*, char*, int
1197 );
1198
1199 extern void (*XESetPrintErrorValues (
1200 Display* ,
1201 int ,
1202 void (*)(
1203 Display* ,
1204 XErrorEvent* ,
1205 void*
1206 )
1207 ))(
1208 Display*, XErrorEvent*, void*
1209 );
1210
1211 extern Bool (*XESetWireToEvent(
1212 Display* ,
1213 int ,
1214 Bool (*) (
1215 Display* ,
1216 XEvent* ,
1217 xEvent*
1218 )
1219 ))(
1220 Display*, XEvent*, xEvent*
1221 );
1222
1223 extern Bool (*XESetWireToEventCookie(
1224 Display* ,
1225 int ,
1226 Bool (*) (
1227 Display* ,
1228 XGenericEventCookie* ,
1229 xEvent*
1230 )
1231 ))(
1232 Display*, XGenericEventCookie*, xEvent*
1233 );
1234
1235 extern Bool (*XESetCopyEventCookie(
1236 Display* ,
1237 int ,
1238 Bool (*) (
1239 Display* ,
1240 XGenericEventCookie* ,
1241 XGenericEventCookie*
1242 )
1243 ))(
1244 Display*, XGenericEventCookie*, XGenericEventCookie*
1245 );
1246
1247
1248 extern Status (*XESetEventToWire(
1249 Display* ,
1250 int ,
1251 Status (*) (
1252 Display* ,
1253 XEvent* ,
1254 xEvent*
1255 )
1256 ))(
1257 Display*, XEvent*, xEvent*
1258 );
1259
1260 extern Bool (*XESetWireToError(
1261 Display* ,
1262 int ,
1263 Bool (*) (
1264 Display* ,
1265 XErrorEvent* ,
1266 xError*
1267 )
1268 ))(
1269 Display*, XErrorEvent*, xError*
1270 );
1271
1272 extern void (*XESetBeforeFlush(
1273 Display* ,
1274 int ,
1275 void (*) (
1276 Display* ,
1277 XExtCodes* ,
1278 _Xconst char* ,
1279 long
1280 )
1281 ))(
1282 Display*, XExtCodes*, _Xconst char*, long
1283 );
1284
1285
1286
1287 typedef void (*_XInternalConnectionProc)(
1288 Display* ,
1289 int ,
1290 XPointer
1291 );
1292
1293
1294 extern Status _XRegisterInternalConnection(
1295 Display* ,
1296 int ,
1297 _XInternalConnectionProc ,
1298 XPointer
1299 );
1300
1301 extern void _XUnregisterInternalConnection(
1302 Display* ,
1303 int
1304 );
1305
1306 extern void _XProcessInternalConnection(
1307 Display* ,
1308 struct _XConnectionInfo*
1309 );
1310
1311
1312
1313 struct _XConnectionInfo {
1314 int fd;
1315 _XInternalConnectionProc read_callback;
1316 XPointer call_data;
1317 XPointer *watch_data;
1318 struct _XConnectionInfo *next;
1319 };
1320
1321 struct _XConnWatchInfo {
1322 XConnectionWatchProc fn;
1323 XPointer client_data;
1324 struct _XConnWatchInfo *next;
1325 };
1326
1327 extern int _XTextHeight(
1328 XFontStruct* ,
1329 _Xconst char* ,
1330 int
1331 );
1332
1333 extern int _XTextHeight16(
1334 XFontStruct* ,
1335 _Xconst XChar2b* ,
1336 int
1337 );
1338
1339 #if defined(WIN32)
1340
1341 extern int _XOpenFile(
1342 _Xconst char* ,
1343 int
1344 );
1345
1346 extern int _XOpenFileMode(
1347 _Xconst char* ,
1348 int ,
1349 mode_t
1350 );
1351
1352 extern void* _XFopenFile(
1353 _Xconst char* ,
1354 _Xconst char*
1355 );
1356
1357 extern int _XAccessFile(
1358 _Xconst char*
1359 );
1360 #else
1361 #define _XOpenFile(path,flags) open(path,flags)
1362 #define _XOpenFileMode(path,flags,mode) open(path,flags,mode)
1363 #define _XFopenFile(path,mode) fopen(path,mode)
1364 #endif
1365
1366
1367 extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event);
1368
1369 extern int _XF86LoadQueryLocaleFont(
1370 Display* ,
1371 _Xconst char* ,
1372 XFontStruct** ,
1373 Font*
1374 );
1375
1376 extern void _XProcessWindowAttributes (
1377 Display *dpy,
1378 xChangeWindowAttributesReq *req,
1379 unsigned long valuemask,
1380 XSetWindowAttributes *attributes);
1381
1382 extern int _XDefaultError(
1383 Display *dpy,
1384 XErrorEvent *event);
1385
1386 extern int _XDefaultIOError(
1387 Display *dpy);
1388
1389 extern void _XDefaultIOErrorExit(
1390 Display *dpy,
1391 void *user_data);
1392
1393 extern void _XSetClipRectangles (
1394 Display *dpy,
1395 GC gc,
1396 int clip_x_origin, int clip_y_origin,
1397 XRectangle *rectangles,
1398 int n,
1399 int ordering);
1400
1401 Status _XGetWindowAttributes(
1402 Display *dpy,
1403 Window w,
1404 XWindowAttributes *attr);
1405
1406 int _XPutBackEvent (
1407 Display *dpy,
1408 XEvent *event);
1409
1410 extern Bool _XIsEventCookie(
1411 Display *dpy,
1412 XEvent *ev);
1413
1414 extern void _XFreeEventCookies(
1415 Display *dpy);
1416
1417 extern void _XStoreEventCookie(
1418 Display *dpy,
1419 XEvent *ev);
1420
1421 extern Bool _XFetchEventCookie(
1422 Display *dpy,
1423 XGenericEventCookie *ev);
1424
1425 extern Bool _XCopyEventCookie(
1426 Display *dpy,
1427 XGenericEventCookie *in,
1428 XGenericEventCookie *out);
1429
1430
1431
1432 extern void xlocaledir(
1433 char *buf,
1434 int buf_len
1435 );
1436
1437 #ifdef __clang__
1438 #pragma clang diagnostic pop
1439 #endif
1440
1441 _XFUNCPROTOEND
1442
1443 #endif