File indexing completed on 2025-09-15 09:15:20
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) do {\
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 } while (0)
0654 #endif
0655
0656
0657
0658
0659
0660
0661
0662
0663
0664
0665
0666
0667
0668
0669
0670
0671 #define BufAlloc(type, ptr, n) do { \
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 } while (0)
0678
0679 #define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len))
0680 #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
0681 #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
0682 #ifdef LONG64
0683 #define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)(data), (unsigned)(len))
0684 extern int _XData32(
0685 Display *dpy,
0686 _Xconst long *data,
0687 unsigned len
0688 );
0689 extern void _XRead32(
0690 Display *dpy,
0691 long *data,
0692 long len
0693 );
0694 #else
0695 #define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (long)(len))
0696 #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
0697 #endif
0698
0699 #define PackData16(dpy,data,len) Data16 (dpy, data, len)
0700 #define PackData32(dpy,data,len) Data32 (dpy, data, len)
0701
0702
0703 #define PackData(dpy,data,len) PackData16 (dpy, data, len)
0704
0705 #define min(a,b) (((a) < (b)) ? (a) : (b))
0706 #define max(a,b) (((a) > (b)) ? (a) : (b))
0707
0708 #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
0709 (((cs)->rbearing|(cs)->lbearing| \
0710 (cs)->ascent|(cs)->descent) == 0))
0711
0712
0713
0714
0715
0716
0717
0718
0719 #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
0720 do { \
0721 cs = def; \
0722 if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
0723 if (fs->per_char == NULL) { \
0724 cs = &fs->min_bounds; \
0725 } else { \
0726 cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
0727 if (CI_NONEXISTCHAR(cs)) cs = def; \
0728 } \
0729 } \
0730 } while (0)
0731
0732 #define CI_GET_DEFAULT_INFO_1D(fs,cs) \
0733 CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
0734
0735
0736
0737
0738
0739
0740
0741 #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
0742 do { \
0743 cs = def; \
0744 if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
0745 col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
0746 if (fs->per_char == NULL) { \
0747 cs = &fs->min_bounds; \
0748 } else { \
0749 cs = &fs->per_char[((row - fs->min_byte1) * \
0750 (fs->max_char_or_byte2 - \
0751 fs->min_char_or_byte2 + 1)) + \
0752 (col - fs->min_char_or_byte2)]; \
0753 if (CI_NONEXISTCHAR(cs)) cs = def; \
0754 } \
0755 } \
0756 } while (0)
0757
0758 #define CI_GET_DEFAULT_INFO_2D(fs,cs) \
0759 do { \
0760 unsigned int r = (fs->default_char >> 8); \
0761 unsigned int c = (fs->default_char & 0xff); \
0762 CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
0763 } while (0)
0764
0765
0766
0767 #define OneDataCard32(dpy,dstaddr,srcvar) \
0768 do { *(CARD32 *)(dstaddr) = (srcvar); } while (0)
0769
0770
0771 typedef struct _XInternalAsync {
0772 struct _XInternalAsync *next;
0773
0774
0775
0776
0777
0778
0779
0780
0781
0782 Bool (*handler)(
0783 Display* ,
0784 xReply* ,
0785 char* ,
0786 int ,
0787 XPointer
0788 );
0789 XPointer data;
0790 } _XAsyncHandler;
0791
0792
0793
0794
0795
0796
0797 typedef struct _XAsyncEState {
0798 unsigned long min_sequence_number;
0799 unsigned long max_sequence_number;
0800 unsigned char error_code;
0801 unsigned char major_opcode;
0802 unsigned short minor_opcode;
0803 unsigned char last_error_received;
0804 int error_count;
0805 } _XAsyncErrorState;
0806
0807 extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler);
0808 #define DeqAsyncHandler(dpy,handler) do { \
0809 if (dpy->async_handlers == (handler)) \
0810 dpy->async_handlers = (handler)->next; \
0811 else \
0812 _XDeqAsyncHandler(dpy, handler); \
0813 } while (0)
0814
0815 typedef void (*FreeFuncType) (
0816 Display*
0817 );
0818
0819 typedef int (*FreeModmapType) (
0820 XModifierKeymap*
0821 );
0822
0823
0824
0825
0826 typedef struct _XFreeFuncs {
0827 FreeFuncType atoms;
0828 FreeModmapType modifiermap;
0829 FreeFuncType key_bindings;
0830 FreeFuncType context_db;
0831 FreeFuncType defaultCCCs;
0832 FreeFuncType clientCmaps;
0833 FreeFuncType intensityMaps;
0834 FreeFuncType im_filters;
0835 FreeFuncType xkb;
0836 } _XFreeFuncRec;
0837
0838
0839 typedef int (*CreateGCType) (
0840 Display* ,
0841 GC ,
0842 XExtCodes*
0843 );
0844
0845 typedef int (*CopyGCType)(
0846 Display* ,
0847 GC ,
0848 XExtCodes*
0849 );
0850
0851 typedef int (*FlushGCType) (
0852 Display* ,
0853 GC ,
0854 XExtCodes*
0855 );
0856
0857 typedef int (*FreeGCType) (
0858 Display* ,
0859 GC ,
0860 XExtCodes*
0861 );
0862
0863 typedef int (*CreateFontType) (
0864 Display* ,
0865 XFontStruct* ,
0866 XExtCodes*
0867 );
0868
0869 typedef int (*FreeFontType) (
0870 Display* ,
0871 XFontStruct* ,
0872 XExtCodes*
0873 );
0874
0875 typedef int (*CloseDisplayType) (
0876 Display* ,
0877 XExtCodes*
0878 );
0879
0880 typedef int (*ErrorType) (
0881 Display* ,
0882 xError* ,
0883 XExtCodes* ,
0884 int*
0885 );
0886
0887 typedef char* (*ErrorStringType) (
0888 Display* ,
0889 int ,
0890 XExtCodes* ,
0891 char* ,
0892 int
0893 );
0894
0895 typedef void (*PrintErrorType)(
0896 Display* ,
0897 XErrorEvent* ,
0898 void*
0899 );
0900
0901 typedef void (*BeforeFlushType)(
0902 Display* ,
0903 XExtCodes* ,
0904 _Xconst char* ,
0905 long
0906 );
0907
0908
0909
0910
0911 typedef struct _XExten {
0912 struct _XExten *next;
0913 XExtCodes codes;
0914 CreateGCType create_GC;
0915 CopyGCType copy_GC;
0916 FlushGCType flush_GC;
0917 FreeGCType free_GC;
0918 CreateFontType create_Font;
0919 FreeFontType free_Font;
0920 CloseDisplayType close_display;
0921 ErrorType error;
0922 ErrorStringType error_string;
0923 char *name;
0924 PrintErrorType error_values;
0925 BeforeFlushType before_flush;
0926 struct _XExten *next_flush;
0927 } _XExtension;
0928
0929
0930
0931 #ifdef DataRoutineIsProcedure
0932 extern void Data(Display *dpy, char *data, long len);
0933 #endif
0934 extern int _XError(
0935 Display* ,
0936 xError*
0937 );
0938 extern int _XIOError(
0939 Display*
0940 );
0941 extern int (*_XIOErrorFunction)(
0942 Display*
0943 );
0944 extern int (*_XErrorFunction)(
0945 Display* ,
0946 XErrorEvent*
0947 );
0948 extern void _XEatData(
0949 Display* ,
0950 unsigned long
0951 ) _X_COLD;
0952 extern void _XEatDataWords(
0953 Display* ,
0954 unsigned long
0955 ) _X_COLD;
0956 #if defined(__SUNPRO_C)
0957 # pragma rarely_called(_XEatData, _XEatDataWords)
0958 #endif
0959 extern char *_XAllocScratch(
0960 Display* ,
0961 unsigned long
0962 );
0963 extern char *_XAllocTemp(
0964 Display* ,
0965 unsigned long
0966 );
0967 extern void _XFreeTemp(
0968 Display* ,
0969 char* ,
0970 unsigned long
0971 );
0972 extern Visual *_XVIDtoVisual(
0973 Display* ,
0974 VisualID
0975 );
0976 extern unsigned long _XSetLastRequestRead(
0977 Display* ,
0978 xGenericReply*
0979 );
0980 extern int _XGetHostname(
0981 char* ,
0982 int
0983 );
0984 extern Screen *_XScreenOfWindow(
0985 Display* ,
0986 Window
0987 );
0988 extern Bool _XAsyncErrorHandler(
0989 Display* ,
0990 xReply* ,
0991 char* ,
0992 int ,
0993 XPointer
0994 );
0995 extern char *_XGetAsyncReply(
0996 Display* ,
0997 char* ,
0998 xReply* ,
0999 char* ,
1000 int ,
1001 int ,
1002 Bool
1003 );
1004 extern void _XGetAsyncData(
1005 Display* ,
1006 char * ,
1007 char * ,
1008 int ,
1009 int ,
1010 int ,
1011 int
1012 );
1013 extern void _XFlush(
1014 Display*
1015 );
1016 extern int _XEventsQueued(
1017 Display* ,
1018 int
1019 );
1020 extern void _XReadEvents(
1021 Display*
1022 );
1023 extern int _XRead(
1024 Display* ,
1025 char* ,
1026 long
1027 );
1028 extern void _XReadPad(
1029 Display* ,
1030 char* ,
1031 long
1032 );
1033 extern void _XSend(
1034 Display* ,
1035 _Xconst char* ,
1036 long
1037 );
1038 extern Status _XReply(
1039 Display* ,
1040 xReply* ,
1041 int ,
1042 Bool
1043 );
1044 extern void _XEnq(
1045 Display* ,
1046 xEvent*
1047 );
1048 extern void _XDeq(
1049 Display* ,
1050 _XQEvent* ,
1051 _XQEvent*
1052 );
1053
1054 extern Bool _XUnknownWireEvent(
1055 Display* ,
1056 XEvent* ,
1057 xEvent*
1058 );
1059
1060 extern Bool _XUnknownWireEventCookie(
1061 Display* ,
1062 XGenericEventCookie* ,
1063 xEvent*
1064 );
1065
1066 extern Bool _XUnknownCopyEventCookie(
1067 Display* ,
1068 XGenericEventCookie* ,
1069 XGenericEventCookie*
1070 );
1071
1072 extern Status _XUnknownNativeEvent(
1073 Display* ,
1074 XEvent* ,
1075 xEvent*
1076 );
1077
1078 extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event);
1079 extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we);
1080 extern Bool _XPollfdCacheInit(Display *dpy);
1081 extern void _XPollfdCacheAdd(Display *dpy, int fd);
1082 extern void _XPollfdCacheDel(Display *dpy, int fd);
1083 extern XID _XAllocID(Display *dpy);
1084 extern void _XAllocIDs(Display *dpy, XID *ids, int count);
1085
1086 extern int _XFreeExtData(
1087 XExtData*
1088 );
1089
1090 extern int (*XESetCreateGC(
1091 Display* ,
1092 int ,
1093 int (*) (
1094 Display* ,
1095 GC ,
1096 XExtCodes*
1097 )
1098 ))(
1099 Display*, GC, XExtCodes*
1100 );
1101
1102 extern int (*XESetCopyGC(
1103 Display* ,
1104 int ,
1105 int (*) (
1106 Display* ,
1107 GC ,
1108 XExtCodes*
1109 )
1110 ))(
1111 Display*, GC, XExtCodes*
1112 );
1113
1114 extern int (*XESetFlushGC(
1115 Display* ,
1116 int ,
1117 int (*) (
1118 Display* ,
1119 GC ,
1120 XExtCodes*
1121 )
1122 ))(
1123 Display*, GC, XExtCodes*
1124 );
1125
1126 extern int (*XESetFreeGC(
1127 Display* ,
1128 int ,
1129 int (*) (
1130 Display* ,
1131 GC ,
1132 XExtCodes*
1133 )
1134 ))(
1135 Display*, GC, XExtCodes*
1136 );
1137
1138 extern int (*XESetCreateFont(
1139 Display* ,
1140 int ,
1141 int (*) (
1142 Display* ,
1143 XFontStruct* ,
1144 XExtCodes*
1145 )
1146 ))(
1147 Display*, XFontStruct*, XExtCodes*
1148 );
1149
1150 extern int (*XESetFreeFont(
1151 Display* ,
1152 int ,
1153 int (*) (
1154 Display* ,
1155 XFontStruct* ,
1156 XExtCodes*
1157 )
1158 ))(
1159 Display*, XFontStruct*, XExtCodes*
1160 );
1161
1162 extern int (*XESetCloseDisplay(
1163 Display* ,
1164 int ,
1165 int (*) (
1166 Display* ,
1167 XExtCodes*
1168 )
1169 ))(
1170 Display*, XExtCodes*
1171 );
1172
1173 extern int (*XESetError(
1174 Display* ,
1175 int ,
1176 int (*) (
1177 Display* ,
1178 xError* ,
1179 XExtCodes* ,
1180 int*
1181 )
1182 ))(
1183 Display*, xError*, XExtCodes*, int*
1184 );
1185
1186 extern char* (*XESetErrorString(
1187 Display* ,
1188 int ,
1189 char* (*) (
1190 Display* ,
1191 int ,
1192 XExtCodes* ,
1193 char* ,
1194 int
1195 )
1196 ))(
1197 Display*, int, XExtCodes*, char*, int
1198 );
1199
1200 extern void (*XESetPrintErrorValues (
1201 Display* ,
1202 int ,
1203 void (*)(
1204 Display* ,
1205 XErrorEvent* ,
1206 void*
1207 )
1208 ))(
1209 Display*, XErrorEvent*, void*
1210 );
1211
1212 extern Bool (*XESetWireToEvent(
1213 Display* ,
1214 int ,
1215 Bool (*) (
1216 Display* ,
1217 XEvent* ,
1218 xEvent*
1219 )
1220 ))(
1221 Display*, XEvent*, xEvent*
1222 );
1223
1224 extern Bool (*XESetWireToEventCookie(
1225 Display* ,
1226 int ,
1227 Bool (*) (
1228 Display* ,
1229 XGenericEventCookie* ,
1230 xEvent*
1231 )
1232 ))(
1233 Display*, XGenericEventCookie*, xEvent*
1234 );
1235
1236 extern Bool (*XESetCopyEventCookie(
1237 Display* ,
1238 int ,
1239 Bool (*) (
1240 Display* ,
1241 XGenericEventCookie* ,
1242 XGenericEventCookie*
1243 )
1244 ))(
1245 Display*, XGenericEventCookie*, XGenericEventCookie*
1246 );
1247
1248
1249 extern Status (*XESetEventToWire(
1250 Display* ,
1251 int ,
1252 Status (*) (
1253 Display* ,
1254 XEvent* ,
1255 xEvent*
1256 )
1257 ))(
1258 Display*, XEvent*, xEvent*
1259 );
1260
1261 extern Bool (*XESetWireToError(
1262 Display* ,
1263 int ,
1264 Bool (*) (
1265 Display* ,
1266 XErrorEvent* ,
1267 xError*
1268 )
1269 ))(
1270 Display*, XErrorEvent*, xError*
1271 );
1272
1273 extern void (*XESetBeforeFlush(
1274 Display* ,
1275 int ,
1276 void (*) (
1277 Display* ,
1278 XExtCodes* ,
1279 _Xconst char* ,
1280 long
1281 )
1282 ))(
1283 Display*, XExtCodes*, _Xconst char*, long
1284 );
1285
1286
1287
1288 typedef void (*_XInternalConnectionProc)(
1289 Display* ,
1290 int ,
1291 XPointer
1292 );
1293
1294
1295 extern Status _XRegisterInternalConnection(
1296 Display* ,
1297 int ,
1298 _XInternalConnectionProc ,
1299 XPointer
1300 );
1301
1302 extern void _XUnregisterInternalConnection(
1303 Display* ,
1304 int
1305 );
1306
1307 extern void _XProcessInternalConnection(
1308 Display* ,
1309 struct _XConnectionInfo*
1310 );
1311
1312
1313
1314 struct _XConnectionInfo {
1315 int fd;
1316 _XInternalConnectionProc read_callback;
1317 XPointer call_data;
1318 XPointer *watch_data;
1319 struct _XConnectionInfo *next;
1320 };
1321
1322 struct _XConnWatchInfo {
1323 XConnectionWatchProc fn;
1324 XPointer client_data;
1325 struct _XConnWatchInfo *next;
1326 };
1327
1328 extern int _XTextHeight(
1329 XFontStruct* ,
1330 _Xconst char* ,
1331 int
1332 );
1333
1334 extern int _XTextHeight16(
1335 XFontStruct* ,
1336 _Xconst XChar2b* ,
1337 int
1338 );
1339
1340 #if defined(WIN32)
1341
1342 extern int _XOpenFile(
1343 _Xconst char* ,
1344 int
1345 );
1346
1347 extern int _XOpenFileMode(
1348 _Xconst char* ,
1349 int ,
1350 mode_t
1351 );
1352
1353 extern void* _XFopenFile(
1354 _Xconst char* ,
1355 _Xconst char*
1356 );
1357
1358 extern int _XAccessFile(
1359 _Xconst char*
1360 );
1361 #else
1362 #define _XOpenFile(path,flags) open(path,flags)
1363 #define _XOpenFileMode(path,flags,mode) open(path,flags,mode)
1364 #define _XFopenFile(path,mode) fopen(path,mode)
1365 #endif
1366
1367
1368 extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event);
1369
1370 extern int _XF86LoadQueryLocaleFont(
1371 Display* ,
1372 _Xconst char* ,
1373 XFontStruct** ,
1374 Font*
1375 );
1376
1377 extern void _XProcessWindowAttributes (
1378 Display *dpy,
1379 xChangeWindowAttributesReq *req,
1380 unsigned long valuemask,
1381 XSetWindowAttributes *attributes);
1382
1383 extern int _XDefaultError(
1384 Display *dpy,
1385 XErrorEvent *event);
1386
1387 extern int _XDefaultIOError(
1388 Display *dpy);
1389
1390 extern void _XDefaultIOErrorExit(
1391 Display *dpy,
1392 void *user_data);
1393
1394 extern void _XSetClipRectangles (
1395 Display *dpy,
1396 GC gc,
1397 int clip_x_origin, int clip_y_origin,
1398 XRectangle *rectangles,
1399 int n,
1400 int ordering);
1401
1402 Status _XGetWindowAttributes(
1403 Display *dpy,
1404 Window w,
1405 XWindowAttributes *attr);
1406
1407 int _XPutBackEvent (
1408 Display *dpy,
1409 XEvent *event);
1410
1411 extern Bool _XIsEventCookie(
1412 Display *dpy,
1413 XEvent *ev);
1414
1415 extern void _XFreeEventCookies(
1416 Display *dpy);
1417
1418 extern void _XStoreEventCookie(
1419 Display *dpy,
1420 XEvent *ev);
1421
1422 extern Bool _XFetchEventCookie(
1423 Display *dpy,
1424 XGenericEventCookie *ev);
1425
1426 extern Bool _XCopyEventCookie(
1427 Display *dpy,
1428 XGenericEventCookie *in,
1429 XGenericEventCookie *out);
1430
1431
1432
1433 extern void xlocaledir(
1434 char *buf,
1435 int buf_len
1436 );
1437
1438 #ifdef __clang__
1439 #pragma clang diagnostic pop
1440 #endif
1441
1442 _XFUNCPROTOEND
1443
1444 #endif