Debian Codegraph @

pTk/mTk/xlib/X11/Xlib.h

raw
1 /* $XConsortium: Xlib.h,v 11.221 93/07/02 14:13:28 gildea Exp $ */
2 /*
3 * Copyright 1985, 1986, 1987, 1991 by the Massachusetts Institute of Technology
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation for any purpose and without fee is hereby granted, provided
7 * that the above copyright notice appear in all copies and that both that
8 * copyright notice and this permission notice appear in supporting
9 * documentation, and that the name of M.I.T. not be used in advertising
10 * or publicity pertaining to distribution of the software without specific,
11 * written prior permission. M.I.T. makes no representations about the
12 * suitability of this software for any purpose. It is provided "as is"
13 * without express or implied warranty.
14 *
15 * X Window System is a Trademark of MIT.
16 *
17 */
18
19
20 /*
21 * Xlib.h - Header definition and support file for the C subroutine
22 * interface library (Xlib) to the X Window System Protocol (V11).
23 * Structures and symbols starting with "_" are private to the library.
24 */
25 #ifndef _XLIB_H_
26 #define _XLIB_H_
27
28 #define XlibSpecificationRelease 5
29
30 #if !defined(MAC_TCL) && !defined(MAC_OSX_TK)
31 # include <X11/X.h>
32 #endif
33 #ifdef MAC_TCL
34 # include <X.h>
35 # define Cursor XCursor
36 # define Region XRegion
37 #endif
38 #ifdef MAC_OSX_TK
39 # include <X11/X.h>
40 # define Cursor XCursor
41 # define Region XRegion
42 #endif
43
44 /* applications should not depend on these two headers being included! */
45 #ifdef MAC_TCL
46 #include <Xfuncproto.h>
47 #else
48 #include <X11/Xfuncproto.h>
49 #endif
50
51 #ifndef X_WCHAR
52 #ifdef X_NOT_STDC_ENV
53 #define X_WCHAR
54 #endif
55 #endif
56
57 #ifndef X_WCHAR
58 #include <stddef.h>
59 #else
60 /* replace this with #include or typedef appropriate for your system */
61 typedef unsigned long wchar_t;
62 #endif
63
64 typedef char *XPointer;
65
66 #define Bool int
67 #if defined(MAC_TCL) || defined(MAC_OSX_TK)
68 /* Use define rather than typedef, since may need to undefine this later */
69 #define Status int
70 #else
71 typedef int Status;
72 #endif
73 #define True 1
74 #define False 0
75
76 #define QueuedAlready 0
77 #define QueuedAfterReading 1
78 #define QueuedAfterFlush 2
79
80 #define ConnectionNumber(dpy) ((dpy)->fd)
81 #define RootWindow(dpy, scr) (((dpy)->screens[(scr)]).root)
82 #define DefaultScreen(dpy) ((dpy)->default_screen)
83 #define DefaultRootWindow(dpy) (((dpy)->screens[(dpy)->default_screen]).root)
84 #define DefaultVisual(dpy, scr) (((dpy)->screens[(scr)]).root_visual)
85 #define DefaultGC(dpy, scr) (((dpy)->screens[(scr)]).default_gc)
86 #define BlackPixel(dpy, scr) (((dpy)->screens[(scr)]).black_pixel)
87 #define WhitePixel(dpy, scr) (((dpy)->screens[(scr)]).white_pixel)
88 #define AllPlanes ((unsigned long)~0L)
89 #define QLength(dpy) ((dpy)->qlen)
90 #define DisplayWidth(dpy, scr) (((dpy)->screens[(scr)]).width)
91 #define DisplayHeight(dpy, scr) (((dpy)->screens[(scr)]).height)
92 #define DisplayWidthMM(dpy, scr)(((dpy)->screens[(scr)]).mwidth)
93 #define DisplayHeightMM(dpy, scr)(((dpy)->screens[(scr)]).mheight)
94 #define DisplayPlanes(dpy, scr) (((dpy)->screens[(scr)]).root_depth)
95 #define DisplayCells(dpy, scr) (DefaultVisual((dpy), (scr))->map_entries)
96 #define ScreenCount(dpy) ((dpy)->nscreens)
97 #define ServerVendor(dpy) ((dpy)->vendor)
98 #define ProtocolVersion(dpy) ((dpy)->proto_major_version)
99 #define ProtocolRevision(dpy) ((dpy)->proto_minor_version)
100 #define VendorRelease(dpy) ((dpy)->release)
101 #define DisplayString(dpy) ((dpy)->display_name)
102 #define DefaultDepth(dpy, scr) (((dpy)->screens[(scr)]).root_depth)
103 #define DefaultColormap(dpy, scr)(((dpy)->screens[(scr)]).cmap)
104 #define BitmapUnit(dpy) ((dpy)->bitmap_unit)
105 #define BitmapBitOrder(dpy) ((dpy)->bitmap_bit_order)
106 #define BitmapPad(dpy) ((dpy)->bitmap_pad)
107 #define ImageByteOrder(dpy) ((dpy)->byte_order)
108 #define NextRequest(dpy) ((dpy)->request + 1)
109 #define LastKnownRequestProcessed(dpy) ((dpy)->last_request_read)
110
111 /* macros for screen oriented applications (toolkit) */
112 #define ScreenOfDisplay(dpy, scr)(&((dpy)->screens[(scr)]))
113 #define DefaultScreenOfDisplay(dpy) (&((dpy)->screens[(dpy)->default_screen]))
114 #define DisplayOfScreen(s) ((s)->display)
115 #define RootWindowOfScreen(s) ((s)->root)
116 #define BlackPixelOfScreen(s) ((s)->black_pixel)
117 #define WhitePixelOfScreen(s) ((s)->white_pixel)
118 #define DefaultColormapOfScreen(s)((s)->cmap)
119 #define DefaultDepthOfScreen(s) ((s)->root_depth)
120 #define DefaultGCOfScreen(s) ((s)->default_gc)
121 #define DefaultVisualOfScreen(s)((s)->root_visual)
122 #define WidthOfScreen(s) ((s)->width)
123 #define HeightOfScreen(s) ((s)->height)
124 #define WidthMMOfScreen(s) ((s)->mwidth)
125 #define HeightMMOfScreen(s) ((s)->mheight)
126 #define PlanesOfScreen(s) ((s)->root_depth)
127 #define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries)
128 #define MinCmapsOfScreen(s) ((s)->min_maps)
129 #define MaxCmapsOfScreen(s) ((s)->max_maps)
130 #define DoesSaveUnders(s) ((s)->save_unders)
131 #define DoesBackingStore(s) ((s)->backing_store)
132 #define EventMaskOfScreen(s) ((s)->root_input_mask)
133
134 /*
135 * Extensions need a way to hang private data on some structures.
136 */
137 typedef struct _XExtData {
138 int number; /* number returned by XRegisterExtension */
139 struct _XExtData *next; /* next item on list of data for structure */
140 int (*free_private)(); /* called to free private storage */
141 XPointer private_data; /* data private to this extension. */
142 } XExtData;
143
144 /*
145 * This file contains structures used by the extension mechanism.
146 */
147 typedef struct { /* public to extension, cannot be changed */
148 int extension; /* extension number */
149 int major_opcode; /* major op-code assigned by server */
150 int first_event; /* first event number for the extension */
151 int first_error; /* first error number for the extension */
152 } XExtCodes;
153
154 /*
155 * Data structure for retrieving info about pixmap formats.
156 */
157
158 typedef struct {
159 int depth;
160 int bits_per_pixel;
161 int scanline_pad;
162 } XPixmapFormatValues;
163
164
165 /*
166 * Data structure for setting graphics context.
167 */
168 typedef struct {
169 int function; /* logical operation */
170 unsigned long plane_mask;/* plane mask */
171 unsigned long foreground;/* foreground pixel */
172 unsigned long background;/* background pixel */
173 int line_width; /* line width */
174 int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */
175 int cap_style; /* CapNotLast, CapButt,
176 CapRound, CapProjecting */
177 int join_style; /* JoinMiter, JoinRound, JoinBevel */
178 int fill_style; /* FillSolid, FillTiled,
179 FillStippled, FillOpaeueStippled */
180 int fill_rule; /* EvenOddRule, WindingRule */
181 int arc_mode; /* ArcChord, ArcPieSlice */
182 Pixmap tile; /* tile pixmap for tiling operations */
183 Pixmap stipple; /* stipple 1 plane pixmap for stipping */
184 int ts_x_origin; /* offset for tile or stipple operations */
185 int ts_y_origin;
186 Font font; /* default text font for text operations */
187 int subwindow_mode; /* ClipByChildren, IncludeInferiors */
188 Bool graphics_exposures;/* boolean, should exposures be generated */
189 int clip_x_origin; /* origin for clipping */
190 int clip_y_origin;
191 Pixmap clip_mask; /* bitmap clipping; other calls for rects */
192 int dash_offset; /* patterned/dashed line information */
193 char dashes;
194 } XGCValues;
195
196 /*
197 * Graphics context. The contents of this structure are implementation
198 * dependent. A GC should be treated as opaque by application code.
199 */
200
201 typedef XGCValues *GC;
202
203 /*
204 * Visual structure; contains information about colormapping possible.
205 */
206 typedef struct {
207 XExtData *ext_data; /* hook for extension to hang data */
208 VisualID visualid; /* visual id of this visual */
209 #if defined(__cplusplus) || defined(c_plusplus)
210 int c_class; /* C++ class of screen (monochrome, etc.) */
211 #else
212 int class; /* class of screen (monochrome, etc.) */
213 #endif
214 unsigned long red_mask, green_mask, blue_mask; /* mask values */
215 int bits_per_rgb; /* log base 2 of distinct color values */
216 int map_entries; /* color map entries */
217 } Visual;
218
219 /*
220 * Depth structure; contains information for each possible depth.
221 */
222 typedef struct {
223 int depth; /* this depth (Z) of the depth */
224 int nvisuals; /* number of Visual types at this depth */
225 Visual *visuals; /* list of visuals possible at this depth */
226 } Depth;
227
228 /*
229 * Information about the screen. The contents of this structure are
230 * implementation dependent. A Screen should be treated as opaque
231 * by application code.
232 */
233 typedef struct {
234 XExtData *ext_data; /* hook for extension to hang data */
235 struct _XDisplay *display;/* back pointer to display structure */
236 Window root; /* Root window id. */
237 int width, height; /* width and height of screen */
238 int mwidth, mheight; /* width and height of in millimeters */
239 int ndepths; /* number of depths possible */
240 Depth *depths; /* list of allowable depths on the screen */
241 int root_depth; /* bits per pixel */
242 Visual *root_visual; /* root visual */
243 GC default_gc; /* GC for the root root visual */
244 Colormap cmap; /* default color map */
245 unsigned long white_pixel;
246 unsigned long black_pixel; /* White and Black pixel values */
247 int max_maps, min_maps; /* max and min color maps */
248 int backing_store; /* Never, WhenMapped, Always */
249 Bool save_unders;
250 long root_input_mask; /* initial root input mask */
251 } Screen;
252
253 /*
254 * Format structure; describes ZFormat data the screen will understand.
255 */
256 typedef struct {
257 XExtData *ext_data; /* hook for extension to hang data */
258 int depth; /* depth of this image format */
259 int bits_per_pixel; /* bits/pixel at this depth */
260 int scanline_pad; /* scanline must padded to this multiple */
261 } ScreenFormat;
262
263 /*
264 * Data structure for setting window attributes.
265 */
266 typedef struct {
267 Pixmap background_pixmap; /* background or None or ParentRelative */
268 unsigned long background_pixel; /* background pixel */
269 Pixmap border_pixmap; /* border of the window */
270 unsigned long border_pixel; /* border pixel value */
271 int bit_gravity; /* one of bit gravity values */
272 int win_gravity; /* one of the window gravity values */
273 int backing_store; /* NotUseful, WhenMapped, Always */
274 unsigned long backing_planes;/* planes to be preseved if possible */
275 unsigned long backing_pixel;/* value to use in restoring planes */
276 Bool save_under; /* should bits under be saved? (popups) */
277 long event_mask; /* set of events that should be saved */
278 long do_not_propagate_mask; /* set of events that should not propagate */
279 Bool override_redirect; /* boolean value for override-redirect */
280 Colormap colormap; /* color map to be associated with window */
281 Cursor cursor; /* cursor to be displayed (or None) */
282 } XSetWindowAttributes;
283
284 typedef struct {
285 int x, y; /* location of window */
286 int width, height; /* width and height of window */
287 int border_width; /* border width of window */
288 int depth; /* depth of window */
289 Visual *visual; /* the associated visual structure */
290 Window root; /* root of screen containing window */
291 #if defined(__cplusplus) || defined(c_plusplus)
292 int c_class; /* C++ InputOutput, InputOnly*/
293 #else
294 int class; /* InputOutput, InputOnly*/
295 #endif
296 int bit_gravity; /* one of bit gravity values */
297 int win_gravity; /* one of the window gravity values */
298 int backing_store; /* NotUseful, WhenMapped, Always */
299 unsigned long backing_planes;/* planes to be preserved if possible */
300 unsigned long backing_pixel;/* value to be used when restoring planes */
301 Bool save_under; /* boolean, should bits under be saved? */
302 Colormap colormap; /* color map to be associated with window */
303 Bool map_installed; /* boolean, is color map currently installed*/
304 int map_state; /* IsUnmapped, IsUnviewable, IsViewable */
305 long all_event_masks; /* set of events all people have interest in*/
306 long your_event_mask; /* my event mask */
307 long do_not_propagate_mask; /* set of events that should not propagate */
308 Bool override_redirect; /* boolean value for override-redirect */
309 Screen *screen; /* back pointer to correct screen */
310 } XWindowAttributes;
311
312 /*
313 * Data structure for host setting; getting routines.
314 *
315 */
316
317 typedef struct {
318 int family; /* for example FamilyInternet */
319 int length; /* length of address, in bytes */
320 char *address; /* pointer to where to find the bytes */
321 } XHostAddress;
322
323 /*
324 * Data structure for "image" data, used by image manipulation routines.
325 */
326 typedef struct _XImage {
327 int width, height; /* size of image */
328 int xoffset; /* number of pixels offset in X direction */
329 int format; /* XYBitmap, XYPixmap, ZPixmap */
330 char *data; /* pointer to image data */
331 int byte_order; /* data byte order, LSBFirst, MSBFirst */
332 int bitmap_unit; /* quant. of scanline 8, 16, 32 */
333 int bitmap_bit_order; /* LSBFirst, MSBFirst */
334 int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */
335 int depth; /* depth of image */
336 int bytes_per_line; /* accelarator to next line */
337 int bits_per_pixel; /* bits per pixel (ZPixmap) */
338 unsigned long red_mask; /* bits in z arrangment */
339 unsigned long green_mask;
340 unsigned long blue_mask;
341 XPointer obdata; /* hook for the object routines to hang on */
342 struct funcs { /* image manipulation routines */
343 struct _XImage *(*create_image)();
344 #if NeedFunctionPrototypes
345 int (*destroy_image) (struct _XImage *);
346 unsigned long (*get_pixel) (struct _XImage *, int, int);
347 int (*put_pixel) (struct _XImage *, int, int, unsigned long);
348 struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int);
349 int (*add_pixel) (struct _XImage *, long);
350 #else
351 int (*destroy_image)();
352 unsigned long (*get_pixel)();
353 int (*put_pixel)();
354 struct _XImage *(*sub_image)();
355 int (*add_pixel)();
356 #endif
357 } f;
358 } XImage;
359
360 /*
361 * Data structure for XReconfigureWindow
362 */
363 typedef struct {
364 int x, y;
365 int width, height;
366 int border_width;
367 Window sibling;
368 int stack_mode;
369 } XWindowChanges;
370
371 /*
372 * Data structure used by color operations
373 */
374 typedef struct {
375 unsigned long pixel;
376 unsigned short red, green, blue;
377 char flags; /* do_red, do_green, do_blue */
378 char pad;
379 } XColor;
380
381 /*
382 * Data structures for graphics operations. On most machines, these are
383 * congruent with the wire protocol structures, so reformatting the data
384 * can be avoided on these architectures.
385 */
386 typedef struct {
387 short x1, y1, x2, y2;
388 } XSegment;
389
390 typedef struct {
391 short x, y;
392 } XPoint;
393
394 typedef struct {
395 short x, y;
396 unsigned short width, height;
397 } XRectangle;
398
399 typedef struct {
400 short x, y;
401 unsigned short width, height;
402 short angle1, angle2;
403 } XArc;
404
405
406 /* Data structure for XChangeKeyboardControl */
407
408 typedef struct {
409 int key_click_percent;
410 int bell_percent;
411 int bell_pitch;
412 int bell_duration;
413 int led;
414 int led_mode;
415 int key;
416 int auto_repeat_mode; /* On, Off, Default */
417 } XKeyboardControl;
418
419 /* Data structure for XGetKeyboardControl */
420
421 typedef struct {
422 int key_click_percent;
423 int bell_percent;
424 unsigned int bell_pitch, bell_duration;
425 unsigned long led_mask;
426 int global_auto_repeat;
427 char auto_repeats[32];
428 } XKeyboardState;
429
430 /* Data structure for XGetMotionEvents. */
431
432 typedef struct {
433 Time time;
434 short x, y;
435 } XTimeCoord;
436
437 /* Data structure for X{Set,Get}ModifierMapping */
438
439 typedef struct {
440 int max_keypermod; /* The server's max # of keys per modifier */
441 KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */
442 } XModifierKeymap;
443
444
445 /*
446 * Display datatype maintaining display specific data.
447 * The contents of this structure are implementation dependent.
448 * A Display should be treated as opaque by application code.
449 */
450 typedef struct _XDisplay {
451 XExtData *ext_data; /* hook for extension to hang data */
452 struct _XFreeFuncs *free_funcs; /* internal free functions */
453 int fd; /* Network socket. */
454 int conn_checker; /* ugly thing used by _XEventsQueued */
455 int proto_major_version;/* maj. version of server's X protocol */
456 int proto_minor_version;/* minor version of servers X protocol */
457 char *vendor; /* vendor of the server hardware */
458 XID resource_base; /* resource ID base */
459 XID resource_mask; /* resource ID mask bits */
460 XID resource_id; /* allocator current ID */
461 int resource_shift; /* allocator shift to correct bits */
462 XID (*resource_alloc)(); /* allocator function */
463 int byte_order; /* screen byte order, LSBFirst, MSBFirst */
464 int bitmap_unit; /* padding and data requirements */
465 int bitmap_pad; /* padding requirements on bitmaps */
466 int bitmap_bit_order; /* LeastSignificant or MostSignificant */
467 int nformats; /* number of pixmap formats in list */
468 ScreenFormat *pixmap_format; /* pixmap format list */
469 int vnumber; /* Xlib's X protocol version number. */
470 int release; /* release of the server */
471 struct _XSQEvent *head, *tail; /* Input event queue. */
472 int qlen; /* Length of input event queue */
473 unsigned long last_request_read; /* seq number of last event read */
474 unsigned long request; /* sequence number of last request. */
475 char *last_req; /* beginning of last request, or dummy */
476 char *buffer; /* Output buffer starting address. */
477 char *bufptr; /* Output buffer index pointer. */
478 char *bufmax; /* Output buffer maximum+1 address. */
479 unsigned max_request_size; /* maximum number 32 bit words in request*/
480 struct _XrmHashBucketRec *db;
481 int (*synchandler)(); /* Synchronization handler */
482 char *display_name; /* "host:display" string used on this connect*/
483 int default_screen; /* default screen for operations */
484 int nscreens; /* number of screens on this server*/
485 Screen *screens; /* pointer to list of screens */
486 unsigned long motion_buffer; /* size of motion buffer */
487 unsigned long flags; /* internal connection flags */
488 int min_keycode; /* minimum defined keycode */
489 int max_keycode; /* maximum defined keycode */
490 KeySym *keysyms; /* This server's keysyms */
491 XModifierKeymap *modifiermap; /* This server's modifier keymap */
492 int keysyms_per_keycode;/* number of rows */
493 char *xdefaults; /* contents of defaults from server */
494 char *scratch_buffer; /* place to hang scratch buffer */
495 unsigned long scratch_length; /* length of scratch buffer */
496 int ext_number; /* extension number on this display */
497 struct _XExten *ext_procs; /* extensions initialized on this display */
498 /*
499 * the following can be fixed size, as the protocol defines how
500 * much address space is available.
501 * While this could be done using the extension vector, there
502 * may be MANY events processed, so a search through the extension
503 * list to find the right procedure for each event might be
504 * expensive if many extensions are being used.
505 */
506 Bool (*event_vec[128])(); /* vector for wire to event */
507 int (*wire_vec[128])(); /* vector for event to wire */
508 KeySym lock_meaning; /* for XLookupString */
509 struct _XLockInfo *lock; /* multi-thread state, display lock */
510 struct _XInternalAsync *async_handlers; /* for internal async */
511 unsigned long bigreq_size; /* max size of big requests */
512 struct _XLockPtrs *lock_fns; /* pointers to threads functions */
513 /* things above this line should not move, for binary compatibility */
514 struct _XKeytrans *key_bindings; /* for XLookupString */
515 Font cursor_font; /* for XCreateFontCursor */
516 struct _XDisplayAtoms *atoms; /* for XInternAtom */
517 unsigned int mode_switch; /* keyboard group modifiers */
518 struct _XContextDB *context_db; /* context database */
519 Bool (**error_vec)(); /* vector for wire to error */
520 /*
521 * Xcms information
522 */
523 struct {
524 XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */
525 XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */
526 XPointer perVisualIntensityMaps;
527 /* linked list of XcmsIntensityMap */
528 } cms;
529 struct _XIMFilter *im_filters;
530 struct _XSQEvent *qfree; /* unallocated event queue elements */
531 unsigned long next_event_serial_num; /* inserted into next queue elt */
532 int (*savedsynchandler)(); /* user synchandler when Xlib usurps */
533 } Display;
534
535 #if NeedFunctionPrototypes /* prototypes require event type definitions */
536 #undef _XEVENT_
537 #endif
538 #ifndef _XEVENT_
539
540 #define XMaxTransChars 4
541
542 /*
543 * Definitions of specific events.
544 */
545 typedef struct {
546 int type; /* of event */
547 unsigned long serial; /* # of last request processed by server */
548 Bool send_event; /* true if this came from a SendEvent request */
549 Display *display; /* Display the event was read from */
550 Window window; /* "event" window it is reported relative to */
551 Window root; /* root window that the event occured on */
552 Window subwindow; /* child window */
553 Time time; /* milliseconds */
554 int x, y; /* pointer x, y coordinates in event window */
555 int x_root, y_root; /* coordinates relative to root */
556 unsigned int state; /* key or button mask */
557 unsigned int keycode; /* detail */
558 Bool same_screen; /* same screen flag */
559 char trans_chars[XMaxTransChars];
560 /* translated characters */
561 int nbytes;
562 } XKeyEvent;
563 typedef XKeyEvent XKeyPressedEvent;
564 typedef XKeyEvent XKeyReleasedEvent;
565
566 typedef struct {
567 int type; /* of event */
568 unsigned long serial; /* # of last request processed by server */
569 Bool send_event; /* true if this came from a SendEvent request */
570 Display *display; /* Display the event was read from */
571 Window window; /* "event" window it is reported relative to */
572 Window root; /* root window that the event occured on */
573 Window subwindow; /* child window */
574 Time time; /* milliseconds */
575 int x, y; /* pointer x, y coordinates in event window */
576 int x_root, y_root; /* coordinates relative to root */
577 unsigned int state; /* key or button mask */
578 unsigned int button; /* detail */
579 Bool same_screen; /* same screen flag */
580 } XButtonEvent;
581 typedef XButtonEvent XButtonPressedEvent;
582 typedef XButtonEvent XButtonReleasedEvent;
583
584 typedef struct {
585 int type; /* of event */
586 unsigned long serial; /* # of last request processed by server */
587 Bool send_event; /* true if this came from a SendEvent request */
588 Display *display; /* Display the event was read from */
589 Window window; /* "event" window reported relative to */
590 Window root; /* root window that the event occured on */
591 Window subwindow; /* child window */
592 Time time; /* milliseconds */
593 int x, y; /* pointer x, y coordinates in event window */
594 int x_root, y_root; /* coordinates relative to root */
595 unsigned int state; /* key or button mask */
596 char is_hint; /* detail */
597 Bool same_screen; /* same screen flag */
598 } XMotionEvent;
599 typedef XMotionEvent XPointerMovedEvent;
600
601 typedef struct {
602 int type; /* of event */
603 unsigned long serial; /* # of last request processed by server */
604 Bool send_event; /* true if this came from a SendEvent request */
605 Display *display; /* Display the event was read from */
606 Window window; /* "event" window reported relative to */
607 Window root; /* root window that the event occured on */
608 Window subwindow; /* child window */
609 Time time; /* milliseconds */
610 int x, y; /* pointer x, y coordinates in event window */
611 int x_root, y_root; /* coordinates relative to root */
612 int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
613 int detail;
614 /*
615 * NotifyAncestor, NotifyVirtual, NotifyInferior,
616 * NotifyNonlinear,NotifyNonlinearVirtual
617 */
618 Bool same_screen; /* same screen flag */
619 Bool focus; /* boolean focus */
620 unsigned int state; /* key or button mask */
621 } XCrossingEvent;
622 typedef XCrossingEvent XEnterWindowEvent;
623 typedef XCrossingEvent XLeaveWindowEvent;
624
625 typedef struct {
626 int type; /* FocusIn or FocusOut */
627 unsigned long serial; /* # of last request processed by server */
628 Bool send_event; /* true if this came from a SendEvent request */
629 Display *display; /* Display the event was read from */
630 Window window; /* window of event */
631 int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */
632 int detail;
633 /*
634 * NotifyAncestor, NotifyVirtual, NotifyInferior,
635 * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
636 * NotifyPointerRoot, NotifyDetailNone
637 */
638 } XFocusChangeEvent;
639 typedef XFocusChangeEvent XFocusInEvent;
640 typedef XFocusChangeEvent XFocusOutEvent;
641
642 /* generated on EnterWindow and FocusIn when KeyMapState selected */
643 typedef struct {
644 int type;
645 unsigned long serial; /* # of last request processed by server */
646 Bool send_event; /* true if this came from a SendEvent request */
647 Display *display; /* Display the event was read from */
648 Window window;
649 char key_vector[32];
650 } XKeymapEvent;
651
652 typedef struct {
653 int type;
654 unsigned long serial; /* # of last request processed by server */
655 Bool send_event; /* true if this came from a SendEvent request */
656 Display *display; /* Display the event was read from */
657 Window window;
658 int x, y;
659 int width, height;
660 int count; /* if non-zero, at least this many more */
661 } XExposeEvent;
662
663 typedef struct {
664 int type;
665 unsigned long serial; /* # of last request processed by server */
666 Bool send_event; /* true if this came from a SendEvent request */
667 Display *display; /* Display the event was read from */
668 Drawable drawable;
669 int x, y;
670 int width, height;
671 int count; /* if non-zero, at least this many more */
672 int major_code; /* core is CopyArea or CopyPlane */
673 int minor_code; /* not defined in the core */
674 } XGraphicsExposeEvent;
675
676 typedef struct {
677 int type;
678 unsigned long serial; /* # of last request processed by server */
679 Bool send_event; /* true if this came from a SendEvent request */
680 Display *display; /* Display the event was read from */
681 Drawable drawable;
682 int major_code; /* core is CopyArea or CopyPlane */
683 int minor_code; /* not defined in the core */
684 } XNoExposeEvent;
685
686 typedef struct {
687 int type;
688 unsigned long serial; /* # of last request processed by server */
689 Bool send_event; /* true if this came from a SendEvent request */
690 Display *display; /* Display the event was read from */
691 Window window;
692 int state; /* Visibility state */
693 } XVisibilityEvent;
694
695 typedef struct {
696 int type;
697 unsigned long serial; /* # of last request processed by server */
698 Bool send_event; /* true if this came from a SendEvent request */
699 Display *display; /* Display the event was read from */
700 Window parent; /* parent of the window */
701 Window window; /* window id of window created */
702 int x, y; /* window location */
703 int width, height; /* size of window */
704 int border_width; /* border width */
705 Bool override_redirect; /* creation should be overridden */
706 } XCreateWindowEvent;
707
708 typedef struct {
709 int type;
710 unsigned long serial; /* # of last request processed by server */
711 Bool send_event; /* true if this came from a SendEvent request */
712 Display *display; /* Display the event was read from */
713 Window event;
714 Window window;
715 } XDestroyWindowEvent;
716
717 typedef struct {
718 int type;
719 unsigned long serial; /* # of last request processed by server */
720 Bool send_event; /* true if this came from a SendEvent request */
721 Display *display; /* Display the event was read from */
722 Window event;
723 Window window;
724 Bool from_configure;
725 } XUnmapEvent;
726
727 typedef struct {
728 int type;
729 unsigned long serial; /* # of last request processed by server */
730 Bool send_event; /* true if this came from a SendEvent request */
731 Display *display; /* Display the event was read from */
732 Window event;
733 Window window;
734 Bool override_redirect; /* boolean, is override set... */
735 } XMapEvent;
736
737 typedef struct {
738 int type;
739 unsigned long serial; /* # of last request processed by server */
740 Bool send_event; /* true if this came from a SendEvent request */
741 Display *display; /* Display the event was read from */
742 Window parent;
743 Window window;
744 } XMapRequestEvent;
745
746 typedef struct {
747 int type;
748 unsigned long serial; /* # of last request processed by server */
749 Bool send_event; /* true if this came from a SendEvent request */
750 Display *display; /* Display the event was read from */
751 Window event;
752 Window window;
753 Window parent;
754 int x, y;
755 Bool override_redirect;
756 } XReparentEvent;
757
758 typedef struct {
759 int type;
760 unsigned long serial; /* # of last request processed by server */
761 Bool send_event; /* true if this came from a SendEvent request */
762 Display *display; /* Display the event was read from */
763 Window event;
764 Window window;
765 int x, y;
766 int width, height;
767 int border_width;
768 Window above;
769 Bool override_redirect;
770 } XConfigureEvent;
771
772 typedef struct {
773 int type;
774 unsigned long serial; /* # of last request processed by server */
775 Bool send_event; /* true if this came from a SendEvent request */
776 Display *display; /* Display the event was read from */
777 Window event;
778 Window window;
779 int x, y;
780 } XGravityEvent;
781
782 typedef struct {
783 int type;
784 unsigned long serial; /* # of last request processed by server */
785 Bool send_event; /* true if this came from a SendEvent request */
786 Display *display; /* Display the event was read from */
787 Window window;
788 int width, height;
789 } XResizeRequestEvent;
790
791 typedef struct {
792 int type;
793 unsigned long serial; /* # of last request processed by server */
794 Bool send_event; /* true if this came from a SendEvent request */
795 Display *display; /* Display the event was read from */
796 Window parent;
797 Window window;
798 int x, y;
799 int width, height;
800 int border_width;
801 Window above;
802 int detail; /* Above, Below, TopIf, BottomIf, Opposite */
803 unsigned long value_mask;
804 } XConfigureRequestEvent;
805
806 typedef struct {
807 int type;
808 unsigned long serial; /* # of last request processed by server */
809 Bool send_event; /* true if this came from a SendEvent request */
810 Display *display; /* Display the event was read from */
811 Window event;
812 Window window;
813 int place; /* PlaceOnTop, PlaceOnBottom */
814 } XCirculateEvent;
815
816 typedef struct {
817 int type;
818 unsigned long serial; /* # of last request processed by server */
819 Bool send_event; /* true if this came from a SendEvent request */
820 Display *display; /* Display the event was read from */
821 Window parent;
822 Window window;
823 int place; /* PlaceOnTop, PlaceOnBottom */
824 } XCirculateRequestEvent;
825
826 typedef struct {
827 int type;
828 unsigned long serial; /* # of last request processed by server */
829 Bool send_event; /* true if this came from a SendEvent request */
830 Display *display; /* Display the event was read from */
831 Window window;
832 Atom atom;
833 Time time;
834 int state; /* NewValue, Deleted */
835 } XPropertyEvent;
836
837 typedef struct {
838 int type;
839 unsigned long serial; /* # of last request processed by server */
840 Bool send_event; /* true if this came from a SendEvent request */
841 Display *display; /* Display the event was read from */
842 Window window;
843 Atom selection;
844 Time time;
845 } XSelectionClearEvent;
846
847 typedef struct {
848 int type;
849 unsigned long serial; /* # of last request processed by server */
850 Bool send_event; /* true if this came from a SendEvent request */
851 Display *display; /* Display the event was read from */
852 Window owner;
853 Window requestor;
854 Atom selection;
855 Atom target;
856 Atom property;
857 Time time;
858 } XSelectionRequestEvent;
859
860 typedef struct {
861 int type;
862 unsigned long serial; /* # of last request processed by server */
863 Bool send_event; /* true if this came from a SendEvent request */
864 Display *display; /* Display the event was read from */
865 Window requestor;
866 Atom selection;
867 Atom target;
868 Atom property; /* ATOM or None */
869 Time time;
870 } XSelectionEvent;
871
872 typedef struct {
873 int type;
874 unsigned long serial; /* # of last request processed by server */
875 Bool send_event; /* true if this came from a SendEvent request */
876 Display *display; /* Display the event was read from */
877 Window window;
878 Colormap colormap; /* COLORMAP or None */
879 #if defined(__cplusplus) || defined(c_plusplus)
880 Bool c_new; /* C++ */
881 #else
882 Bool new;
883 #endif
884 int state; /* ColormapInstalled, ColormapUninstalled */
885 } XColormapEvent;
886
887 typedef struct {
888 int type;
889 unsigned long serial; /* # of last request processed by server */
890 Bool send_event; /* true if this came from a SendEvent request */
891 Display *display; /* Display the event was read from */
892 Window window;
893 Atom message_type;
894 int format;
895 union {
896 char b[20];
897 short s[10];
898 long l[5];
899 } data;
900 } XClientMessageEvent;
901
902 typedef struct {
903 int type;
904 unsigned long serial; /* # of last request processed by server */
905 Bool send_event; /* true if this came from a SendEvent request */
906 Display *display; /* Display the event was read from */
907 Window window; /* unused */
908 int request; /* one of MappingModifier, MappingKeyboard,
909 MappingPointer */
910 int first_keycode; /* first keycode */
911 int count; /* defines range of change w. first_keycode*/
912 } XMappingEvent;
913
914 typedef struct {
915 int type;
916 Display *display; /* Display the event was read from */
917 XID resourceid; /* resource id */
918 unsigned long serial; /* serial number of failed request */
919 unsigned char error_code; /* error code of failed request */
920 unsigned char request_code; /* Major op-code of failed request */
921 unsigned char minor_code; /* Minor op-code of failed request */
922 } XErrorEvent;
923
924 typedef struct {
925 int type;
926 unsigned long serial; /* # of last request processed by server */
927 Bool send_event; /* true if this came from a SendEvent request */
928 Display *display;/* Display the event was read from */
929 Window window; /* window on which event was requested in event mask */
930 } XAnyEvent;
931
932 /*
933 * this union is defined so Xlib can always use the same sized
934 * event structure internally, to avoid memory fragmentation.
935 */
936 typedef union _XEvent {
937 int type; /* must not be changed; first element */
938 XAnyEvent xany;
939 XKeyEvent xkey;
940 XButtonEvent xbutton;
941 XMotionEvent xmotion;
942 XCrossingEvent xcrossing;
943 XFocusChangeEvent xfocus;
944 XExposeEvent xexpose;
945 XGraphicsExposeEvent xgraphicsexpose;
946 XNoExposeEvent xnoexpose;
947 XVisibilityEvent xvisibility;
948 XCreateWindowEvent xcreatewindow;
949 XDestroyWindowEvent xdestroywindow;
950 XUnmapEvent xunmap;
951 XMapEvent xmap;
952 XMapRequestEvent xmaprequest;
953 XReparentEvent xreparent;
954 XConfigureEvent xconfigure;
955 XGravityEvent xgravity;
956 XResizeRequestEvent xresizerequest;
957 XConfigureRequestEvent xconfigurerequest;
958 XCirculateEvent xcirculate;
959 XCirculateRequestEvent xcirculaterequest;
960 XPropertyEvent xproperty;
961 XSelectionClearEvent xselectionclear;
962 XSelectionRequestEvent xselectionrequest;
963 XSelectionEvent xselection;
964 XColormapEvent xcolormap;
965 XClientMessageEvent xclient;
966 XMappingEvent xmapping;
967 XErrorEvent xerror;
968 XKeymapEvent xkeymap;
969 long pad[24];
970 } XEvent;
971 #endif
972
973 #define XAllocID(dpy) ((*(dpy)->resource_alloc)((dpy)))
974
975 /*
976 * per character font metric information.
977 */
978 typedef struct {
979 short lbearing; /* origin to left edge of raster */
980 short rbearing; /* origin to right edge of raster */
981 short width; /* advance to next char's origin */
982 short ascent; /* baseline to top edge of raster */
983 short descent; /* baseline to bottom edge of raster */
984 unsigned short attributes; /* per char flags (not predefined) */
985 } XCharStruct;
986
987 /*
988 * To allow arbitrary information with fonts, there are additional properties
989 * returned.
990 */
991 typedef struct {
992 Atom name;
993 unsigned long card32;
994 } XFontProp;
995
996 typedef struct {
997 XExtData *ext_data; /* hook for extension to hang data */
998 Font fid; /* Font id for this font */
999 unsigned direction; /* hint about direction the font is painted */
1000 unsigned min_char_or_byte2;/* first character */
1001 unsigned max_char_or_byte2;/* last character */
1002 unsigned min_byte1; /* first row that exists */
1003 unsigned max_byte1; /* last row that exists */
1004 Bool all_chars_exist;/* flag if all characters have non-zero size*/
1005 unsigned default_char; /* char to print for undefined character */
1006 int n_properties; /* how many properties there are */
1007 XFontProp *properties; /* pointer to array of additional properties*/
1008 XCharStruct min_bounds; /* minimum bounds over all existing char*/
1009 XCharStruct max_bounds; /* maximum bounds over all existing char*/
1010 XCharStruct *per_char; /* first_char to last_char information */
1011 int ascent; /* log. extent above baseline for spacing */
1012 int descent; /* log. descent below baseline for spacing */
1013 } XFontStruct;
1014
1015 /*
1016 * PolyText routines take these as arguments.
1017 */
1018 typedef struct {
1019 char *chars; /* pointer to string */
1020 int nchars; /* number of characters */
1021 int delta; /* delta between strings */
1022 Font font; /* font to print it in, None don't change */
1023 } XTextItem;
1024
1025 typedef struct { /* normal 16 bit characters are two bytes */
1026 unsigned char byte1;
1027 unsigned char byte2;
1028 } XChar2b;
1029
1030 typedef struct {
1031 XChar2b *chars; /* two byte characters */
1032 int nchars; /* number of characters */
1033 int delta; /* delta between strings */
1034 Font font; /* font to print it in, None don't change */
1035 } XTextItem16;
1036
1037
1038 typedef union { Display *display;
1039 GC gc;
1040 Visual *visual;
1041 Screen *screen;
1042 ScreenFormat *pixmap_format;
1043 XFontStruct *font; } XEDataObject;
1044
1045 typedef struct {
1046 XRectangle max_ink_extent;
1047 XRectangle max_logical_extent;
1048 } XFontSetExtents;
1049
1050 typedef struct _XFontSet *XFontSet;
1051
1052 typedef struct {
1053 char *chars;
1054 int nchars;
1055 int delta;
1056 XFontSet font_set;
1057 } XmbTextItem;
1058
1059 typedef struct {
1060 wchar_t *chars;
1061 int nchars;
1062 int delta;
1063 XFontSet font_set;
1064 } XwcTextItem;
1065
1066 typedef void (*XIMProc)();
1067
1068 typedef struct _XIM *XIM;
1069 typedef struct _XIC *XIC;
1070
1071 typedef unsigned long XIMStyle;
1072
1073 typedef struct {
1074 unsigned short count_styles;
1075 XIMStyle *supported_styles;
1076 } XIMStyles;
1077
1078 #define XIMPreeditArea 0x0001L
1079 #define XIMPreeditCallbacks 0x0002L
1080 #define XIMPreeditPosition 0x0004L
1081 #define XIMPreeditNothing 0x0008L
1082 #define XIMPreeditNone 0x0010L
1083 #define XIMStatusArea 0x0100L
1084 #define XIMStatusCallbacks 0x0200L
1085 #define XIMStatusNothing 0x0400L
1086 #define XIMStatusNone 0x0800L
1087
1088 #define XNVaNestedList "XNVaNestedList"
1089 #define XNClientWindow "clientWindow"
1090 #define XNInputStyle "inputStyle"
1091 #define XNFocusWindow "focusWindow"
1092 #define XNResourceName "resourceName"
1093 #define XNResourceClass "resourceClass"
1094 #define XNGeometryCallback "geometryCallback"
1095 #define XNFilterEvents "filterEvents"
1096 #define XNPreeditStartCallback "preeditStartCallback"
1097 #define XNPreeditDoneCallback "preeditDoneCallback"
1098 #define XNPreeditDrawCallback "preeditDrawCallback"
1099 #define XNPreeditCaretCallback "preeditCaretCallback"
1100 #define XNPreeditAttributes "preeditAttributes"
1101 #define XNStatusStartCallback "statusStartCallback"
1102 #define XNStatusDoneCallback "statusDoneCallback"
1103 #define XNStatusDrawCallback "statusDrawCallback"
1104 #define XNStatusAttributes "statusAttributes"
1105 #define XNArea "area"
1106 #define XNAreaNeeded "areaNeeded"
1107 #define XNSpotLocation "spotLocation"
1108 #define XNColormap "colorMap"
1109 #define XNStdColormap "stdColorMap"
1110 #define XNForeground "foreground"
1111 #define XNBackground "background"
1112 #define XNBackgroundPixmap "backgroundPixmap"
1113 #define XNFontSet "fontSet"
1114 #define XNLineSpace "lineSpace"
1115 #define XNCursor "cursor"
1116
1117 #define XBufferOverflow -1
1118 #define XLookupNone 1
1119 #define XLookupChars 2
1120 #define XLookupKeySym 3
1121 #define XLookupBoth 4
1122
1123 #if NeedFunctionPrototypes
1124 typedef void *XVaNestedList;
1125 #else
1126 typedef XPointer XVaNestedList;
1127 #endif
1128
1129 typedef struct {
1130 XPointer client_data;
1131 XIMProc callback;
1132 } XIMCallback;
1133
1134 typedef unsigned long XIMFeedback;
1135
1136 #define XIMReverse 1
1137 #define XIMUnderline (1<<1)
1138 #define XIMHighlight (1<<2)
1139 #define XIMPrimary (1<<5)
1140 #define XIMSecondary (1<<6)
1141 #define XIMTertiary (1<<7)
1142
1143 typedef struct _XIMText {
1144 unsigned short length;
1145 XIMFeedback *feedback;
1146 Bool encoding_is_wchar;
1147 union {
1148 char *multi_byte;
1149 wchar_t *wide_char;
1150 } string;
1151 } XIMText;
1152
1153 typedef struct _XIMPreeditDrawCallbackStruct {
1154 int caret; /* Cursor offset within pre-edit string */
1155 int chg_first; /* Starting change position */
1156 int chg_length; /* Length of the change in character count */
1157 XIMText *text;
1158 } XIMPreeditDrawCallbackStruct;
1159
1160 typedef enum {
1161 XIMForwardChar, XIMBackwardChar,
1162 XIMForwardWord, XIMBackwardWord,
1163 XIMCaretUp, XIMCaretDown,
1164 XIMNextLine, XIMPreviousLine,
1165 XIMLineStart, XIMLineEnd,
1166 XIMAbsolutePosition,
1167 XIMDontChange
1168 } XIMCaretDirection;
1169
1170 typedef enum {
1171 XIMIsInvisible, /* Disable caret feedback */
1172 XIMIsPrimary, /* UI defined caret feedback */
1173 XIMIsSecondary /* UI defined caret feedback */
1174 } XIMCaretStyle;
1175
1176 typedef struct _XIMPreeditCaretCallbackStruct {
1177 int position; /* Caret offset within pre-edit string */
1178 XIMCaretDirection direction; /* Caret moves direction */
1179 XIMCaretStyle style; /* Feedback of the caret */
1180 } XIMPreeditCaretCallbackStruct;
1181
1182 typedef enum {
1183 XIMTextType,
1184 XIMBitmapType
1185 } XIMStatusDataType;
1186
1187 typedef struct _XIMStatusDrawCallbackStruct {
1188 XIMStatusDataType type;
1189 union {
1190 XIMText *text;
1191 Pixmap bitmap;
1192 } data;
1193 } XIMStatusDrawCallbackStruct;
1194
1195 typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */
1196 #if NeedFunctionPrototypes
1197 Display* /* display */,
1198 XErrorEvent* /* error_event */
1199 #endif
1200 );
1201
1202 _XFUNCPROTOBEGIN
1203
1204
1205
1206 #include "pTk/tkIntXlibDecls.h"
1207
1208 _XFUNCPROTOEND
1209
1210 #if defined(MAC_TCL) || defined(MAC_OSX_TK)
1211 # undef Cursor
1212 #endif
1213
1214 #endif /* _XLIB_H_ */