home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / osi / isode / vmsisode / vmsisode80_tar.Z / vmsisode80_tar / sockit / gccinclude / x11 / xlib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-24  |  33.9 KB  |  1,005 lines

  1. /* $Header: Xlib.h,v 11.133 87/09/12 02:35:11 rws Exp $ */
  2. /*
  3. *****************************************************************************
  4. **                                                                          *
  5. **                         COPYRIGHT (c) 1988 BY                            *
  6. **             DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.                *
  7. **               ALL RIGHTS RESERVED                              *
  8. **                                                                          *
  9. **  THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED  *
  10. **  ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE  *
  11. **  INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER  *
  12. **  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY  *
  13. **  OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY  *
  14. **  TRANSFERRED.                                                            *
  15. **                                                                          *
  16. **  THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE  *
  17. **  AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT  *
  18. **  CORPORATION.                                                            *
  19. **                                                                          *
  20. **  DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS  *
  21. **  SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.                 *
  22. **                                                                          *
  23. *****************************************************************************
  24. **++
  25. **  FACILITY:
  26. **
  27. **    < to be supplied >
  28. **
  29. **  ABSTRACT:
  30. **
  31. **    < to be supplied >
  32. **
  33. **  ENVIRONMENT:
  34. **
  35. **    < to be supplied >
  36. **
  37. **  MODIFICATION HISTORY:
  38. **
  39. **    < to be supplied >
  40. **
  41. **--
  42. **/
  43.  
  44. /*
  45.  *    Xlib.h - Header definition and support file for the C subroutine
  46.  *    interface library (Xlib) to the X Window System Protocol (V11).
  47.  *    Corresponds to the Beta test release.  Structures and symbols
  48.  *    starting with "_" are private to the library.
  49.  */
  50. #ifndef _XLIB_H_
  51. #define _XLIB_H_
  52.  
  53. #include <types.h>
  54. #include <decw$include/X.h>
  55.  
  56. #define Bool int
  57. #define Status int
  58. #define True 1
  59. #define False 0
  60.  
  61. #define ConnectionNumber(dpy)     ((dpy)->fd)
  62. #define RootWindow(dpy, scr)     (((dpy)->screens[(scr)]).root)
  63. #define DefaultScreen(dpy)     ((dpy)->default_screen)
  64. #define DefaultRootWindow(dpy)     (((dpy)->screens[(dpy)->default_screen]).root)
  65. #define DefaultVisual(dpy, scr) (((dpy)->screens[(scr)]).root_visual)
  66. #define DefaultGC(dpy, scr)     (((dpy)->screens[(scr)]).default_gc)
  67. #define BlackPixel(dpy, scr)     (((dpy)->screens[(scr)]).black_pixel)
  68. #define WhitePixel(dpy, scr)     (((dpy)->screens[(scr)]).white_pixel)
  69. #define AllPlanes         (~0)
  70. #define QLength(dpy)         ((dpy)->qlen)
  71. #define DisplayWidth(dpy, scr)     (((dpy)->screens[(scr)]).width)
  72. #define DisplayHeight(dpy, scr) (((dpy)->screens[(scr)]).height)
  73. #define DisplayWidthMM(dpy, scr)(((dpy)->screens[(scr)]).mwidth)
  74. #define DisplayHeightMM(dpy, scr)(((dpy)->screens[(scr)]).mheight)
  75. #define DisplayPlanes(dpy, scr) (((dpy)->screens[(scr)]).root_depth)
  76. #define DisplayCells(dpy, scr)     (DefaultVisual((dpy), (scr))->map_entries)
  77. #define ScreenCount(dpy)     ((dpy)->nscreens)
  78. #define ServerVendor(dpy)     ((dpy)->vendor)
  79. #define ProtocolVersion(dpy)     ((dpy)->proto_major_version)
  80. #define ProtocolRevision(dpy)     ((dpy)->proto_minor_version)
  81. #define VendorRelease(dpy)     ((dpy)->release)
  82. #define DisplayString(dpy)     ((dpy)->display_name)
  83. #define DefaultDepth(dpy, scr)     (((dpy)->screens[(scr)]).root_depth)
  84. #define DefaultColormap(dpy, scr)(((dpy)->screens[(scr)]).cmap)
  85. #define BitmapUnit(dpy)     ((dpy)->bitmap_unit)
  86. #define BitmapBitOrder(dpy)     ((dpy)->bitmap_bit_order)
  87. #define BitmapPad(dpy)         ((dpy)->bitmap_pad)
  88. #define ImageByteOrder(dpy)     ((dpy)->byte_order)
  89.  
  90. /* macros for screen oriented applications (toolkit) */
  91. #define ScreenOfDisplay(dpy, scr)(&((dpy)->screens[(scr)]))
  92. #define DefaultScreenOfDisplay(dpy) (&((dpy)->screens[(dpy)->default_screen]))
  93. #define DisplayOfScreen(s)    ((s)->display)
  94. #define RootWindowOfScreen(s)    ((s)->root)
  95. #define BlackPixelOfScreen(s)    ((s)->black_pixel)
  96. #define WhitePixelOfScreen(s)    ((s)->white_pixel)
  97. #define DefaultColormapOfScreen(s)((s)->cmap)
  98. #define DefaultDepthOfScreen(s)    ((s)->root_depth)
  99. #define DefaultGCOfScreen(s)    ((s)->default_gc)
  100. #define DefaultVisualOfScreen(s)((s)->root_visual)
  101. #define WidthOfScreen(s)    ((s)->width)
  102. #define HeightOfScreen(s)    ((s)->height)
  103. #define WidthMMOfScreen(s)    ((s)->mwidth)
  104. #define HeightMMOfScreen(s)    ((s)->mheight)
  105. #define PlanesOfScreen(s)    ((s)->root_depth)
  106. #define CellsOfScreen(s)    (DefaultVisualOfScreen((s))->map_entries)
  107. #define MinCmapsOfScreen(s)    ((s)->min_maps)
  108. #define MaxCmapsOfScreen(s)    ((s)->max_maps)
  109. #define DoesSaveUnders(s)    ((s)->save_unders)
  110. #define DoesBackingStore(s)    ((s)->backing_store)
  111. #define EventMaskOfScreen(s)    ((s)->root_input_mask)
  112.  
  113. /*
  114.  * Extensions need a way to hang private data on some structures.
  115.  */
  116. typedef struct _XExtData {
  117.     int number;        /* number returned by XRegisterExtension */
  118.     struct _XExtData *next;    /* next item on list of data for structure */
  119.     int (*free_private)();    /* called to free private storage */
  120.     char *private_data;    /* data private to this extension. */
  121. } XExtData;
  122.  
  123. /*
  124.  * This file contains structures used by the extension mechanism.
  125.  */
  126. typedef struct {        /* public to extension, cannot be changed */
  127.     int extension;        /* extension number */
  128.     int major_opcode;    /* major op-code assigned by server */
  129.     int first_event;    /* first event number for the extension */
  130.     int first_error;    /* first error number for the extension */
  131. } XExtCodes;
  132.  
  133. /*
  134.  * This structure is private to the library.
  135.  */
  136. typedef struct _XExten {    /* private to extension mechanism */
  137.     struct _XExten *next;    /* next in list */
  138.     XExtCodes codes;    /* public information, all extension told */
  139.     int (*create_GC)();    /* routine to call when GC created */
  140.     int (*copy_GC)();    /* routine to call when GC copied */
  141.     int (*flush_GC)();    /* routine to call when GC flushed */
  142.     int (*free_GC)();    /* routine to call when GC freed */
  143.     int (*create_Font)();    /* routine to call when Font created */
  144.     int (*free_Font)();    /* routine to call when Font freed */
  145.     int (*close_display)();    /* routine to call when connection closed */
  146.     int (*error)();        /* who to call when an error occurs */
  147.     int (*error_string)();  /* routine to supply error string */
  148. } _XExtension;
  149.  
  150. /*
  151.  * Data structure for setting graphics context.
  152.  */
  153. typedef struct {
  154.     int function;        /* logical operation */
  155.     unsigned long plane_mask;/* plane mask */
  156.     unsigned long foreground;/* foreground pixel */
  157.     unsigned long background;/* background pixel */
  158.     int line_width;        /* line width */
  159.     int line_style;         /* LineSolid, LineOnOffDash, LineDoubleDash */
  160.     int cap_style;          /* CapNotLast, CapButt, 
  161.                    CapRound, CapProjecting */
  162.     int join_style;         /* JoinMiter, JoinRound, JoinBevel */
  163.     int fill_style;         /* FillSolid, FillTiled, 
  164.                    FillStippled, FillOpaeueStippled */
  165.     int fill_rule;          /* EvenOddRule, WindingRule */
  166.     int arc_mode;        /* ArcChord, ArcPieSlice */
  167.     Pixmap tile;        /* tile pixmap for tiling operations */
  168.     Pixmap stipple;        /* stipple 1 plane pixmap for stipping */
  169.     int ts_x_origin;    /* offset for tile or stipple operations */
  170.     int ts_y_origin;
  171.         Font font;            /* default text font for text operations */
  172.     int subwindow_mode;     /* ClipByChildren, IncludeInferiors */
  173.     Bool graphics_exposures;/* boolean, should exposures be generated */
  174.     int clip_x_origin;    /* origin for clipping */
  175.     int clip_y_origin;
  176.     Pixmap clip_mask;    /* bitmap clipping; other calls for rects */
  177.     int dash_offset;    /* patterned/dashed line information */
  178.     char dashes;
  179. } XGCValues;
  180.  
  181. /*
  182.  * Graphics context.  All Xlib routines deal in this rather than
  183.  * in raw protocol GContext ID's.  This is so that the library can keep
  184.  * a "shadow" set of values, and thus avoid passing values over the
  185.  * wire which are not in fact changing. 
  186.  */
  187.  
  188. typedef struct _XGC {
  189.     XExtData *ext_data;    /* hook for extension to hang data */
  190.     GContext gid;    /* protocol ID for graphics context */
  191.     Bool rects;        /* boolean: TRUE if clipmask is list of rectangles */
  192.     Bool dashes;    /* boolean: TRUE if dash-list is really a list */
  193.     unsigned long dirty;/* cache dirty bits */
  194.     XGCValues values;    /* shadow structure of values */
  195. } *GC;
  196.  
  197.  
  198. /*
  199.  * Visual structure; contains information about colormapping possible.
  200.  */
  201. typedef struct {
  202.     XExtData *ext_data;    /* hook for extension to hang data */
  203.     VisualID visualid;    /* visual id of this visual */
  204.     int class;        /* class of screen (monochrome, etc.) */
  205.     unsigned long red_mask, green_mask, blue_mask;    /* mask values */
  206.     int bits_per_rgb;    /* log base 2 of distinct color values */
  207.     int map_entries;    /* color map entries */
  208. } Visual;
  209.  
  210. /*
  211.  * Depth structure; contains information for each possible depth.
  212.  */    
  213. typedef struct {
  214.     int depth;        /* this depth (Z) of the depth */
  215.     int nvisuals;        /* number of Visual types at this depth */
  216.     Visual *visuals;    /* list of visuals possible at this depth */
  217. } Depth;
  218.  
  219. /*
  220.  * Information about the screen.
  221.  */
  222. typedef struct {
  223.     XExtData *ext_data;    /* hook for extension to hang data */
  224.     struct _XDisplay *display;/* back pointer to display structure */
  225.     Window root;        /* Root window id. */
  226.     int width, height;    /* width and height of screen */
  227.     int mwidth, mheight;    /* width and height of  in millimeters */
  228.     int ndepths;        /* number of depths possible */
  229.     Depth *depths;        /* list of allowable depths on the screen */
  230.     int root_depth;        /* bits per pixel */
  231.     Visual *root_visual;    /* root visual */
  232.     GC default_gc;        /* GC for the root root visual */
  233.     Colormap cmap;        /* default color map */
  234.     unsigned long white_pixel;
  235.     unsigned long black_pixel;    /* White and Black pixel values */
  236.     int max_maps, min_maps;    /* max and min color maps */
  237.     int backing_store;    /* Never, WhenMapped, Always */
  238.     Bool save_unders;    
  239.     long root_input_mask;    /* initial root input mask */
  240. } Screen;
  241.  
  242. /*
  243.  * Format structure; describes ZFormat data the screen will understand.
  244.  */
  245. typedef struct {
  246.     XExtData *ext_data;    /* hook for extension to hang data */
  247.     int depth;        /* depth of this image format */
  248.     int bits_per_pixel;    /* bits/pixel at this depth */
  249.     int scanline_pad;    /* scanline must padded to this multiple */
  250. } ScreenFormat;
  251.  
  252. #ifndef _XSTRUCT_    /* hack to reduce symbol load in Xlib routines */
  253. /*
  254.  * Data structure for setting window attributes.
  255.  */
  256. typedef struct {
  257.     Pixmap background_pixmap;    /* background or None or ParentRelative */
  258.     unsigned long background_pixel;    /* background pixel */
  259.     Pixmap border_pixmap;    /* border of the window */
  260.     unsigned long border_pixel;    /* border pixel value */
  261.     int bit_gravity;        /* one of bit gravity values */
  262.     int win_gravity;        /* one of the window gravity values */
  263.     int backing_store;        /* NotUseful, WhenMapped, Always */
  264.     unsigned long backing_planes;/* planes to be preseved if possible */
  265.     unsigned long backing_pixel;/* value to use in restoring planes */
  266.     Bool save_under;        /* should bits under be saved? (popups) */
  267.     long event_mask;        /* set of events that should be saved */
  268.     long do_not_propagate_mask;    /* set of events that should not propagate */
  269.     Bool override_redirect;    /* boolean value for override-redirect */
  270.     Colormap colormap;        /* color map to be associated with window */
  271.     Cursor cursor;        /* cursor to be displayed (or None) */
  272. } XSetWindowAttributes;
  273.  
  274. typedef struct {
  275.     int x, y;            /* location of window */
  276.     int width, height;        /* width and height of window */
  277.     int border_width;        /* border width of window */
  278.     int depth;              /* depth of window */
  279.     Visual *visual;        /* the associated visual structure */
  280.     Window root;            /* root of screen containing window */
  281.     int class;            /* InputOutput, InputOnly*/
  282.     int bit_gravity;        /* one of bit gravity values */
  283.     int win_gravity;        /* one of the window gravity values */
  284.     int backing_store;        /* NotUseful, WhenMapped, Always */
  285.     unsigned long backing_planes;/* planes to be preserved if possible */
  286.     unsigned long backing_pixel;/* value to be used when restoring planes */
  287.     Bool save_under;        /* boolean, should bits under be saved? */
  288.     Colormap colormap;        /* color map to be associated with window */
  289.     Bool map_installed;        /* boolean, is color map currently installed*/
  290.     int map_state;        /* IsUnmapped, IsUnviewable, IsViewable */
  291.     long all_event_masks;    /* set of events all people have interest in*/
  292.     long your_event_mask;    /* my event mask */
  293.     long do_not_propagate_mask; /* set of events that should not propagate */
  294.     Bool override_redirect;    /* boolean value for override-redirect */
  295.     Screen *screen;        /* back pointer to correct screen */
  296. } XWindowAttributes;
  297.  
  298. /*
  299.  * Data structure for host setting; getting routines.
  300.  *
  301.  */
  302.  
  303. typedef struct {
  304.     int family;        /* for example AF_DNET */
  305.     int length;        /* length of address, in bytes */
  306.     char *address;        /* pointer to where to find the bytes */
  307. } XHostAddress;
  308.  
  309. /*
  310.  * Data structure for "image" data, used by image manipulation routines.
  311.  */
  312. typedef struct _XImage {
  313.     int width, height;        /* size of image */
  314.     int xoffset;        /* number of pixels offset in X direction */
  315.     int format;            /* XYBitmap, XYPixmap, ZPixmap */
  316.     char *data;            /* pointer to image data */
  317.     int byte_order;        /* data byte order, LSBFirst, MSBFirst */
  318.     int bitmap_unit;        /* quant. of scanline 8, 16, 32 */
  319.     int bitmap_bit_order;    /* LSBFirst, MSBFirst */
  320.     int bitmap_pad;        /* 8, 16, 32 either XY or ZPixmap */
  321.     int depth;            /* depth of image */
  322.     int bytes_per_line;        /* accelarator to next line */
  323.     int bits_per_pixel;        /* bits per pixel (ZPixmap) */
  324.     unsigned long red_mask;    /* bits in z arrangment */
  325.     unsigned long green_mask;
  326.     unsigned long blue_mask;
  327.     char *obdata;        /* hook for the object routines to hang on */
  328.     struct funcs {        /* image manipulation routines */
  329.     struct _XImage *(*create_image)();
  330.     int (*destroy_image)();
  331.     unsigned long (*get_pixel)();
  332.     int (*put_pixel)();
  333.     struct _XImage *(*sub_image)();
  334.     int (*add_pixel)();
  335.     } f;
  336. } XImage;
  337.  
  338. /* 
  339.  * Data structure for XReconfigureWindow
  340.  */
  341. typedef struct {
  342.     int x, y;
  343.     int width, height;
  344.     int border_width;
  345.     Window sibling;
  346.     int stack_mode;
  347. } XWindowChanges;
  348.  
  349. /*
  350.  * Data structure used by color operations
  351.  */
  352. typedef struct {
  353.     unsigned long pixel;
  354.     unsigned short red, green, blue;
  355.     char flags;  /* do_red, do_green, do_blue */
  356.     char pad;
  357. } XColor;
  358.  
  359. /* 
  360.  * Data structures for graphics operations.  On most machines, these are
  361.  * congruent with the wire protocol structures, so reformatting the data
  362.  * can be avoided on these architectures.
  363.  */
  364. typedef struct {
  365.     short x1, y1, x2, y2;
  366. } XSegment;
  367.  
  368. typedef struct {
  369.     short x, y;
  370. } XPoint;
  371.     
  372. typedef struct {
  373.     short x, y;
  374.     unsigned short width, height;
  375. } XRectangle;
  376.     
  377. typedef struct {
  378.     short x, y;
  379.     unsigned short width, height;
  380.     short angle1, angle2;
  381. } XArc;
  382.  
  383.  
  384. /* Data structure for XChangeKeyboardControl */
  385.  
  386. typedef struct {
  387.         int key_click_percent;
  388.         int bell_percent;
  389.         int bell_pitch;
  390.         int bell_duration;
  391.         int led;
  392.         int led_mode;
  393.         int key;
  394.         int auto_repeat_mode;   /* On, Off, Default */
  395. } XKeyboardControl;
  396.  
  397. /* Data structure for XGetKeyboardControl */
  398.  
  399. typedef struct {
  400.         int key_click_percent;
  401.     int bell_percent;
  402.     unsigned int bell_pitch, bell_duration;
  403.     unsigned long led_mask;
  404.     int global_auto_repeat;
  405.     char auto_repeats[32];
  406. } XKeyboardState;
  407.  
  408. /* Data structure for XGetMotionEvents.  */
  409.  
  410. typedef struct {
  411.         Time time;
  412.     unsigned short x, y;
  413. } XTimeCoord;
  414.  
  415. /* Data structure for X{Set,Get}ModifierMapping */
  416.  
  417. typedef struct {
  418.      int max_keypermod;    /* The server's max # of keys per modifier */
  419.      KeyCode *modifiermap;    /* An 8 by max_keypermod array of modifiers */
  420. } XModifierKeymap;
  421.  
  422. XModifierKeymap *XNewModifiermap(),
  423.         *XGetModifierMapping(),
  424.         *XDeleteModifiermapEntry(),
  425.         *XInsertModifiermapEntry();
  426. #endif /* _XSTRUCT_ */
  427.  
  428. /*
  429.  * Display datatype maintaining display specific data.
  430.  */
  431. typedef struct _XDisplay {
  432.     XExtData *ext_data;    /* hook for extension to hang data */
  433.     struct _XDisplay *next; /* next open Display on list */
  434.     int fd;            /* Network socket. */
  435.     int lock;        /* is someone in critical section? */
  436.     int proto_major_version;/* maj. version of server's X protocol */
  437.     int proto_minor_version;/* minor version of servers X protocol */
  438.     char *vendor;        /* vendor of the server hardware */
  439.         long resource_base;    /* resource ID base */
  440.     long resource_mask;    /* resource ID mask bits */
  441.     long resource_id;    /* allocator current ID */
  442.     int resource_shift;    /* allocator shift to correct bits */
  443.     XID (*resource_alloc)(); /* allocator function */
  444.     int byte_order;        /* screen byte order, LSBFirst, MSBFirst */
  445.     int bitmap_unit;    /* padding and data requirements */
  446.     int bitmap_pad;        /* padding requirements on bitmaps */
  447.     int bitmap_bit_order;    /* LeastSignificant or MostSignificant */
  448.     int nformats;        /* number of pixmap formats in list */
  449.     ScreenFormat *pixmap_format;    /* pixmap format list */
  450.     int vnumber;        /* Xlib's X protocol version number. */
  451.     int release;        /* release of the server */
  452.     struct _XSQEvent *head, *tail;    /* Input event queue. */
  453.     int qlen;        /* Length of input event queue */
  454.     int last_request_read;    /* sequence number of last event read NI */
  455.     int request;        /* sequence number of last request. */
  456.     char *last_req;        /* beginning of last request, or dummy */
  457.     char *buffer;        /* Output buffer starting address. */
  458.     char *bufptr;        /* Output buffer index pointer. */
  459.     char *bufmax;        /* Output buffer maximum+1 address. */
  460.     unsigned max_request_size; /* maximum number 32 bit words in request*/
  461.     struct _XrmResourceDataBase *db;
  462.     int (*synchandler)();    /* Synchronization handler */
  463.     char *display_name;    /* "host:display" string used on this connect*/
  464.     int default_screen;    /* default screen for operations */
  465.     int nscreens;        /* number of screens on this server*/
  466.     Screen *screens;    /* pointer to list of screens */
  467.     int motion_buffer;    /* size of motion buffer */
  468.     Window current;        /* for use internally for Keymap notify */
  469.     int min_keycode;    /* minimum defined keycode */
  470.     int max_keycode;    /* maximum defined keycode */
  471.     KeySym *keysyms;    /* This server's keysyms */
  472.     XModifierKeymap *modifiermap;    /* This server's modifier keymap */
  473.     int keysyms_per_keycode;/* number of rows */
  474.     char *xdefaults;    /* contents of defaults from server */
  475.     char *scratch_buffer;    /* place to hang scratch buffer */
  476.     unsigned long scratch_length;    /* length of scratch buffer */
  477.     int ext_number;        /* extension number on this display */
  478.     _XExtension *ext_procs;    /* extensions initialized on this display */
  479.     /*
  480.      * the following can be fixed size, as the protocol defines how
  481.      * much address space is available. 
  482.      * While this could be done using the extension vector, there
  483.      * may be MANY events processed, so a search through the extension
  484.      * list to find the right procedure for each event might be
  485.      * expensive if many extensions are being used.
  486.      */
  487.     int (*event_vec[128])();/* vector for wire to event */
  488.     int (*wire_vec[128])();    /* vector for event to wire */
  489. #ifdef VMS
  490.     char *xcb;        /* hook for VMS transport */
  491.     struct _XSAsyncItem *asthead, *asttail;    /* AST event enable queue. */
  492.     Bool    enable_setast;    /* temp for v4.6 testing */
  493. #endif /* VMS */
  494. } Display;
  495.  
  496. #ifndef _XEVENT_
  497. /*
  498.  * A "XEvent" structure always  has type as the first entry.  This 
  499.  * uniquely identifies what  kind of event it is.  The second entry
  500.  * is always a pointer to the display the event was read from.
  501.  * The third entry is always a window of one type or another,
  502.  * carefully selected to be useful to toolkit dispatchers.  (Except
  503.  * for keymap events, which have no window.) You
  504.  * must not change the order of the three elements or toolkits will
  505.  * break! The pointer to the generic event must be cast before use to 
  506.  * access any other information in the structure.
  507.  */
  508.  
  509. /*
  510.  * Definitions of specific events.  If new event types are defined here in
  511.  * the future, the Xlibint.h file union for XBiggestEvent should also have
  512.  * the event type added, to make sure that Xlib maintains enough space for
  513.  * the largest event.  We are trying to avoid fragmentation of the malloc
  514.  * pool by keeping the space allocated the same size for all events, even
  515.  * if the actual information is much smaller.
  516.  */
  517. typedef struct {
  518.     int type;        /* of event */
  519.     Display *display;    /* Display the event was read from */
  520.     Window window;            /* "event" window it is reported relative to */
  521.     Window root;            /* root window that the event occured on */
  522.     Window subwindow;    /* child window */
  523.     Time time;        /* milliseconds */
  524.     int x, y;        /* pointer x, y coordinates in event window */
  525.     int x_root, y_root;    /* coordinates relative to root */
  526.     unsigned int state;    /* key or button mask */
  527.     unsigned int keycode;    /* detail */
  528.     Bool same_screen;    /* same screen flag */
  529. } XKeyEvent;
  530. typedef XKeyEvent XKeyPressedEvent;
  531. typedef XKeyEvent XKeyReleasedEvent;
  532.  
  533. typedef struct {
  534.     int type;        /* of event */
  535.     Display *display;    /* Display the event was read from */
  536.     Window window;            /* "event" window it is reported relative to */
  537.     Window root;            /* root window that the event occured on */
  538.     Window subwindow;    /* child window */
  539.     Time time;        /* milliseconds */
  540.     int x, y;        /* pointer x, y coordinates in event window */
  541.     int x_root, y_root;    /* coordinates relative to root */
  542.     unsigned int state;    /* key or button mask */
  543.     unsigned int button;    /* detail */
  544.     Bool same_screen;    /* same screen flag */
  545. } XButtonEvent;
  546. typedef XButtonEvent XButtonPressedEvent;
  547. typedef XButtonEvent XButtonReleasedEvent;
  548.  
  549. typedef struct {
  550.     int type;        /* of event */
  551.     Display *display;    /* Display the event was read from */
  552.     Window window;            /* "event" window reported relative to */
  553.     Window root;            /* root window that the event occured on */
  554.     Window subwindow;    /* child window */
  555.     Time time;        /* milliseconds */
  556.     int x, y;        /* pointer x, y coordinates in event window */
  557.     int x_root, y_root;    /* coordinates relative to root */
  558.     unsigned int state;    /* key or button mask */
  559.     char is_hint;        /* detail */
  560.     Bool same_screen;    /* same screen flag */
  561. } XMotionEvent;
  562. typedef XMotionEvent XPointerMovedEvent;
  563.  
  564. typedef struct {
  565.     int type;        /* of event */
  566.     Display *display;    /* Display the event was read from */
  567.     Window window;            /* "event" window reported relative to */
  568.     Window root;            /* root window that the event occured on */
  569.     Window subwindow;    /* child window */
  570.     Time time;        /* milliseconds */
  571.     int x, y;        /* pointer x, y coordinates in event window */
  572.     int x_root, y_root;    /* coordinates relative to root */
  573.     int mode;        /* NotifyNormal, NotifyGrab, NotifyUngrab */
  574.     int detail;
  575.     /*
  576.      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
  577.      * NotifyNonLinear,NotifyNonLinearVirtual
  578.      */
  579.     Bool same_screen;    /* same screen flag */
  580.     Bool focus;        /* boolean focus */
  581.     unsigned int state;    /* key or button mask */
  582. } XCrossingEvent;
  583. typedef XCrossingEvent XEnterWindowEvent;
  584. typedef XCrossingEvent XLeaveWindowEvent;
  585.  
  586. typedef struct {
  587.     int type;        /* FocusIn or FocusOut */
  588.     Display *display;    /* Display the event was read from */
  589.     Window window;        /* window of event */
  590.     int mode;        /* NotifyNormal, NotifyGrab, NotifyUngrab */
  591.     int detail;
  592.     /*
  593.      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
  594.      * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
  595.      * NotifyPointerRoot, NotifyDetailNone 
  596.      */
  597. } XFocusChangeEvent;
  598. typedef XFocusChangeEvent XFocusInEvent;
  599. typedef XFocusChangeEvent XFocusOutEvent;
  600.  
  601. /* generated on EnterWindow and FocusIn  when KeyMapState selected */
  602. typedef struct {
  603.     int type;
  604.     Display *display;    /* Display the event was read from */
  605.     Window window;
  606.     char key_vector[32];
  607. } XKeymapEvent;    
  608.  
  609. typedef struct {
  610.     int type;
  611.     Display *display;    /* Display the event was read from */
  612.     Window window;
  613.     int x, y;
  614.     int width, height;
  615.     int count;        /* if non-zero, at least this many more */
  616. } XExposeEvent;
  617.  
  618. typedef struct {
  619.     int type;
  620.     Display *display;    /* Display the event was read from */
  621.     Drawable drawable;
  622.     int x, y;
  623.     int width, height;
  624.     int count;        /* if non-zero, at least this many more */
  625.     int major_code;        /* core is CopyArea or CopyPlane */
  626.     int minor_code;        /* not defined in the core */
  627. } XGraphicsExposeEvent;
  628.  
  629. typedef struct {
  630.     int type;
  631.     Display *display;    /* Display the event was read from */
  632.     Drawable drawable;
  633.     int major_code;        /* core is CopyArea or CopyPlane */
  634.     int minor_code;        /* not defined in the core */
  635. } XNoExposeEvent;
  636.  
  637. typedef struct {
  638.     int type;
  639.     Display *display;    /* Display the event was read from */
  640.     Window window;
  641.     int state;        /* either Obscured or UnObscured */
  642. } XVisibilityEvent;
  643.  
  644. typedef struct {
  645.     int type;
  646.     Display *display;    /* Display the event was read from */
  647.     Window parent;        /* parent of the window */
  648.     Window window;        /* window id of window created */
  649.     int x, y;        /* window location */
  650.     int width, height;    /* size of window */
  651.     int border_width;    /* border width */
  652.     Bool override_redirect;    /* creation should be overridden */
  653. } XCreateWindowEvent;
  654.  
  655. typedef struct {
  656.     int type;
  657.     Display *display;    /* Display the event was read from */
  658.     Window event;
  659.     Window window;
  660. } XDestroyWindowEvent;
  661.  
  662. typedef struct {
  663.     int type;
  664.     Display *display;    /* Display the event was read from */
  665.     Window event;
  666.     Window window;
  667.     Bool from_configure;
  668. } XUnmapEvent;
  669.  
  670. typedef struct {
  671.     int type;
  672.     Display *display;    /* Display the event was read from */
  673.     Window event;
  674.     Window window;
  675.     Bool override_redirect;    /* boolean, is override set... */
  676. } XMapEvent;
  677.  
  678. typedef struct {
  679.     int type;
  680.     Display *display;    /* Display the event was read from */
  681.     Window parent;
  682.     Window window;
  683. } XMapRequestEvent;
  684.  
  685. typedef struct {
  686.     int type;
  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.  
  695. typedef struct {
  696.     int type;
  697.     Display *display;    /* Display the event was read from */
  698.     Window event;
  699.     Window window;
  700.     int x, y;
  701.     int width, height;
  702.     int border_width;
  703.     Window above;
  704.     Bool override_redirect;
  705. } XConfigureEvent;
  706.  
  707. typedef struct {
  708.     int type;
  709.     Display *display;    /* Display the event was read from */
  710.     Window event;
  711.     Window window;
  712.     int x, y;
  713. } XGravityEvent;
  714.  
  715. typedef struct {
  716.     int type;
  717.     Display *display;    /* Display the event was read from */
  718.     Window window;
  719.     int width, height;
  720. } XResizeRequestEvent;
  721.  
  722. typedef struct {
  723.     int type;
  724.     Display *display;    /* Display the event was read from */
  725.     Window parent;
  726.     Window window;
  727.     int x, y;
  728.     int width, height;
  729.     int border_width;
  730.     Window above;
  731.     int detail;        /* Above, Below, TopIf, BottomIf, Opposite */
  732.     unsigned long value_mask;
  733. } XConfigureRequestEvent;
  734.  
  735. typedef struct {
  736.     int type;
  737.     Display *display;    /* Display the event was read from */
  738.     Window event;
  739.     Window window;
  740.     int place;        /* PlaceOnTop, PlaceOnBottom */
  741. } XCirculateEvent;
  742.  
  743. typedef struct {
  744.     int type;
  745.     Display *display;    /* Display the event was read from */
  746.     Window parent;
  747.     Window window;
  748.     int place;        /* PlaceOnTop, PlaceOnBottom */
  749. } XCirculateRequestEvent;
  750.  
  751. typedef struct {
  752.     int type;
  753.     Display *display;    /* Display the event was read from */
  754.     Window window;
  755.     Atom atom;
  756.     Time time;
  757.     int state;        /* NewValue, Deleted */
  758. } XPropertyEvent;
  759.  
  760. typedef struct {
  761.     int type;
  762.     Display *display;    /* Display the event was read from */
  763.     Window window;
  764.     Atom selection;
  765.     Time time;
  766. } XSelectionClearEvent;
  767.  
  768. typedef struct {
  769.     int type;
  770.     Display *display;    /* Display the event was read from */
  771.     Window owner;        /* must be next after type */
  772.     Window requestor;
  773.     Atom selection;
  774.     Atom target;
  775.     Atom property;
  776.     Time time;
  777. } XSelectionRequestEvent;
  778.  
  779. typedef struct {
  780.     int type;
  781.     Display *display;    /* Display the event was read from */
  782.     Window requestor;    /* must be next after type */
  783.     Atom selection;
  784.     Atom target;
  785.     Atom property;        /* ATOM or None */
  786.     Time time;
  787. } XSelectionEvent;
  788.  
  789. typedef struct {
  790.     int type;
  791.     Display *display;    /* Display the event was read from */
  792.     Window window;
  793.     Colormap colormap;    /* COLORMAP or None */
  794.     Bool new;
  795.     int state;        /* ColormapInstalled, ColormapUninstalled */
  796. } XColormapEvent;
  797.  
  798. typedef struct {
  799.     int type;
  800.     Display *display;    /* Display the event was read from */
  801.     Window window;
  802.     Atom message_type;
  803.     int format;
  804.     union {
  805.         char b[20];
  806.         short s[10];
  807.         int l[5];
  808.         } data;
  809. } XClientMessageEvent;
  810.  
  811. typedef struct {
  812.     int type;
  813.     Display *display;    /* Display the event was read from */
  814.     Window window;        /* unused */
  815.     int request;        /* one of MappingModifier, MappingKeyboard,
  816.                    MappingPointer */
  817.     int first_keycode;    /* first keycode */
  818.     int count;        /* defines range of change w. first_keycode*/
  819. } XMappingEvent;
  820.  
  821. typedef struct {
  822.     int type;
  823.     Display *display;    /* Display the event was read from */
  824.     XID resourceid;        /* resource id */
  825.     int serial;        /* serial number of failed request */
  826.     char error_code;    /* error code of failed request */
  827.     char request_code;    /* Major op-code of failed request */
  828.     char minor_code;    /* Minor op-code of failed request */
  829. } XErrorEvent;
  830.  
  831. typedef struct {
  832.     int type;
  833.     Display *display;/* Display the event was read from */
  834.     Window window;    /* window on which event was requested in event mask */
  835. } XAnyEvent;
  836.  
  837. /*
  838.  * this union is defined so Xlib can always use the same sized
  839.  * event structure internally, to avoid memory fragmentation.
  840.  */
  841. typedef union _XEvent {
  842.         int type;        /* must not be changed; first element */
  843.     XAnyEvent xany;
  844.     XKeyEvent xkey;
  845.     XButtonEvent xbutton;
  846.     XMotionEvent xmotion;
  847.     XCrossingEvent xcrossing;
  848.     XFocusChangeEvent xfocus;
  849.     XExposeEvent xexpose;
  850.     XGraphicsExposeEvent xgraphicsexpose;
  851.     XNoExposeEvent xnoexpose;
  852.     XVisibilityEvent xvisibility;
  853.     XCreateWindowEvent xcreatewindow;
  854.     XDestroyWindowEvent xdestroywindow;
  855.     XUnmapEvent xunmap;
  856.     XMapEvent xmap;
  857.     XMapRequestEvent xmaprequest;
  858.     XReparentEvent xreparent;
  859.     XConfigureEvent xconfigure;
  860.     XGravityEvent xgravity;
  861.     XResizeRequestEvent xresizerequest;
  862.     XConfigureRequestEvent xconfigurerequest;
  863.     XCirculateEvent xcirculate;
  864.     XCirculateRequestEvent xcirculaterequest;
  865.     XPropertyEvent xproperty;
  866.     XSelectionClearEvent xselectionclear;
  867.     XSelectionRequestEvent xselectionrequest;
  868.     XSelectionEvent xselection;
  869.     XColormapEvent xcolormap;
  870.     XClientMessageEvent xclient;
  871.     XMappingEvent xmapping;
  872.     XErrorEvent xerror;
  873.     XKeymapEvent xkeymap;
  874. } XEvent;
  875. /*
  876.  * _QEvent datatype for use in input queueing.
  877.  */
  878. typedef struct _XSQEvent {
  879.     struct _XSQEvent *next;
  880.     XEvent event;
  881. } _XQEvent;
  882. #endif
  883. #define XAllocID(dpy) ((*(dpy)->resource_alloc)((dpy)))
  884. #ifndef _XSTRUCT_
  885.  
  886. /*
  887.  * per character font metric information.
  888.  */
  889. typedef struct {
  890.     short    lbearing;    /* origin to left edge of raster */
  891.     short    rbearing;    /* origin to right edge of raster */
  892.     short    width;        /* advance to next char's origin */
  893.     short    ascent;        /* baseline to top edge of raster */
  894.     short    descent;    /* baseline to bottom edge of raster */
  895.     unsigned short attributes;    /* per char flags (not predefined) */
  896. } XCharStruct;
  897.  
  898. /*
  899.  * To allow arbitrary information with fonts, there are additional properties
  900.  * returned.
  901.  */
  902. typedef struct {
  903.     Atom name;
  904.     unsigned long card32;
  905. } XFontProp;
  906.  
  907. typedef struct {
  908.     XExtData    *ext_data;    /* hook for extension to hang data */
  909.     Font        fid;            /* Font id for this font */
  910.     unsigned    direction;    /* hint about direction the font is painted */
  911.     unsigned    min_char_or_byte2;/* first character */
  912.     unsigned    max_char_or_byte2;/* last character */
  913.     unsigned    min_byte1;    /* first row that exists */
  914.     unsigned    max_byte1;    /* last row that exists */
  915.     Bool    all_chars_exist;/* flag if all characters have non-zero size*/
  916.     unsigned    default_char;    /* char to print for undefined character */
  917.     int         n_properties;   /* how many properties there are */
  918.     XFontProp    *properties;    /* pointer to array of additional properties*/
  919.     XCharStruct    min_bounds;    /* minimum bounds over all existing char*/
  920.     XCharStruct    max_bounds;    /* minimum bounds over all existing char*/
  921.     XCharStruct    *per_char;    /* first_char to last_char information */
  922.     int        ascent;        /* log. extent above baseline for spacing */
  923.     int        descent;    /* log. descent below baseline for spacing */
  924. } XFontStruct;
  925.  
  926. /*
  927.  * PolyText routines take these as arguments.
  928.  */
  929. typedef struct {
  930.     char *chars;        /* pointer to string */
  931.     int nchars;            /* number of characters */
  932.     int delta;            /* delta between strings */
  933.     Font font;            /* font to print it in, None don't change */
  934. } XTextItem;
  935.  
  936. typedef struct {        /* normal 16 bit characters are two bytes */
  937.     unsigned char byte1;
  938.     unsigned char byte2;
  939. } XChar2b;
  940.  
  941. typedef struct {
  942.     XChar2b *chars;        /* two byte characters */
  943.     int nchars;            /* number of characters */
  944.     int delta;            /* delta between strings */
  945.     Font font;            /* font to print it in, None don't change */
  946. } XTextItem16;
  947.  
  948.  
  949. XFontStruct *XLoadQueryFont(), *XQueryFont();
  950.  
  951. XTimeCoord *XGetMotionEvents();
  952. #endif
  953. /* 
  954.  * X function declarations.
  955.  */
  956. Display *XOpenDisplay();
  957.  
  958. char *XFetchBytes();
  959. char *XFetchBuffer();
  960. char *XGetAtomName();
  961. char *XGetDefault();
  962. char *XDisplayName();
  963. char *XKeysymToString();
  964.  
  965. int (*XSynchronize())();
  966. int (*XSetAfterFunction())();
  967. Atom XInternAtom();
  968. Colormap XCopyColormapAndFree(), XCreateColormap();
  969. Cursor XCreatePixmapCursor(), XCreateGlyphCursor(), XCreateFontCursor();
  970. Font XLoadFont();
  971. GC XCreateGC();
  972. GContext XGContextFromGC();
  973. Pixmap XCreatePixmap();
  974. Pixmap XCreateBitmapFromData();
  975. Window XCreateSimpleWindow(), XGetSelectionOwner(), XGetIconWindow();
  976. Window XCreateWindow(); 
  977. Colormap *XListInstalledColormaps();
  978. char **XListFonts(), **XListFontsWithInfo(), **XGetFontPath();
  979. char **XListExtensions();
  980. Atom *XListProperties();
  981. XImage *XCreateImage(), *XGetImage();
  982. XHostAddress *XListHosts();
  983. KeySym XKeycodeToKeysym(), XLookupKeysym(), *XGetKeyboardMapping();
  984. KeySym XStringToKeysym();
  985.  
  986. /* routines for dealing with extensions */
  987. XExtCodes *XInitExtension();
  988. int (*XESetCreateGC())(), (*XESetCopyGC())(), (*XESetFlushGC())(),
  989.     (*XESetFreeGC())(), (*XESetCreateFont())(), (*XESetFreeFont())(), 
  990.     (*XESetCloseDisplay())(), (*XESetWireToEvent())(), (*XESetEventToWire())(),
  991.     (*XESetError())(), (*XESetErrorString())();
  992.  
  993. /* these are routines for which there are also macros */
  994. Window XRootWindow(), XDefaultRootWindow(), XRootWindowOfScreen();
  995. Visual *XDefaultVisual(), *XDefaultVisualOfScreen();
  996. GC XDefaultGC(), XDefaultGCOfScreen();
  997. unsigned long XBlackPixel(), XWhitePixel(), XAllPlanes();
  998. unsigned long XBlackPixelOfScreen(), XWhitePixelOfScreen();
  999. char *XServerVendor(), *XDisplayString();
  1000. Colormap XDefaultColormap(), XDefaultColormapOfScreen();
  1001. Display *XDisplayOfScreen();
  1002. Screen *XScreenOfDisplay(), *XDefaultScreenOfDisplay();
  1003. long XEventMaskOfScreen();
  1004. #endif /* _XLIB_H_ */
  1005.