Home | History | Annotate | Line # | Download | only in extensions
      1 /* $XFree86$ */
      2 #ifndef __XTRAPLIB__
      3 #define __XTRAPLIB__
      4 
      5 
      6 /*****************************************************************************
      7 Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp.,
      8 Maynard, MA
      9 
     10 Permission to use, copy, modify, and distribute this software and its
     11 documentation for any purpose and without fee is hereby granted,
     12 provided that the above copyright notice appear in all copies and that
     13 both that copyright notice and this permission notice appear in
     14 supporting documentation, and that the name of Digital not be
     15 used in advertising or publicity pertaining to distribution of the
     16 software without specific, written prior permission.
     17 
     18 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
     19 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
     20 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
     21 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     22 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     23 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     24 SOFTWARE.
     25 
     26 *****************************************************************************/
     27 /*
     28  *
     29  *  CONTRIBUTORS:
     30  *
     31  *      Dick Annicchiarico
     32  *      Robert Chesler
     33  *      Dan Coutu
     34  *      Gene Durso
     35  *      Marc Evans
     36  *      Alan Jamison
     37  *      Mark Henry
     38  *      Ken Miller
     39  *
     40  *  DESCRIPTION:
     41  *      This header file describes all the structures/constants required
     42  *      for interfacing with the client toolkit *except* the common
     43  *      client/extension definitions in xtrapdi.h.  Namely, *no* extension-
     44  *      only information or client/extension information can be found here.
     45  */
     46 #ifdef SMT
     47 #define NEED_EVENTS
     48 #define NEED_REPLIES
     49 #endif
     50 #include <X11/Xlib.h>
     51 #include <X11/Intrinsic.h>
     52 #include <X11/extensions/xtrapdi.h>
     53 #include <X11/extensions/xtrapemacros.h>
     54 
     55 typedef struct _XETC XETC;
     56 
     57 typedef int  (*int_function)(XETC *tc, XETrapDatum *pdatum, BYTE *userp);
     58 typedef void (*void_function)(XETC *tc, XETrapDatum *pdatum, BYTE *userp);
     59 
     60 typedef struct  /* Callback structure */
     61 {
     62     void_function func;
     63     BYTE          *data;
     64 } XETrapCB;
     65 
     66 /* Data structure for setting trap context */
     67 typedef struct
     68 {
     69     CARD8       tc_flags[2L];  /* Toolkit-side specific flags */
     70     XETrapCfg   v;             /* XTrap configuration values */
     71     XETrapCB    *req_cb;       /* Pointer to Request Callbacks */
     72     XETrapCB    *evt_cb;       /* Pointer to Event Callbacks (starting at 2) */
     73     CARD32      last_time;     /* Last (delta) timestamp */
     74 } XETCValues;
     75 
     76     /* bits 0 thru 6 are formerly "families" (now obsolete) */
     77 #define XETCDeltaTimes             7
     78 #define XETCTrapActive             8
     79     /* bits 9 thru 15 are reserved for future expansion */
     80 
     81 /* Values bit masks (used when determining what's dirty */
     82 #define TCStatistics               (1L<<0L)
     83 #define TCRequests                 (1L<<1L)
     84 #define TCEvents                   (1L<<2L)
     85 #define TCMaxPacket                (1L<<3L)
     86 #define TCCmdKey                   (1L<<4L)
     87 #define TCTimeStamps               (1L<<5L)
     88 #define TCWinXY                    (1L<<6L)
     89 #define TCXInput                   (1L<<7L)
     90 #define TCReqCBs                   (1L<<8L)
     91 #define TCEvtCBs                   (1L<<9L)
     92 #define TCCursor                   (1L<<10L)
     93 #define TCColorReplies             (1L<<11L)
     94 #define TCGrabServer               (1L<<12L)
     95 
     96 /* This is the representation we use in the library code for XLib transport */
     97 typedef struct {
     98     int type;
     99     unsigned long serial;
    100     Bool synthetic;
    101     Display *display;
    102     int detail;
    103     unsigned long idx;
    104     unsigned char data[sz_EventData];
    105 } XETrapDataEvent;
    106 
    107 /* Trap Context structure for maintaining XTrap State for client */
    108 struct _XETC
    109 {
    110     struct _XETC *next;         /* Ptr to next linked-listed TC */
    111     Display      *dpy;          /* Display ptr of current TC */
    112     INT32        eventBase /*B32*/; /* First event value */
    113     INT32        errorBase /*B32*/; /* First error value */
    114     INT32        extOpcode /*B32*/; /* Major opcode of the extension */
    115     BYTE         *xbuff;        /* Pointer to buffer for XLib Communications */
    116     CARD16       xmax_size /*B16*/; /* Max Size of a request */
    117     XExtData     *ext_data;     /* hook for extension to hang data */
    118     /*
    119      *  The following are initialized with the client-side version number
    120      *  However, when either a GetAvailable or GetVersion reply is received,
    121      *  these values are updated with the *oldest* version numbers.
    122      */
    123     CARD16       release /*B16*/;   /* The extension release number */
    124     CARD16       version /*B16*/;   /* The xtrap extension version number */
    125     CARD16       revision /*B16*/;  /* The xtrap extension revision number */
    126     CARD16       protocol /*B16*/;  /* The xtrap extension protocol number */
    127     unsigned     dirty /*B32*/;     /* cache dirty bits */
    128     XETCValues   values;        /* shadow structure of values */
    129     Boolean      (*eventFunc[XETrapNumberEvents])(XETrapDataEvent *event, struct _XETC *tc);
    130 };
    131 
    132 
    133 #endif /* __XTRAPLIB__ */
    134