home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / server / include / inputstr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-24  |  7.8 KB  |  268 lines

  1. /************************************************************
  2. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  3. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  4.  
  5.                         All Rights Reserved
  6.  
  7. Permission to use, copy, modify, and distribute this software and its 
  8. documentation for any purpose and without fee is hereby granted, 
  9. provided that the above copyright notice appear in all copies and that
  10. both that copyright notice and this permission notice appear in 
  11. supporting documentation, and that the names of Digital or MIT not be
  12. used in advertising or publicity pertaining to distribution of the
  13. software without specific, written prior permission.  
  14.  
  15. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21. SOFTWARE.
  22.  
  23. ********************************************************/
  24.  
  25. /* $XConsortium: inputstr.h,v 1.28 91/07/24 15:45:57 rws Exp $ */
  26.  
  27. #ifndef INPUTSTRUCT_H
  28. #define INPUTSTRUCT_H
  29.  
  30. #include "input.h"
  31. #include "window.h"
  32. #include "dixstruct.h"
  33. #include "screenint.h"
  34.  
  35. #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
  36.  
  37. #define SameClient(obj,client) \
  38.     (CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
  39.  
  40. #define MAX_DEVICES    9
  41.  
  42. #define EMASKSIZE    MAX_DEVICES
  43.  
  44. /* Kludge: OtherClients and InputClients must be compatible, see code */
  45.  
  46. typedef struct _OtherClients {
  47.     OtherClientsPtr    next;
  48.     XID            resource; /* id for putting into resource manager */
  49.     Mask        mask;
  50. } OtherClients;
  51.  
  52. typedef struct _InputClients {
  53.     InputClientsPtr    next;
  54.     XID            resource; /* id for putting into resource manager */
  55.     Mask        mask[EMASKSIZE];
  56. } InputClients;
  57.  
  58. typedef struct _OtherInputMasks {
  59.     Mask        deliverableEvents[EMASKSIZE];
  60.     Mask        inputEvents[EMASKSIZE];
  61.     Mask        dontPropagateMask[EMASKSIZE];
  62.     InputClientsPtr    inputClients;
  63. } OtherInputMasks;
  64.  
  65. typedef struct _DeviceIntRec *DeviceIntPtr;
  66.  
  67. /*
  68.  * The following structure gets used for both active and passive grabs. For
  69.  * active grabs some of the fields (e.g. modifiers) are not used. However,
  70.  * that is not much waste since there aren't many active grabs (one per
  71.  * keyboard/pointer device) going at once in the server.
  72.  */
  73.  
  74. #define MasksPerDetailMask 8        /* 256 keycodes and 256 possible
  75.                         modifier combinations, but only    
  76.                         3 buttons. */
  77.  
  78.   typedef struct _DetailRec {        /* Grab details may be bit masks */
  79.     unsigned short exact;
  80.     Mask *pMask;
  81.   } DetailRec;
  82.  
  83.   typedef struct _GrabRec {
  84.     GrabPtr        next;        /* for chain of passive grabs */
  85.     XID            resource;
  86.     DeviceIntPtr    device;
  87.     WindowPtr        window;
  88.     unsigned        ownerEvents:1;
  89.     unsigned        keyboardMode:1;
  90.     unsigned        pointerMode:1;
  91.     unsigned        coreGrab:1;    /* grab is on core device */
  92.     unsigned        coreMods:1;    /* modifiers are on core keyboard */
  93.     CARD8        type;        /* event type */
  94.     DetailRec        modifiersDetail;
  95.     DeviceIntPtr    modifierDevice;
  96.     DetailRec        detail;        /* key or button */
  97.     WindowPtr        confineTo;    /* always NULL for keyboards */
  98.     CursorPtr        cursor;        /* always NULL for keyboards */
  99.     Mask        eventMask;
  100. } GrabRec;
  101.  
  102. typedef struct _KeyClassRec {
  103.     CARD8        down[DOWN_LENGTH];
  104.     KeyCode         *modifierKeyMap;
  105.     KeySymsRec        curKeySyms;
  106.     int            modifierKeyCount[8];
  107.     CARD8        modifierMap[MAP_LENGTH];
  108.     CARD8        maxKeysPerModifier;
  109.     unsigned short    state;
  110. } KeyClassRec, *KeyClassPtr;
  111.  
  112. typedef struct _AxisInfo {
  113.     int        resolution;
  114.     int        min_resolution;
  115.     int        max_resolution;
  116.     int        min_value;
  117.     int        max_value;
  118. } AxisInfo, *AxisInfoPtr;
  119.  
  120. typedef struct _ValuatorClassRec {
  121.     int             (*GetMotionProc) ();
  122.     int             numMotionEvents;
  123.     WindowPtr        motionHintWindow;
  124.     AxisInfoPtr     axes;
  125.     unsigned short    numAxes;
  126.     int            *axisVal;
  127.     CARD8         mode;
  128. } ValuatorClassRec, *ValuatorClassPtr;
  129.  
  130. typedef struct _ButtonClassRec {
  131.     CARD8        numButtons;
  132.     CARD8        buttonsDown;    /* number of buttons currently down */
  133.     unsigned short    state;
  134.     Mask        motionMask;
  135.     CARD8        down[DOWN_LENGTH];
  136.     CARD8        map[MAP_LENGTH];
  137. } ButtonClassRec, *ButtonClassPtr;
  138.  
  139. typedef struct _FocusClassRec {
  140.     WindowPtr    win;
  141.     int        revert;
  142.     TimeStamp    time;
  143.     WindowPtr    *trace;
  144.     int        traceSize;
  145.     int        traceGood;
  146. } FocusClassRec, *FocusClassPtr;
  147.  
  148. typedef struct _ProximityClassRec {
  149.     char    pad;
  150. } ProximityClassRec, *ProximityClassPtr;
  151.  
  152. typedef struct _KbdFeedbackClassRec *KbdFeedbackPtr;
  153. typedef struct _PtrFeedbackClassRec *PtrFeedbackPtr;
  154. typedef struct _IntegerFeedbackClassRec *IntegerFeedbackPtr;
  155. typedef struct _StringFeedbackClassRec *StringFeedbackPtr;
  156. typedef struct _BellFeedbackClassRec *BellFeedbackPtr;
  157. typedef struct _LedFeedbackClassRec *LedFeedbackPtr;
  158.  
  159. typedef struct _KbdFeedbackClassRec {
  160.     void        (*BellProc) ();
  161.     void        (*CtrlProc) ();
  162.     KeybdCtrl         ctrl;
  163.     KbdFeedbackPtr    next;
  164. } KbdFeedbackClassRec;
  165.  
  166. typedef struct _PtrFeedbackClassRec {
  167.     void        (*CtrlProc) ();
  168.     PtrCtrl        ctrl;
  169.     PtrFeedbackPtr    next;
  170. } PtrFeedbackClassRec;
  171.  
  172. typedef struct _IntegerFeedbackClassRec {
  173.     void        (*CtrlProc) ();
  174.     IntegerCtrl         ctrl;
  175.     IntegerFeedbackPtr    next;
  176. } IntegerFeedbackClassRec;
  177.  
  178. typedef struct _StringFeedbackClassRec {
  179.     void        (*CtrlProc) ();
  180.     StringCtrl         ctrl;
  181.     StringFeedbackPtr    next;
  182. } StringFeedbackClassRec;
  183.  
  184. typedef struct _BellFeedbackClassRec {
  185.     void        (*BellProc) ();
  186.     void        (*CtrlProc) ();
  187.     BellCtrl         ctrl;
  188.     BellFeedbackPtr    next;
  189. } BellFeedbackClassRec;
  190.  
  191. typedef struct _LedFeedbackClassRec {
  192.     void        (*CtrlProc) ();
  193.     LedCtrl         ctrl;
  194.     LedFeedbackPtr    next;
  195. } LedFeedbackClassRec;
  196.  
  197. /* states for devices */
  198.  
  199. #define NOT_GRABBED        0
  200. #define THAWED            1
  201. #define THAWED_BOTH        2    /* not a real state */
  202. #define FREEZE_NEXT_EVENT    3
  203. #define FREEZE_BOTH_NEXT_EVENT    4
  204. #define FROZEN            5    /* any state >= has device frozen */
  205. #define FROZEN_NO_EVENT        5
  206. #define FROZEN_WITH_EVENT    6
  207. #define THAW_OTHERS        7
  208.  
  209. typedef struct _DeviceIntRec {
  210.     DeviceRec    public;
  211.     DeviceIntPtr next;
  212.     TimeStamp    grabTime;
  213.     Bool    startup;        /* true if needs to be turned on at
  214.                           server intialization time */
  215.     DeviceProc    deviceProc;        /* proc(DevicePtr, DEVICE_xx). It is
  216.                       used to initialize, turn on, or
  217.                       turn off the device */
  218.     Bool    inited;            /* TRUE if INIT returns Success */
  219.     GrabPtr    grab;            /* the grabber - used by DIX */
  220.     struct {
  221.     Bool        frozen;
  222.     int        state;
  223.     GrabPtr        other;        /* if other grab has this frozen */
  224.     xEvent        *event;        /* saved to be replayed */
  225.     int        evcount;
  226.     } sync;
  227.     Atom        type;
  228.     char        *name;
  229.     CARD8        id;
  230.     CARD8        activatingKey;
  231.     Bool        fromPassiveGrab;
  232.     GrabRec        activeGrab;
  233.     void        (*ActivateGrab)();
  234.     void        (*DeactivateGrab)();
  235.     KeyClassPtr        key;
  236.     ValuatorClassPtr    valuator;
  237.     ButtonClassPtr    button;
  238.     FocusClassPtr    focus;
  239.     ProximityClassPtr    proximity;
  240.     KbdFeedbackPtr    kbdfeed;
  241.     PtrFeedbackPtr    ptrfeed;
  242.     IntegerFeedbackPtr    intfeed;
  243.     StringFeedbackPtr    stringfeed;
  244.     BellFeedbackPtr    bell;
  245.     LedFeedbackPtr    leds;
  246. } DeviceIntRec;
  247.  
  248. typedef struct {
  249.     int            numDevices;    /* total number of devices */
  250.     DeviceIntPtr    devices;    /* all devices turned on */
  251.     DeviceIntPtr    off_devices;    /* all devices turned off */
  252.     DeviceIntPtr    keyboard;    /* the main one for the server */
  253.     DeviceIntPtr    pointer;
  254. } InputInfo;
  255.  
  256. /* for keeping the events for devices grabbed synchronously */
  257. typedef struct _QdEvent *QdEventPtr;
  258. typedef struct _QdEvent {
  259.     QdEventPtr        next;
  260.     DeviceIntPtr    device;
  261.     ScreenPtr        pScreen;    /* what screen the pointer was on */
  262.     unsigned long    months;        /* milliseconds is in the event */
  263.     xEvent        *event;
  264.     int            evcount;
  265. } QdEventRec;    
  266.  
  267. #endif /* INPUTSTRUCT_H */
  268.