Xlib.h
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:40k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

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