1
/* $Xorg: Xlibint.h,v 1.5 2001/02/09 02:03:38 xorgcvs Exp $ */
5
Copyright 1984, 1985, 1987, 1989, 1998 The Open Group
7
Permission to use, copy, modify, distribute, and sell this software and its
8
documentation for any purpose is hereby granted without fee, provided that
9
the above copyright notice appear in all copies and that both that
10
copyright notice and this permission notice appear in supporting
13
The above copyright notice and this permission notice shall be included
14
in all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
OTHER DEALINGS IN THE SOFTWARE.
24
Except as contained in this notice, the name of The Open Group shall
25
not be used in advertising or otherwise to promote the sale, use or
26
other dealings in this Software without prior written authorization
30
/* $XFree86: xc/lib/X11/Xlibint.h,v 3.24 2002/05/31 18:45:42 dawes Exp $ */
36
* Xlibint.h - Header definition and support file for the internal
37
* support routines used by the C subroutine interface
38
* library (Xlib) to the X Window System.
40
* Warning, there be dragons here....
44
#include <X11/Xproto.h> /* to declare xEvent */
47
#define _XFlush _XFlushIt
51
* If your BytesReadable correctly detects broken connections, then
52
* you should NOT define XCONN_CHECK_FREQ.
54
#ifndef XCONN_CHECK_FREQ
55
#define XCONN_CHECK_FREQ 256
60
XExtData *ext_data; /* hook for extension to hang data */
61
GContext gid; /* protocol ID for graphics context */
62
Bool rects; /* boolean: TRUE if clipmask is list of rectangles */
63
Bool dashes; /* boolean: TRUE if dash-list is really a list */
64
unsigned long dirty;/* cache dirty bits */
65
XGCValues values; /* shadow structure of values */
70
XExtData *ext_data; /* hook for extension to hang data */
71
struct _XFreeFuncs *free_funcs; /* internal free functions */
72
int fd; /* Network socket. */
73
int conn_checker; /* ugly thing used by _XEventsQueued */
74
int proto_major_version;/* maj. version of server's X protocol */
75
int proto_minor_version;/* minor version of server's X protocol */
76
char *vendor; /* vendor of the server hardware */
77
XID resource_base; /* resource ID base */
78
XID resource_mask; /* resource ID mask bits */
79
XID resource_id; /* allocator current ID */
80
int resource_shift; /* allocator shift to correct bits */
81
XID (*resource_alloc)( /* allocator function */
82
#if NeedFunctionPrototypes
86
int byte_order; /* screen byte order, LSBFirst, MSBFirst */
87
int bitmap_unit; /* padding and data requirements */
88
int bitmap_pad; /* padding requirements on bitmaps */
89
int bitmap_bit_order; /* LeastSignificant or MostSignificant */
90
int nformats; /* number of pixmap formats in list */
91
ScreenFormat *pixmap_format; /* pixmap format list */
92
int vnumber; /* Xlib's X protocol version number. */
93
int release; /* release of the server */
94
struct _XSQEvent *head, *tail; /* Input event queue. */
95
int qlen; /* Length of input event queue */
96
unsigned long last_request_read; /* seq number of last event read */
97
unsigned long request; /* sequence number of last request. */
98
char *last_req; /* beginning of last request, or dummy */
99
char *buffer; /* Output buffer starting address. */
100
char *bufptr; /* Output buffer index pointer. */
101
char *bufmax; /* Output buffer maximum+1 address. */
102
unsigned max_request_size; /* maximum number 32 bit words in request*/
103
struct _XrmHashBucketRec *db;
104
int (*synchandler)( /* Synchronization handler */
105
#if NeedFunctionPrototypes
109
char *display_name; /* "host:display" string used on this connect*/
110
int default_screen; /* default screen for operations */
111
int nscreens; /* number of screens on this server*/
112
Screen *screens; /* pointer to list of screens */
113
unsigned long motion_buffer; /* size of motion buffer */
114
unsigned long flags; /* internal connection flags */
115
int min_keycode; /* minimum defined keycode */
116
int max_keycode; /* maximum defined keycode */
117
KeySym *keysyms; /* This server's keysyms */
118
XModifierKeymap *modifiermap; /* This server's modifier keymap */
119
int keysyms_per_keycode;/* number of rows */
120
char *xdefaults; /* contents of defaults from server */
121
char *scratch_buffer; /* place to hang scratch buffer */
122
unsigned long scratch_length; /* length of scratch buffer */
123
int ext_number; /* extension number on this display */
124
struct _XExten *ext_procs; /* extensions initialized on this display */
126
* the following can be fixed size, as the protocol defines how
127
* much address space is available.
128
* While this could be done using the extension vector, there
129
* may be MANY events processed, so a search through the extension
130
* list to find the right procedure for each event might be
131
* expensive if many extensions are being used.
133
Bool (*event_vec[128])( /* vector for wire to event */
138
Status (*wire_vec[128])( /* vector for event to wire */
143
KeySym lock_meaning; /* for XLookupString */
144
struct _XLockInfo *lock; /* multi-thread state, display lock */
145
struct _XInternalAsync *async_handlers; /* for internal async */
146
unsigned long bigreq_size; /* max size of big requests */
147
struct _XLockPtrs *lock_fns; /* pointers to threads functions */
148
void (*idlist_alloc)( /* XID list allocator function */
153
/* things above this line should not move, for binary compatibility */
154
struct _XKeytrans *key_bindings; /* for XLookupString */
155
Font cursor_font; /* for XCreateFontCursor */
156
struct _XDisplayAtoms *atoms; /* for XInternAtom */
157
unsigned int mode_switch; /* keyboard group modifiers */
158
unsigned int num_lock; /* keyboard numlock modifiers */
159
struct _XContextDB *context_db; /* context database */
160
Bool (**error_vec)( /* vector for wire to error */
161
Display * /* display */,
162
XErrorEvent * /* he */,
169
XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */
170
XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */
171
XPointer perVisualIntensityMaps;
172
/* linked list of XcmsIntensityMap */
174
struct _XIMFilter *im_filters;
175
struct _XSQEvent *qfree; /* unallocated event queue elements */
176
unsigned long next_event_serial_num; /* inserted into next queue elt */
177
struct _XExten *flushes; /* Flush hooks */
178
struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */
179
int im_fd_length; /* number of im_fd_info */
180
struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */
181
int watcher_count; /* number of conn_watchers */
182
XPointer filedes; /* struct pollfd cache for _XWaitForReadable */
183
int (*savedsynchandler)( /* user synchandler when Xlib usurps */
186
XID resource_max; /* allocator max ID */
187
int xcmisc_opcode; /* major opcode for XC-MISC */
188
struct _XkbInfoRec *xkb_info; /* XKB info */
189
struct _XtransConnInfo *trans_conn; /* transport connection object */
192
#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n)
195
* define the following if you want the Data macro to be a procedure instead
198
#define DataRoutineIsProcedure
203
* _QEvent datatype for use in input queueing.
205
typedef struct _XSQEvent
207
struct _XSQEvent *next;
209
unsigned long qserial_num; /* so multi-threaded code can find new ones */
213
#ifdef XTHREADS /* for xReply */
217
#if NeedFunctionPrototypes /* prototypes require event type definitions */
221
#include <X11/Xproto.h>
223
#define _SGI_MP_SOURCE /* turn this on to get MP safe errno */
226
#define _XBCOPYFUNC _Xbcopy
227
#include <X11/Xfuncs.h>
228
#include <X11/Xosdefs.h>
230
/* Utek leaves kernel macros around in include files (bleah) */
238
#include <X11/Xfuncproto.h>
243
* The following definitions can be used for locking requests in multi-threaded
247
/* Author: Stephen Gildea, MIT X Consortium
249
* declarations for C Threads locking
252
typedef struct _LockInfoRec *LockInfoPtr;
254
/* interfaces for locking.c */
256
/* used by all, including extensions; do not move */
257
void (*lock_display)(
259
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
264
void (*unlock_display)(
266
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
273
#if defined(WIN32) && !defined(_XLIBINT_)
274
#define _XCreateMutex_fn (*_XCreateMutex_fn_p)
275
#define _XFreeMutex_fn (*_XFreeMutex_fn_p)
276
#define _XLockMutex_fn (*_XLockMutex_fn_p)
277
#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p)
278
#define _Xglobal_lock (*_Xglobal_lock_p)
282
extern void (*_XCreateMutex_fn)(
283
#if NeedFunctionPrototypes
284
LockInfoPtr /* lock */
287
extern void (*_XFreeMutex_fn)(
288
#if NeedFunctionPrototypes
289
LockInfoPtr /* lock */
292
extern void (*_XLockMutex_fn)(
293
#if NeedFunctionPrototypes
294
LockInfoPtr /* lock */
295
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
301
extern void (*_XUnlockMutex_fn)(
302
#if NeedFunctionPrototypes
303
LockInfoPtr /* lock */
304
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
311
extern LockInfoPtr _Xglobal_lock;
313
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
314
#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
315
#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
316
#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
317
#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
319
/* used everywhere, so must be fast if not using threads */
320
#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
321
#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
322
#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
323
#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
325
#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
326
#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
329
#define LockDisplay(dis)
330
#define _XLockMutex(lock)
331
#define _XUnlockMutex(lock)
332
#define UnlockDisplay(dis)
333
#define _XCreateMutex(lock)
334
#define _XFreeMutex(lock)
337
#define Xfree(ptr) free((ptr))
340
* Note that some machines do not return a valid pointer for malloc(0), in
341
* which case we provide an alternate under the control of the
342
* define MALLOC_0_RETURNS_NULL. This is necessary because some
343
* Xlib code expects malloc(0) to return a valid pointer to storage.
345
#ifdef MALLOC_0_RETURNS_NULL
347
# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
348
# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
349
# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
353
# define Xmalloc(size) malloc((size))
354
# define Xrealloc(ptr, size) realloc((ptr), (size))
355
# define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
365
#define BUFSIZE 2048 /* X output buffer size. */
368
#define PTSPERBATCH 1024 /* point batching */
371
#define WLNSPERBATCH 50 /* wide line batching */
374
#define ZLNSPERBATCH 1024 /* thin line batching */
376
#ifndef WRCTSPERBATCH
377
#define WRCTSPERBATCH 10 /* wide line rectangle batching */
379
#ifndef ZRCTSPERBATCH
380
#define ZRCTSPERBATCH 256 /* thin line rectangle batching */
382
#ifndef FRCTSPERBATCH
383
#define FRCTSPERBATCH 256 /* filled rectangle batching */
385
#ifndef FARCSPERBATCH
386
#define FARCSPERBATCH 256 /* filled arc batching */
389
#define CURSORFONT "cursor" /* standard cursor fonts */
395
#define XlibDisplayIOError (1L << 0)
396
#define XlibDisplayClosing (1L << 1)
397
#define XlibDisplayNoXkb (1L << 2)
398
#define XlibDisplayPrivSync (1L << 3)
399
#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */
400
#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */
401
#define XlibDisplayReply (1L << 5) /* in _XReply */
402
#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */
405
* X Protocol packetizing macros.
408
/* Need to start requests on 64 bit word boundaries
409
* on a CRAY computer so add a NoOp (127) if needed.
410
* A character pointer on a CRAY computer will be non-zero
411
* after shifting right 61 bits of it is not pointing to
415
#define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\
416
dpy->last_req = dpy->bufptr;\
417
*(dpy->bufptr) = X_NoOperation;\
418
*(dpy->bufptr+1) = 0;\
419
*(dpy->bufptr+2) = 0;\
420
*(dpy->bufptr+3) = 1;\
424
#else /* else does not require alignment on 64-bit boundaries */
430
* GetReq - Get the next available X request packet in the buffer and
433
* "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
434
* "req" is the name of the request pointer.
438
#if !defined(UNIXCPP) || defined(ANSICPP)
439
#define GetReq(name, req) \
441
if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
443
req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
444
req->reqType = X_##name;\
445
req->length = (SIZEOF(x##name##Req))>>2;\
446
dpy->bufptr += SIZEOF(x##name##Req);\
449
#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
450
#define GetReq(name, req) \
452
if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
454
req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
455
req->reqType = X_/**/name;\
456
req->length = (SIZEOF(x/**/name/**/Req))>>2;\
457
dpy->bufptr += SIZEOF(x/**/name/**/Req);\
461
/* GetReqExtra is the same as GetReq, but allocates "n" additional
462
bytes after the request. "n" must be a multiple of 4! */
464
#if !defined(UNIXCPP) || defined(ANSICPP)
465
#define GetReqExtra(name, n, req) \
467
if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\
469
req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
470
req->reqType = X_##name;\
471
req->length = (SIZEOF(x##name##Req) + n)>>2;\
472
dpy->bufptr += SIZEOF(x##name##Req) + n;\
475
#define GetReqExtra(name, n, req) \
477
if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\
479
req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
480
req->reqType = X_/**/name;\
481
req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\
482
dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\
488
* GetResReq is for those requests that have a resource ID
489
* (Window, Pixmap, GContext, etc.) as their single argument.
490
* "rid" is the name of the resource.
493
#if !defined(UNIXCPP) || defined(ANSICPP)
494
#define GetResReq(name, rid, req) \
496
if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
498
req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
499
req->reqType = X_##name;\
502
dpy->bufptr += SIZEOF(xResourceReq);\
505
#define GetResReq(name, rid, req) \
507
if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
509
req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
510
req->reqType = X_/**/name;\
513
dpy->bufptr += SIZEOF(xResourceReq);\
518
* GetEmptyReq is for those requests that have no arguments
521
#if !defined(UNIXCPP) || defined(ANSICPP)
522
#define GetEmptyReq(name, req) \
524
if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
526
req = (xReq *) (dpy->last_req = dpy->bufptr);\
527
req->reqType = X_##name;\
529
dpy->bufptr += SIZEOF(xReq);\
532
#define GetEmptyReq(name, req) \
534
if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
536
req = (xReq *) (dpy->last_req = dpy->bufptr);\
537
req->reqType = X_/**/name;\
539
dpy->bufptr += SIZEOF(xReq);\
544
#define MakeBigReq(req,n) \
547
unsigned long _BRlen = req->length - 1; \
549
memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \
550
memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
551
memcpy(((char *)req) + 4, _BRdat, 4); \
552
Data32(dpy, (long *)&_BRdat, 4); \
556
#define MakeBigReq(req,n) \
559
CARD32 _BRlen = req->length - 1; \
561
_BRdat = ((CARD32 *)req)[_BRlen]; \
562
memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
563
((CARD32 *)req)[1] = _BRlen + n + 2; \
564
Data32(dpy, &_BRdat, 4); \
567
#define MakeBigReq(req,n) \
570
CARD32 _BRlen = req->length - 1; \
572
_BRdat = ((CARD32 *)req)[_BRlen]; \
573
memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
574
((CARD32 *)req)[1] = _BRlen + n + 2; \
575
Data32(dpy, &_BRdat, 4); \
580
#define SetReqLen(req,n,badlen) \
581
if ((req->length + n) > (unsigned)65535) { \
582
if (dpy->bigreq_size) { \
591
#define SyncHandle() \
592
if (dpy->synchandler) (*dpy->synchandler)(dpy)
594
extern void _XFlushGCCache(Display *dpy, GC gc);
595
#define FlushGC(dpy, gc) \
596
if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
598
* Data - Place data in the buffer and pad the end to provide
599
* 32 bit word alignment. Transmit if the buffer fills.
601
* "dpy" is a pointer to a Display.
602
* "data" is a pinter to a data buffer.
603
* "len" is the length of the data buffer.
605
#ifndef DataRoutineIsProcedure
606
#define Data(dpy, data, len) {\
607
if (dpy->bufptr + (len) <= dpy->bufmax) {\
608
memcpy(dpy->bufptr, data, (int)len);\
609
dpy->bufptr += ((len) + 3) & ~3;\
611
_XSend(dpy, data, len);\
613
#endif /* DataRoutineIsProcedure */
616
/* Allocate bytes from the buffer. No padding is done, so if
617
* the length is not a multiple of 4, the caller must be
618
* careful to leave the buffer aligned after sending the
621
* "type" is the type of the pointer being assigned to.
622
* "ptr" is the pointer being assigned to.
623
* "n" is the number of bytes to allocate.
627
* BufAlloc (xTextElt *, elt, nbytes)
630
#define BufAlloc(type, ptr, n) \
631
if (dpy->bufptr + (n) > dpy->bufmax) \
633
ptr = (type) dpy->bufptr; \
637
#define Data16(dpy, data, len) _XData16(dpy, (short *)data, len)
638
#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
640
#define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
641
#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
642
#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
644
#define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
646
#if NeedFunctionPrototypes
652
extern void _XRead32(
653
#if NeedFunctionPrototypes
660
#define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
661
#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
663
#endif /* not WORD64 */
665
#define PackData16(dpy,data,len) Data16 (dpy, data, len)
666
#define PackData32(dpy,data,len) Data32 (dpy, data, len)
668
/* Xlib manual is bogus */
669
#define PackData(dpy,data,len) PackData16 (dpy, data, len)
671
#define min(a,b) (((a) < (b)) ? (a) : (b))
672
#define max(a,b) (((a) > (b)) ? (a) : (b))
674
#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
675
(((cs)->rbearing|(cs)->lbearing| \
676
(cs)->ascent|(cs)->descent) == 0))
679
* CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
680
* character. If the character is in the column and exists, then return the
681
* appropriate metrics (note that fonts with common per-character metrics will
682
* return min_bounds). If none of these hold true, try again with the default
685
#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
688
if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
689
if (fs->per_char == NULL) { \
690
cs = &fs->min_bounds; \
692
cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
693
if (CI_NONEXISTCHAR(cs)) cs = def; \
698
#define CI_GET_DEFAULT_INFO_1D(fs,cs) \
699
CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
704
* CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and
705
* column. This is used for fonts that have more than row zero.
707
#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
710
if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
711
col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
712
if (fs->per_char == NULL) { \
713
cs = &fs->min_bounds; \
715
cs = &fs->per_char[((row - fs->min_byte1) * \
716
(fs->max_char_or_byte2 - \
717
fs->min_char_or_byte2 + 1)) + \
718
(col - fs->min_char_or_byte2)]; \
719
if (CI_NONEXISTCHAR(cs)) cs = def; \
724
#define CI_GET_DEFAULT_INFO_2D(fs,cs) \
726
unsigned int r = (fs->default_char >> 8); \
727
unsigned int c = (fs->default_char & 0xff); \
728
CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
734
/* for when 32-bit alignment is not good enough */
735
#define OneDataCard32(dpy,dstaddr,srcvar) \
736
{ dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }
740
/* srcvar must be a variable for large architecture version */
741
#define OneDataCard32(dpy,dstaddr,srcvar) \
742
{ *(CARD32 *)(dstaddr) = (srcvar); }
744
#endif /* MUSTCOPY */
746
typedef struct _XInternalAsync {
747
struct _XInternalAsync *next;
750
* rep is the generic reply that caused this handler
751
* to be invoked. It must also be passed to _XGetAsyncReply.
752
* buf and len are opaque values that must be passed to
753
* _XGetAsyncReply or _XGetAsyncData.
754
* data is the closure stored in this struct.
755
* The handler returns True iff it handled this reply.
758
#if NeedNestedPrototypes
769
typedef struct _XAsyncEState {
770
unsigned long min_sequence_number;
771
unsigned long max_sequence_number;
772
unsigned char error_code;
773
unsigned char major_opcode;
774
unsigned short minor_opcode;
775
unsigned char last_error_received;
779
extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler);
780
#define DeqAsyncHandler(dpy,handler) { \
781
if (dpy->async_handlers == (handler)) \
782
dpy->async_handlers = (handler)->next; \
784
_XDeqAsyncHandler(dpy, handler); \
787
typedef void (*FreeFuncType) (
788
#if NeedFunctionPrototypes
789
Display* /* display */
793
typedef int (*FreeModmapType) (
794
#if NeedFunctionPrototypes
795
XModifierKeymap* /* modmap */
800
* This structure is private to the library.
802
typedef struct _XFreeFuncs {
803
FreeFuncType atoms; /* _XFreeAtomTable */
804
FreeModmapType modifiermap; /* XFreeModifierMap */
805
FreeFuncType key_bindings; /* _XFreeKeyBindings */
806
FreeFuncType context_db; /* _XFreeContextDB */
807
FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */
808
FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */
809
FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */
810
FreeFuncType im_filters; /* _XFreeIMFilters */
811
FreeFuncType xkb; /* _XkbFreeInfo */
814
/* types for InitExt.c */
815
typedef int (*CreateGCType) (
816
#if NeedFunctionPrototypes
817
Display* /* display */,
819
XExtCodes* /* codes */
823
typedef int (*CopyGCType)(
824
#if NeedFunctionPrototypes
825
Display* /* display */,
827
XExtCodes* /* codes */
831
typedef int (*FlushGCType) (
832
#if NeedFunctionPrototypes
833
Display* /* display */,
835
XExtCodes* /* codes */
839
typedef int (*FreeGCType) (
840
#if NeedFunctionPrototypes
841
Display* /* display */,
843
XExtCodes* /* codes */
847
typedef int (*CreateFontType) (
848
#if NeedFunctionPrototypes
849
Display* /* display */,
850
XFontStruct* /* fs */,
851
XExtCodes* /* codes */
855
typedef int (*FreeFontType) (
856
#if NeedFunctionPrototypes
857
Display* /* display */,
858
XFontStruct* /* fs */,
859
XExtCodes* /* codes */
863
typedef int (*CloseDisplayType) (
864
#if NeedFunctionPrototypes
865
Display* /* display */,
866
XExtCodes* /* codes */
870
typedef int (*ErrorType) (
871
#if NeedFunctionPrototypes
872
Display* /* display */,
874
XExtCodes* /* codes */,
879
typedef char* (*ErrorStringType) (
880
#if NeedFunctionPrototypes
881
Display* /* display */,
883
XExtCodes* /* codes */,
889
typedef void (*PrintErrorType)(
890
#if NeedFunctionPrototypes
891
Display* /* display */,
892
XErrorEvent* /* ev */,
897
typedef void (*BeforeFlushType)(
898
#if NeedFunctionPrototypes
899
Display* /* display */,
900
XExtCodes* /* codes */,
901
_Xconst char* /* data */,
907
* This structure is private to the library.
909
typedef struct _XExten { /* private to extension mechanism */
910
struct _XExten *next; /* next in list */
911
XExtCodes codes; /* public information, all extension told */
912
CreateGCType create_GC; /* routine to call when GC created */
913
CopyGCType copy_GC; /* routine to call when GC copied */
914
FlushGCType flush_GC; /* routine to call when GC flushed */
915
FreeGCType free_GC; /* routine to call when GC freed */
916
CreateFontType create_Font; /* routine to call when Font created */
917
FreeFontType free_Font; /* routine to call when Font freed */
918
CloseDisplayType close_display; /* routine to call when connection closed */
919
ErrorType error; /* who to call when an error occurs */
920
ErrorStringType error_string; /* routine to supply error string */
921
char *name; /* name of this extension */
922
PrintErrorType error_values; /* routine to supply error values */
923
BeforeFlushType before_flush; /* routine to call when sending data */
924
struct _XExten *next_flush; /* next in list of those with flushes */
927
/* extension hooks */
929
#ifdef DataRoutineIsProcedure
930
extern void Data(Display *dpy, char *data, long len);
933
#if NeedFunctionPrototypes
938
extern int _XIOError(
939
#if NeedFunctionPrototypes
943
extern int (*_XIOErrorFunction)(
944
#if NeedNestedPrototypes
948
extern int (*_XErrorFunction)(
949
#if NeedNestedPrototypes
951
XErrorEvent* /* error_event */
954
extern void _XEatData(
955
#if NeedFunctionPrototypes
957
unsigned long /* n */
960
extern char *_XAllocScratch(
961
#if NeedFunctionPrototypes
963
unsigned long /* nbytes */
966
extern char *_XAllocTemp(
967
#if NeedFunctionPrototypes
969
unsigned long /* nbytes */
972
extern void _XFreeTemp(
973
#if NeedFunctionPrototypes
976
unsigned long /* nbytes */
979
extern Visual *_XVIDtoVisual(
980
#if NeedFunctionPrototypes
985
extern unsigned long _XSetLastRequestRead(
986
#if NeedFunctionPrototypes
988
xGenericReply* /* rep */
991
extern int _XGetHostname(
992
#if NeedFunctionPrototypes
997
extern Screen *_XScreenOfWindow(
998
#if NeedFunctionPrototypes
1003
extern Bool _XAsyncErrorHandler(
1004
#if NeedFunctionPrototypes
1012
extern char *_XGetAsyncReply(
1013
#if NeedFunctionPrototypes
1015
char* /* replbuf */,
1023
extern void _XGetAsyncData(
1024
#if NeedFunctionPrototypes
1031
int /* discardtotal */
1034
extern void _XFlush(
1035
#if NeedFunctionPrototypes
1039
extern int _XEventsQueued(
1040
#if NeedFunctionPrototypes
1045
extern void _XReadEvents(
1046
#if NeedFunctionPrototypes
1051
#if NeedFunctionPrototypes
1057
extern void _XReadPad(
1058
#if NeedFunctionPrototypes
1065
#if NeedFunctionPrototypes
1067
_Xconst char* /* data */,
1071
extern Status _XReply(
1072
#if NeedFunctionPrototypes
1080
#if NeedFunctionPrototypes
1086
#if NeedFunctionPrototypes
1088
_XQEvent* /* prev */,
1089
_XQEvent* /* qelt */
1093
extern Bool _XUnknownWireEvent(
1094
#if NeedFunctionPrototypes
1100
extern Status _XUnknownNativeEvent(
1101
#if NeedFunctionPrototypes
1108
extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event);
1109
extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we);
1110
extern Bool _XPollfdCacheInit(Display *dpy);
1111
extern XID _XAllocID(Display *dpy);
1112
extern void _XAllocIDs(Display *dpy, XID *ids, int count);
1114
extern int _XFreeExtData(
1115
#if NeedFunctionPrototypes
1116
XExtData* /* extension */
1120
extern int (*XESetCreateGC(
1121
#if NeedFunctionPrototypes
1122
Display* /* display */,
1123
int /* extension */,
1125
#if NeedNestedPrototypes
1126
Display* /* display */,
1128
XExtCodes* /* codes */
1133
#if NeedNestedPrototypes
1134
Display*, GC, XExtCodes*
1138
extern int (*XESetCopyGC(
1139
#if NeedFunctionPrototypes
1140
Display* /* display */,
1141
int /* extension */,
1143
#if NeedNestedPrototypes
1144
Display* /* display */,
1146
XExtCodes* /* codes */
1151
#if NeedNestedPrototypes
1152
Display*, GC, XExtCodes*
1156
extern int (*XESetFlushGC(
1157
#if NeedFunctionPrototypes
1158
Display* /* display */,
1159
int /* extension */,
1161
#if NeedNestedPrototypes
1162
Display* /* display */,
1164
XExtCodes* /* codes */
1169
#if NeedNestedPrototypes
1170
Display*, GC, XExtCodes*
1174
extern int (*XESetFreeGC(
1175
#if NeedFunctionPrototypes
1176
Display* /* display */,
1177
int /* extension */,
1179
#if NeedNestedPrototypes
1180
Display* /* display */,
1182
XExtCodes* /* codes */
1187
#if NeedNestedPrototypes
1188
Display*, GC, XExtCodes*
1192
extern int (*XESetCreateFont(
1193
#if NeedFunctionPrototypes
1194
Display* /* display */,
1195
int /* extension */,
1197
#if NeedNestedPrototypes
1198
Display* /* display */,
1199
XFontStruct* /* fs */,
1200
XExtCodes* /* codes */
1205
#if NeedNestedPrototypes
1206
Display*, XFontStruct*, XExtCodes*
1210
extern int (*XESetFreeFont(
1211
#if NeedFunctionPrototypes
1212
Display* /* display */,
1213
int /* extension */,
1215
#if NeedNestedPrototypes
1216
Display* /* display */,
1217
XFontStruct* /* fs */,
1218
XExtCodes* /* codes */
1223
#if NeedNestedPrototypes
1224
Display*, XFontStruct*, XExtCodes*
1228
extern int (*XESetCloseDisplay(
1229
#if NeedFunctionPrototypes
1230
Display* /* display */,
1231
int /* extension */,
1233
#if NeedNestedPrototypes
1234
Display* /* display */,
1235
XExtCodes* /* codes */
1240
#if NeedNestedPrototypes
1241
Display*, XExtCodes*
1245
extern int (*XESetError(
1246
#if NeedFunctionPrototypes
1247
Display* /* display */,
1248
int /* extension */,
1250
#if NeedNestedPrototypes
1251
Display* /* display */,
1253
XExtCodes* /* codes */,
1259
#if NeedNestedPrototypes
1260
Display*, xError*, XExtCodes*, int*
1264
extern char* (*XESetErrorString(
1265
#if NeedFunctionPrototypes
1266
Display* /* display */,
1267
int /* extension */,
1269
#if NeedNestedPrototypes
1270
Display* /* display */,
1272
XExtCodes* /* codes */,
1279
#if NeedNestedPrototypes
1280
Display*, int, XExtCodes*, char*, int
1284
extern void (*XESetPrintErrorValues (
1285
#if NeedFunctionPrototypes
1286
Display* /* display */,
1287
int /* extension */,
1289
#if NeedNestedPrototypes
1290
Display* /* display */,
1291
XErrorEvent* /* ev */,
1297
#if NeedNestedPrototypes
1298
Display*, XErrorEvent*, void*
1302
extern Bool (*XESetWireToEvent(
1303
#if NeedFunctionPrototypes
1304
Display* /* display */,
1305
int /* event_number */,
1307
#if NeedNestedPrototypes
1308
Display* /* display */,
1315
#if NeedNestedPrototypes
1316
Display*, XEvent*, xEvent*
1320
extern Status (*XESetEventToWire(
1321
#if NeedFunctionPrototypes
1322
Display* /* display */,
1323
int /* event_number */,
1325
#if NeedNestedPrototypes
1326
Display* /* display */,
1333
#if NeedNestedPrototypes
1334
Display*, XEvent*, xEvent*
1338
extern Bool (*XESetWireToError(
1339
#if NeedFunctionPrototypes
1340
Display* /* display */,
1341
int /* error_number */,
1343
#if NeedNestedPrototypes
1344
Display* /* display */,
1345
XErrorEvent* /* he */,
1351
#if NeedNestedPrototypes
1352
Display*, XErrorEvent*, xError*
1356
extern void (*XESetBeforeFlush(
1357
#if NeedFunctionPrototypes
1358
Display* /* display */,
1359
int /* error_number */,
1361
#if NeedNestedPrototypes
1362
Display* /* display */,
1363
XExtCodes* /* codes */,
1364
_Xconst char* /* data */,
1370
#if NeedNestedPrototypes
1371
Display*, XExtCodes*, _Xconst char*, long
1375
/* internal connections for IMs */
1377
typedef void (*_XInternalConnectionProc)(
1378
#if NeedFunctionPrototypes
1381
XPointer /* call_data */
1386
extern Status _XRegisterInternalConnection(
1387
#if NeedFunctionPrototypes
1390
_XInternalConnectionProc /* callback */,
1391
XPointer /* call_data */
1395
extern void _XUnregisterInternalConnection(
1396
#if NeedFunctionPrototypes
1402
/* Display structure has pointers to these */
1404
struct _XConnectionInfo { /* info from _XRegisterInternalConnection */
1406
_XInternalConnectionProc read_callback;
1408
XPointer *watch_data; /* set/used by XConnectionWatchProc */
1409
struct _XConnectionInfo *next;
1412
struct _XConnWatchInfo { /* info from XAddConnectionWatch */
1413
XConnectionWatchProc fn;
1414
XPointer client_data;
1415
struct _XConnWatchInfo *next;
1419
extern char* __XOS2RedirRoot(
1420
#if NeedFunctionPrototypes
1426
extern int _XTextHeight(
1427
#if NeedFunctionPrototypes
1428
XFontStruct* /* font_struct */,
1429
_Xconst char* /* string */,
1434
extern int _XTextHeight16(
1435
#if NeedFunctionPrototypes
1436
XFontStruct* /* font_struct */,
1437
_Xconst XChar2b* /* string */,
1444
extern int _XOpenFile(
1445
#if NeedFunctionPrototypes
1446
_Xconst char* /* path */,
1451
extern void* _XFopenFile(
1452
#if NeedFunctionPrototypes
1453
_Xconst char* /* path */,
1454
_Xconst char* /* mode */
1458
extern int _XAccessFile(
1459
#if NeedFunctionPrototypes
1460
_Xconst char* /* path */
1464
#define _XOpenFile(path,flags) open(path,flags)
1465
#define _XFopenFile(path,mode) fopen(path,mode)
1469
extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event);
1471
extern int _XF86LoadQueryLocaleFont(
1472
#if NeedFunctionPrototypes
1474
_Xconst char* /* name*/,
1475
XFontStruct** /* xfp*/,
1482
#endif /* _XLIBINT_H_ */