home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / lib / Xt / PassivGraI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-31  |  4.4 KB  |  165 lines

  1. /*
  2. * $XConsortium: PassivGraI.h,v 1.10 90/12/31 16:54:34 rws Exp $
  3. */
  4.  
  5. /********************************************************
  6.  
  7. Copyright (c) 1988 by Hewlett-Packard Company
  8. Copyright (c) 1987, 1988, 1989 by Digital Equipment Corporation, Maynard, 
  9.               Massachusetts, and the Massachusetts Institute of Technology, 
  10.               Cambridge, Massachusetts
  11.  
  12. Permission to use, copy, modify, and distribute this software 
  13. and its documentation for any purpose and without fee is hereby 
  14. granted, provided that the above copyright notice appear in all 
  15. copies and that both that copyright notice and this permission 
  16. notice appear in supporting documentation, and that the names of 
  17. Hewlett-Packard, Digital or  M.I.T.  not be used in advertising or 
  18. publicity pertaining to distribution of the software without specific, 
  19. written prior permission.
  20.  
  21. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  22. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  23. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  24. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  25. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  26. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  27. SOFTWARE.
  28.  
  29. ********************************************************/
  30.  
  31. #ifndef _PDI_h_
  32. #define _PDI_h_
  33.  
  34.  
  35. #define KEYBOARD TRUE
  36. #define POINTER  FALSE
  37.  
  38. typedef enum {
  39.     XtNoServerGrab, 
  40.     XtPassiveServerGrab,
  41.     XtActiveServerGrab,
  42.     XtPseudoPassiveServerGrab,
  43.     XtPseudoActiveServerGrab
  44. }XtServerGrabType;
  45.  
  46. typedef struct _XtServerGrabRec {
  47.     struct _XtServerGrabRec     *next;
  48.     Widget            widget;
  49.     unsigned int        ownerEvents:1;
  50.     unsigned int        pointerMode:1;
  51.     unsigned int        keyboardMode:1;
  52.     unsigned int        hasExt:1;
  53.     KeyCode            keybut;
  54.     unsigned short        modifiers;
  55.     unsigned short        eventMask;
  56. } XtServerGrabRec, *XtServerGrabPtr;
  57.  
  58. typedef struct _XtGrabExtRec {
  59.     Mask            *pKeyButMask;
  60.     Mask            *pModifiersMask;
  61.     Window            confineTo;
  62.     Cursor            cursor;
  63. } XtServerGrabExtRec, *XtServerGrabExtPtr;
  64.  
  65. #define GRABEXT(p) ((XtServerGrabExtPtr)((p)+1))
  66.  
  67. typedef struct _XtDeviceRec{
  68.     XtServerGrabRec    grab;     /* need copy in order to protect
  69.                    during grab */
  70.     XtServerGrabType    grabType;
  71. }XtDeviceRec, *XtDevice;
  72.  
  73. #define XtMyAncestor    0
  74. #define XtMyDescendant    1
  75. #define XtMyCousin    2
  76. #define XtMySelf    3
  77. #define XtUnrelated    4
  78. typedef char XtGeneology; /* do not use an enum makes PerWidgetInput larger */
  79.  
  80. typedef struct {
  81.     Widget        focusKid;
  82.     XtServerGrabPtr    keyList, ptrList;
  83.     Widget        queryEventDescendant;
  84.     unsigned int    map_handler_added:1;
  85.     unsigned int    realize_handler_added:1;
  86.     unsigned int    active_handler_added:1;
  87.     unsigned int    haveFocus:1;
  88.     XtGeneology        focalPoint;
  89. }XtPerWidgetInputRec, *XtPerWidgetInput;
  90.  
  91. typedef struct XtPerDisplayInputRec{
  92.     XtGrabList     grabList;
  93.     XtDeviceRec keyboard, pointer;
  94.     KeyCode    activatingKey;
  95.     Widget     *trace;
  96.     int        traceDepth, traceMax;
  97.     Widget     focusWidget;
  98. }XtPerDisplayInputRec, *XtPerDisplayInput;
  99.  
  100. #define IsServerGrab(g) ((g == XtPassiveServerGrab) ||\
  101.              (g == XtActiveServerGrab))
  102.  
  103. #define IsAnyGrab(g) ((g == XtPassiveServerGrab) ||\
  104.               (g == XtActiveServerGrab)  ||\
  105.               (g == XtPseudoPassiveServerGrab))
  106.  
  107. #define IsEitherPassiveGrab(g) ((g == XtPassiveServerGrab) ||\
  108.                 (g == XtPseudoPassiveServerGrab))
  109.  
  110. #define IsPseudoGrab(g) ((g == XtPseudoPassiveServerGrab))
  111.  
  112. extern void _XtDestroyServerGrabs(
  113. #if NeedFunctionPrototypes
  114.     Widget        /* w */,
  115.     XtPointer        /* pwi */, /*XtPerWidgetInput*/
  116.     XtPointer        /* call_data */
  117. #endif
  118. );
  119.  
  120. extern XtPerWidgetInput _XtGetPerWidgetInput(
  121. #if NeedFunctionPrototypes
  122.     Widget    /* widget */,
  123.     _XtBoolean    /* create */
  124. #endif
  125. );
  126.  
  127. extern XtServerGrabPtr _XtCheckServerGrabsOnWidget(
  128. #if NeedFunctionPrototypes
  129.     XEvent*        /* event */,
  130.     Widget        /* widget */,
  131.     _XtBoolean        /* isKeyboard */
  132. #endif
  133. );
  134.  
  135. /*
  136. extern XtGrabList* _XtGetGrabList( XtPerDisplayInput );
  137. */
  138.  
  139. #define _XtGetGrabList(pdi) (&(pdi)->grabList)
  140.  
  141. extern void _XtFreePerWidgetInput(
  142. #if NeedFunctionPrototypes
  143.     Widget        /* w */,
  144.     XtPerWidgetInput    /* pwi */
  145. #endif
  146. );
  147.  
  148. extern Widget _XtProcessKeyboardEvent(
  149. #if NeedFunctionPrototypes
  150.     XKeyEvent*        /* event */,
  151.     Widget        /* widget */,
  152.     XtPerDisplayInput    /* pdi */
  153. #endif
  154. );
  155.  
  156. extern Widget _XtProcessPointerEvent(
  157. #if NeedFunctionPrototypes
  158.     XButtonEvent*    /* event */,
  159.     Widget        /* widget */,
  160.     XtPerDisplayInput    /* pdi */
  161. #endif
  162. );
  163.  
  164. #endif /* _PDI_h_ */
  165.