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