2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* Xlibint.h 1.2 - Fujitsu source for CDEnext 95/12/07 10:53:12 */
24 /* $XConsortium: _fallibint.h /main/1 1996/04/08 15:21:22 cde-fuj $ */
28 Copyright (c) 1984, 1985, 1987, 1989 X Consortium
30 Permission is hereby granted, free of charge, to any person obtaining
31 a copy of this software and associated documentation files (the
32 "Software"), to deal in the Software without restriction, including
33 without limitation the rights to use, copy, modify, merge, publish,
34 distribute, sublicense, and/or sell copies of the Software, and to
35 permit persons to whom the Software is furnished to do so, subject to
36 the following conditions:
38 The above copyright notice and this permission notice shall be included
39 in all copies or substantial portions of the Software.
41 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
42 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
45 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
46 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 OTHER DEALINGS IN THE SOFTWARE.
49 Except as contained in this notice, the name of the X Consortium shall
50 not be used in advertising or otherwise to promote the sale, use or
51 other dealings in this Software without prior written authorization
52 from the X Consortium.
57 * Xlibint.h - Header definition and support file for the internal
58 * support routines used by the C subroutine interface
59 * library (Xlib) to the X Window System.
61 * Warning, there be dragons here....
64 * Copyright 1995 by FUJITSU LIMITED
65 * This is source code modified by FUJITSU LIMITED under the Joint
66 * Development Agreement for the CDEnext PST.
67 * This is unpublished proprietry source code of FUJITSU LIMITED
69 * Modifier: Takanori Tateno FUJITSU LIMITED
74 #if !defined(NEED_EVENTS) && !NeedFunctionPrototypes
81 #define _XFlush _XFlushIt
86 XExtData *ext_data; /* hook for extension to hang data */
87 GContext gid; /* protocol ID for graphics context */
88 Bool rects; /* boolean: TRUE if clipmask is list of rectangles */
89 Bool dashes; /* boolean: TRUE if dash-list is really a list */
90 unsigned long dirty;/* cache dirty bits */
91 XGCValues values; /* shadow structure of values */
96 XExtData *ext_data; /* hook for extension to hang data */
97 struct _XFreeFuncs *free_funcs; /* internal free functions */
98 int fd; /* Network socket. */
99 int conn_checker; /* ugly thing used by _XEventsQueued */
100 int proto_major_version;/* maj. version of server's X protocol */
101 int proto_minor_version;/* minor version of server's X protocol */
102 char *vendor; /* vendor of the server hardware */
103 XID resource_base; /* resource ID base */
104 XID resource_mask; /* resource ID mask bits */
105 XID resource_id; /* allocator current ID */
106 int resource_shift; /* allocator shift to correct bits */
107 XID (*resource_alloc)(); /* allocator function */
108 int byte_order; /* screen byte order, LSBFirst, MSBFirst */
109 int bitmap_unit; /* padding and data requirements */
110 int bitmap_pad; /* padding requirements on bitmaps */
111 int bitmap_bit_order; /* LeastSignificant or MostSignificant */
112 int nformats; /* number of pixmap formats in list */
113 ScreenFormat *pixmap_format; /* pixmap format list */
114 int vnumber; /* Xlib's X protocol version number. */
115 int release; /* release of the server */
116 struct _XSQEvent *head, *tail; /* Input event queue. */
117 int qlen; /* Length of input event queue */
118 unsigned long last_request_read; /* seq number of last event read */
119 unsigned long request; /* sequence number of last request. */
120 char *last_req; /* beginning of last request, or dummy */
121 char *buffer; /* Output buffer starting address. */
122 char *bufptr; /* Output buffer index pointer. */
123 char *bufmax; /* Output buffer maximum+1 address. */
124 unsigned max_request_size; /* maximum number 32 bit words in request*/
125 struct _XrmHashBucketRec *db;
126 int (*synchandler)(); /* Synchronization handler */
127 char *display_name; /* "host:display" string used on this connect*/
128 int default_screen; /* default screen for operations */
129 int nscreens; /* number of screens on this server*/
130 Screen *screens; /* pointer to list of screens */
131 unsigned long motion_buffer; /* size of motion buffer */
132 unsigned long flags; /* internal connection flags */
133 int min_keycode; /* minimum defined keycode */
134 int max_keycode; /* maximum defined keycode */
135 KeySym *keysyms; /* This server's keysyms */
136 XModifierKeymap *modifiermap; /* This server's modifier keymap */
137 int keysyms_per_keycode;/* number of rows */
138 char *xdefaults; /* contents of defaults from server */
139 char *scratch_buffer; /* place to hang scratch buffer */
140 unsigned long scratch_length; /* length of scratch buffer */
141 int ext_number; /* extension number on this display */
142 struct _XExten *ext_procs; /* extensions initialized on this display */
144 * the following can be fixed size, as the protocol defines how
145 * much address space is available.
146 * While this could be done using the extension vector, there
147 * may be MANY events processed, so a search through the extension
148 * list to find the right procedure for each event might be
149 * expensive if many extensions are being used.
151 Bool (*event_vec[128])(); /* vector for wire to event */
152 Status (*wire_vec[128])(); /* vector for event to wire */
153 KeySym lock_meaning; /* for XLookupString */
154 struct _XLockInfo *lock; /* multi-thread state, display lock */
155 struct _XInternalAsync *async_handlers; /* for internal async */
156 unsigned long bigreq_size; /* max size of big requests */
157 struct _XLockPtrs *lock_fns; /* pointers to threads functions */
158 void (*idlist_alloc)(); /* XID list allocator function */
159 /* things above this line should not move, for binary compatibility */
160 struct _XKeytrans *key_bindings; /* for XLookupString */
161 Font cursor_font; /* for XCreateFontCursor */
162 struct _XDisplayAtoms *atoms; /* for falInternAtom */
163 unsigned int mode_switch; /* keyboard group modifiers */
164 unsigned int num_lock; /* keyboard numlock modifiers */
165 struct _XContextDB *context_db; /* context database */
166 Bool (**error_vec)(); /* vector for wire to error */
171 XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */
172 XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */
173 XPointer perVisualIntensityMaps;
174 /* linked list of XcmsIntensityMap */
176 struct _XIMFilter *im_filters;
177 struct _XSQEvent *qfree; /* unallocated event queue elements */
178 unsigned long next_event_serial_num; /* inserted into next queue elt */
179 struct _XExten *flushes; /* Flush hooks */
180 struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */
181 int im_fd_length; /* number of im_fd_info */
182 struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */
183 int watcher_count; /* number of conn_watchers */
184 XPointer filedes; /* struct pollfd cache for _XWaitForReadable */
185 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 _XBCOPYFUNC _Xbcopy
224 #include <X11/Xfuncs.h>
225 #include <X11/Xosdefs.h>
227 /* Utek leaves kernel macros around in include files (bleah) */
232 #ifndef X_NOT_STDC_ENV
236 char *malloc(), *realloc(), *calloc();
246 * The following definitions can be used for locking requests in multi-threaded
250 /* Author: Stephen Gildea, MIT X Consortium
252 * declarations for C Threads locking
255 #include <X11/Xfuncproto.h>
258 /* used by all, including extensions; do not move */
259 void (*lock_display)();
260 void (*unlock_display)();
263 typedef struct _LockInfoRec *LockInfoPtr;
265 #if defined(WIN32) && !defined(_XLIBINT_)
266 #define _XCreateMutex_fn (*_XCreateMutex_fn_p)
267 #define _XFreeMutex_fn (*_XFreeMutex_fn_p)
268 #define _XLockMutex_fn (*_XLockMutex_fn_p)
269 #define _XUnlockMutex_fn (*_XUnlockMutex_fn_p)
270 #define _Xglobal_lock (*_Xglobal_lock_p)
274 extern void (*_XCreateMutex_fn)(
275 #if NeedFunctionPrototypes
276 LockInfoPtr /* lock */
279 extern void (*_XFreeMutex_fn)(
280 #if NeedFunctionPrototypes
281 LockInfoPtr /* lock */
284 extern void (*_XLockMutex_fn)(
285 #if NeedFunctionPrototypes
286 LockInfoPtr /* lock */
287 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
293 extern void (*_XUnlockMutex_fn)(
294 #if NeedFunctionPrototypes
295 LockInfoPtr /* lock */
296 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
303 extern LockInfoPtr _Xglobal_lock;
305 #if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
306 #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__)
307 #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__)
308 #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__)
309 #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__)
311 /* used everywhere, so must be fast if not using threads */
312 #define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
313 #define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
314 #define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock)
315 #define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock)
317 #define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock);
318 #define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock);
321 #define LockDisplay(dis)
322 #define _XLockMutex(lock)
323 #define _XUnlockMutex(lock)
324 #define UnlockDisplay(dis)
325 #define _XCreateMutex(lock)
326 #define _XFreeMutex(lock)
329 #define Xfree(ptr) free((ptr))
332 * Note that some machines do not return a valid pointer for malloc(0), in
333 * which case we provide an alternate under the control of the
334 * define MALLOC_0_RETURNS_NULL. This is necessary because some
335 * Xlib code expects malloc(0) to return a valid pointer to storage.
337 #ifdef MALLOC_0_RETURNS_NULL
339 # define Xmalloc(size) malloc(((size) == 0 ? 1 : (size)))
340 # define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size)))
341 # define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize))
345 # define Xmalloc(size) malloc((size))
346 # define Xrealloc(ptr, size) realloc((ptr), (size))
347 # define Xcalloc(nelem, elsize) calloc((nelem), (elsize))
357 #ifdef X_NOT_STDC_ENV
358 extern int errno; /* Internal system error number. */
362 #define BUFSIZE 2048 /* X output buffer size. */
365 #define PTSPERBATCH 1024 /* point batching */
368 #define WLNSPERBATCH 50 /* wide line batching */
371 #define ZLNSPERBATCH 1024 /* thin line batching */
373 #ifndef WRCTSPERBATCH
374 #define WRCTSPERBATCH 10 /* wide line rectangle batching */
376 #ifndef ZRCTSPERBATCH
377 #define ZRCTSPERBATCH 256 /* thin line rectangle batching */
379 #ifndef FRCTSPERBATCH
380 #define FRCTSPERBATCH 256 /* filled rectangle batching */
382 #ifndef FARCSPERBATCH
383 #define FARCSPERBATCH 256 /* filled arc batching */
386 #define CURSORFONT "cursor" /* standard cursor fonts */
392 #define XlibDisplayIOError (1L << 0)
393 #define XlibDisplayClosing (1L << 1)
394 #define XlibDisplayNoXkb (1L << 2)
395 #define XlibDisplayPrivSync (1L << 3)
396 #define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */
397 #define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */
398 #define XlibDisplayReply (1L << 5) /* in _XReply */
399 #define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */
402 * X Protocol packetizing macros.
405 /* Need to start requests on 64 bit word boundaries
406 * on a CRAY computer so add a NoOp (127) if needed.
407 * A character pointer on a CRAY computer will be non-zero
408 * after shifting right 61 bits of it is not pointing to
412 #define WORD64ALIGN if ((long)dpy->bufptr >> 61) {\
413 dpy->last_req = dpy->bufptr;\
414 *(dpy->bufptr) = X_NoOperation;\
415 *(dpy->bufptr+1) = 0;\
416 *(dpy->bufptr+2) = 0;\
417 *(dpy->bufptr+3) = 1;\
421 #else /* else does not require alignment on 64-bit boundaries */
427 * GetReq - Get the next available X request packet in the buffer and
430 * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc.
431 * "req" is the name of the request pointer.
435 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
436 #define GetReq(name, req) \
438 if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\
440 req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
441 req->reqType = X_##name;\
442 req->length = (SIZEOF(x##name##Req))>>2;\
443 dpy->bufptr += SIZEOF(x##name##Req);\
446 #else /* non-ANSI C uses empty comment instead of "##" for token concatenation */
447 #define GetReq(name, req) \
449 if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\
451 req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
452 req->reqType = X_/**/name;\
453 req->length = (SIZEOF(x/**/name/**/Req))>>2;\
454 dpy->bufptr += SIZEOF(x/**/name/**/Req);\
458 /* GetReqExtra is the same as GetReq, but allocates "n" additional
459 bytes after the request. "n" must be a multiple of 4! */
461 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
462 #define GetReqExtra(name, n, req) \
464 if ((dpy->bufptr + SIZEOF(x##name##Req) + n) > dpy->bufmax)\
466 req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\
467 req->reqType = X_##name;\
468 req->length = (SIZEOF(x##name##Req) + n)>>2;\
469 dpy->bufptr += SIZEOF(x##name##Req) + n;\
472 #define GetReqExtra(name, n, req) \
474 if ((dpy->bufptr + SIZEOF(x/**/name/**/Req) + n) > dpy->bufmax)\
476 req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\
477 req->reqType = X_/**/name;\
478 req->length = (SIZEOF(x/**/name/**/Req) + n)>>2;\
479 dpy->bufptr += SIZEOF(x/**/name/**/Req) + n;\
485 * GetResReq is for those requests that have a resource ID
486 * (Window, Pixmap, GContext, etc.) as their single argument.
487 * "rid" is the name of the resource.
490 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
491 #define GetResReq(name, rid, req) \
493 if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
495 req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
496 req->reqType = X_##name;\
499 dpy->bufptr += SIZEOF(xResourceReq);\
502 #define GetResReq(name, rid, req) \
504 if ((dpy->bufptr + SIZEOF(xResourceReq)) > dpy->bufmax)\
506 req = (xResourceReq *) (dpy->last_req = dpy->bufptr);\
507 req->reqType = X_/**/name;\
510 dpy->bufptr += SIZEOF(xResourceReq);\
515 * GetEmptyReq is for those requests that have no arguments
518 #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
519 #define GetEmptyReq(name, req) \
521 if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
523 req = (xReq *) (dpy->last_req = dpy->bufptr);\
524 req->reqType = X_##name;\
526 dpy->bufptr += SIZEOF(xReq);\
529 #define GetEmptyReq(name, req) \
531 if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\
533 req = (xReq *) (dpy->last_req = dpy->bufptr);\
534 req->reqType = X_/**/name;\
536 dpy->bufptr += SIZEOF(xReq);\
541 #define MakeBigReq(req,n) \
544 unsigned long _BRlen = req->length - 1; \
546 memcpy(_BRdat, ((char *)req) + (_BRlen << 2), 4); \
547 memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
548 memcpy(((char *)req) + 4, _BRdat, 4); \
549 Data32(dpy, (long *)&_BRdat, 4); \
552 #define MakeBigReq(req,n) \
555 unsigned long _BRlen = req->length - 1; \
557 _BRdat = ((long *)req)[_BRlen]; \
558 memmove(((char *)req) + 8, ((char *)req) + 4, _BRlen << 2); \
559 ((unsigned long *)req)[1] = _BRlen + n + 2; \
560 Data32(dpy, &_BRdat, 4); \
564 #define SetReqLen(req,n,badlen) \
565 if ((req->length + n) > (unsigned)65535) { \
566 if (dpy->bigreq_size) { \
575 #define SyncHandle() \
576 if (dpy->synchandler) (*dpy->synchandler)(dpy)
578 #define FlushGC(dpy, gc) \
579 if ((gc)->dirty) _XFlushGCCache((dpy), (gc))
581 * Data - Place data in the buffer and pad the end to provide
582 * 32 bit word alignment. Transmit if the buffer fills.
584 * "dpy" is a pointer to a Display.
585 * "data" is a pinter to a data buffer.
586 * "len" is the length of the data buffer.
588 #ifndef DataRoutineIsProcedure
589 #define Data(dpy, data, len) \
590 if (dpy->bufptr + (len) <= dpy->bufmax) {\
591 memcpy(dpy->bufptr, data, (int)len);\
592 dpy->bufptr += ((len) + 3) & ~3;\
594 _XSend(dpy, data, len)
595 #endif /* DataRoutineIsProcedure */
598 /* Allocate bytes from the buffer. No padding is done, so if
599 * the length is not a multiple of 4, the caller must be
600 * careful to leave the buffer aligned after sending the
603 * "type" is the type of the pointer being assigned to.
604 * "ptr" is the pointer being assigned to.
605 * "n" is the number of bytes to allocate.
609 * BufAlloc (xTextElt *, elt, nbytes)
612 #define BufAlloc(type, ptr, n) \
613 if (dpy->bufptr + (n) > dpy->bufmax) \
615 ptr = (type) dpy->bufptr; \
619 #define Data16(dpy, data, len) _XData16(dpy, (short *)data, len)
620 #define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
622 #define Data16(dpy, data, len) Data((dpy), (char *)(data), (len))
623 #define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len))
624 #define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len))
626 #define Data32(dpy, data, len) _XData32(dpy, (long *)data, len)
628 #define Data32(dpy, data, len) Data((dpy), (char *)(data), (len))
629 #define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len))
631 #endif /* not WORD64 */
633 #define PackData16(dpy,data,len) Data16 (dpy, data, len)
634 #define PackData32(dpy,data,len) Data32 (dpy, data, len)
636 /* Xlib manual is bogus */
637 #define PackData(dpy,data,len) PackData16 (dpy, data, len)
639 #define min(a,b) (((a) < (b)) ? (a) : (b))
640 #define max(a,b) (((a) > (b)) ? (a) : (b))
642 #define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
643 (((cs)->rbearing|(cs)->lbearing| \
644 (cs)->ascent|(cs)->descent) == 0))
647 * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit
648 * character. If the character is in the column and exists, then return the
649 * appropriate metrics (note that fonts with common per-character metrics will
650 * return min_bounds). If none of these hold true, try again with the default
653 #define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \
656 if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
657 if (fs->per_char == NULL) { \
658 cs = &fs->min_bounds; \
660 cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
661 if (CI_NONEXISTCHAR(cs)) cs = def; \
666 #define CI_GET_DEFAULT_INFO_1D(fs,cs) \
667 CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs)
672 * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and
673 * column. This is used for fonts that have more than row zero.
675 #define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \
678 if (row >= fs->min_byte1 && row <= fs->max_byte1 && \
679 col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
680 if (fs->per_char == NULL) { \
681 cs = &fs->min_bounds; \
683 cs = &fs->per_char[((row - fs->min_byte1) * \
684 (fs->max_char_or_byte2 - \
685 fs->min_char_or_byte2 + 1)) + \
686 (col - fs->min_char_or_byte2)]; \
687 if (CI_NONEXISTCHAR(cs)) cs = def; \
692 #define CI_GET_DEFAULT_INFO_2D(fs,cs) \
694 unsigned int r = (fs->default_char >> 8); \
695 unsigned int c = (fs->default_char & 0xff); \
696 CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \
702 /* for when 32-bit alignment is not good enough */
703 #define OneDataCard32(dpy,dstaddr,srcvar) \
704 { dpy->bufptr -= 4; Data32 (dpy, (char *) &(srcvar), 4); }
708 /* srcvar must be a variable for large architecture version */
709 #define OneDataCard32(dpy,dstaddr,srcvar) \
710 { *(CARD32 *)(dstaddr) = (srcvar); }
712 #endif /* MUSTCOPY */
714 typedef struct _XInternalAsync {
715 struct _XInternalAsync *next;
720 typedef struct _XAsyncEState {
721 unsigned long min_sequence_number;
722 unsigned long max_sequence_number;
723 unsigned char error_code;
724 unsigned char major_opcode;
725 unsigned short minor_opcode;
726 unsigned char last_error_received;
730 #define DeqAsyncHandler(dpy,handler) { \
731 if (dpy->async_handlers == (handler)) \
732 dpy->async_handlers = (handler)->next; \
734 _XDeqAsyncHandler(dpy, handler); \
738 * This structure is private to the library.
740 typedef struct _XFreeFuncs {
741 void (*atoms)(); /* _XFreeAtomTable */
742 int (*modifiermap)(); /* XFreeModifierMap */
743 void (*key_bindings)(); /* _XFreeKeyBindings */
744 void (*context_db)(); /* _XFreeContextDB */
745 void (*defaultCCCs)(); /* _XcmsFreeDefaultCCCs */
746 void (*clientCmaps)(); /* _XcmsFreeClientCmaps */
747 void (*intensityMaps)(); /* _XcmsFreeIntensityMaps */
748 void (*im_filters)(); /* _XFreeIMFilters */
749 void (*xkb)(); /* _XkbFreeInfo */
753 * This structure is private to the library.
755 typedef struct _XExten { /* private to extension mechanism */
756 struct _XExten *next; /* next in list */
757 XExtCodes codes; /* public information, all extension told */
758 int (*create_GC)(); /* routine to call when GC created */
759 int (*copy_GC)(); /* routine to call when GC copied */
760 int (*flush_GC)(); /* routine to call when GC flushed */
761 int (*free_GC)(); /* routine to call when GC freed */
762 int (*create_Font)(); /* routine to call when Font created */
763 int (*free_Font)(); /* routine to call when Font freed */
764 int (*close_display)(); /* routine to call when connection closed */
765 int (*error)(); /* who to call when an error occurs */
766 char *(*error_string)(); /* routine to supply error string */
767 char *name; /* name of this extension */
768 void (*error_values)(); /* routine to supply error values */
769 void (*before_flush)(); /* routine to call when sending data */
770 struct _XExten *next_flush; /* next in list of those with flushes */
773 /* extension hooks */
777 #ifdef DataRoutineIsProcedure
781 #if NeedFunctionPrototypes
786 extern int _XIOError(
787 #if NeedFunctionPrototypes
791 extern int (*_XIOErrorFunction)(
792 #if NeedNestedPrototypes
796 extern int (*_XErrorFunction)(
797 #if NeedNestedPrototypes
799 XErrorEvent* /* error_event */
802 extern void _XEatData(
803 #if NeedFunctionPrototypes
805 unsigned long /* n */
808 extern char *_XAllocScratch(
809 #if NeedFunctionPrototypes
811 unsigned long /* nbytes */
814 extern char *_XAllocTemp(
815 #if NeedFunctionPrototypes
817 unsigned long /* nbytes */
820 extern void _XFreeTemp(
821 #if NeedFunctionPrototypes
824 unsigned long /* nbytes */
827 extern Visual *_XVIDtoVisual(
828 #if NeedFunctionPrototypes
833 extern unsigned long _XSetLastRequestRead(
834 #if NeedFunctionPrototypes
836 xGenericReply* /* rep */
839 extern int _XGetHostname(
840 #if NeedFunctionPrototypes
845 extern Screen *_XScreenOfWindow(
846 #if NeedFunctionPrototypes
851 extern Bool _XAsyncErrorHandler(
852 #if NeedFunctionPrototypes
860 extern char *_XGetAsyncReply(
861 #if NeedFunctionPrototypes
872 #if NeedFunctionPrototypes
876 extern int _XEventsQueued(
877 #if NeedFunctionPrototypes
883 #if NeedFunctionPrototypes
888 #if NeedFunctionPrototypes
895 #if NeedFunctionPrototypes
902 #if NeedFunctionPrototypes
904 _Xconst char* /* data */,
908 extern Status _XReply(
909 #if NeedFunctionPrototypes
917 #if NeedFunctionPrototypes
923 #if NeedFunctionPrototypes
925 _XQEvent* /* prev */,
930 extern int (*XESetCreateGC(
931 #if NeedFunctionPrototypes
932 Display* /* display */,
935 #if NeedNestedPrototypes
936 Display* /* display */,
938 XExtCodes* /* codes */
943 #if NeedNestedPrototypes
944 Display*, GC, XExtCodes*
948 extern int (*XESetCopyGC(
949 #if NeedFunctionPrototypes
950 Display* /* display */,
953 #if NeedNestedPrototypes
954 Display* /* display */,
956 XExtCodes* /* codes */
961 #if NeedNestedPrototypes
962 Display*, GC, XExtCodes*
966 extern int (*XESetFlushGC(
967 #if NeedFunctionPrototypes
968 Display* /* display */,
971 #if NeedNestedPrototypes
972 Display* /* display */,
974 XExtCodes* /* codes */
979 #if NeedNestedPrototypes
980 Display*, GC, XExtCodes*
984 extern int (*XESetFreeGC(
985 #if NeedFunctionPrototypes
986 Display* /* display */,
989 #if NeedNestedPrototypes
990 Display* /* display */,
992 XExtCodes* /* codes */
997 #if NeedNestedPrototypes
998 Display*, GC, XExtCodes*
1002 extern int (*XESetCreateFont(
1003 #if NeedFunctionPrototypes
1004 Display* /* display */,
1005 int /* extension */,
1007 #if NeedNestedPrototypes
1008 Display* /* display */,
1009 XFontStruct* /* fs */,
1010 XExtCodes* /* codes */
1015 #if NeedNestedPrototypes
1016 Display*, XFontStruct*, XExtCodes*
1020 extern int (*XESetFreeFont(
1021 #if NeedFunctionPrototypes
1022 Display* /* display */,
1023 int /* extension */,
1025 #if NeedNestedPrototypes
1026 Display* /* display */,
1027 XFontStruct* /* fs */,
1028 XExtCodes* /* codes */
1033 #if NeedNestedPrototypes
1034 Display*, XFontStruct*, XExtCodes*
1038 extern int (*XESetCloseDisplay(
1039 #if NeedFunctionPrototypes
1040 Display* /* display */,
1041 int /* extension */,
1043 #if NeedNestedPrototypes
1044 Display* /* display */,
1045 XExtCodes* /* codes */
1050 #if NeedNestedPrototypes
1051 Display*, XExtCodes*
1055 extern int (*XESetError(
1056 #if NeedFunctionPrototypes
1057 Display* /* display */,
1058 int /* extension */,
1060 #if NeedNestedPrototypes
1061 Display* /* display */,
1063 XExtCodes* /* codes */,
1069 #if NeedNestedPrototypes
1070 Display*, xError*, XExtCodes*, int*
1074 extern char* (*XESetErrorString(
1075 #if NeedFunctionPrototypes
1076 Display* /* display */,
1077 int /* extension */,
1079 #if NeedNestedPrototypes
1080 Display* /* display */,
1082 XExtCodes* /* codes */,
1089 #if NeedNestedPrototypes
1090 Display*, int, XExtCodes*, char*, int
1094 extern void (*XESetPrintErrorValues (
1095 #if NeedFunctionPrototypes
1096 Display* /* display */,
1097 int /* extension */,
1099 #if NeedNestedPrototypes
1100 Display* /* display */,
1101 XErrorEvent* /* ev */,
1107 #if NeedNestedPrototypes
1108 Display*, XErrorEvent*, void*
1112 extern Bool (*XESetWireToEvent(
1113 #if NeedFunctionPrototypes
1114 Display* /* display */,
1115 int /* event_number */,
1117 #if NeedNestedPrototypes
1118 Display* /* display */,
1125 #if NeedNestedPrototypes
1126 Display*, XEvent*, xEvent*
1130 extern Status (*XESetEventToWire(
1131 #if NeedFunctionPrototypes
1132 Display* /* display */,
1133 int /* event_number */,
1135 #if NeedNestedPrototypes
1136 Display* /* display */,
1143 #if NeedNestedPrototypes
1144 Display*, XEvent*, xEvent*
1148 extern Bool (*XESetWireToError(
1149 #if NeedFunctionPrototypes
1150 Display* /* display */,
1151 int /* error_number */,
1153 #if NeedNestedPrototypes
1154 Display* /* display */,
1155 XErrorEvent* /* he */,
1161 #if NeedNestedPrototypes
1162 Display*, XErrorEvent*, xError*
1166 extern void (*XESetBeforeFlush(
1167 #if NeedFunctionPrototypes
1168 Display* /* display */,
1169 int /* error_number */,
1171 #if NeedNestedPrototypes
1172 Display* /* display */,
1173 XExtCodes* /* codes */,
1180 #if NeedNestedPrototypes
1181 Display*, XExtCodes*, char*, long
1185 /* internal connections for IMs */
1187 typedef void (*_XInternalConnectionProc)(
1188 #if NeedFunctionPrototypes
1191 XPointer /* call_data */
1196 extern Status _XRegisterInternalConnection(
1197 #if NeedFunctionPrototypes
1200 _XInternalConnectionProc /* callback */,
1201 XPointer /* call_data */
1205 extern void _XUnregisterInternalConnection(
1206 #if NeedFunctionPrototypes
1212 /* Display structure has pointers to these */
1214 struct _XConnectionInfo { /* info from _XRegisterInternalConnection */
1216 _XInternalConnectionProc read_callback;
1218 XPointer *watch_data; /* set/used by XConnectionWatchProc */
1219 struct _XConnectionInfo *next;
1222 struct _XConnWatchInfo { /* info from XAddConnectionWatch */
1223 XConnectionWatchProc fn;
1224 XPointer client_data;
1225 struct _XConnWatchInfo *next;
1228 extern int XTextHeight(
1229 #if NeedFunctionPrototypes
1230 XFontStruct* /* font_struct */,
1231 _Xconst char* /* string */,
1236 extern int XTextHeight16(
1237 #if NeedFunctionPrototypes
1238 XFontStruct* /* font_struct */,
1239 _Xconst XChar2b* /* string */,