Home | History | Annotate | Line # | Download | only in X11
      1 /********************************************************
      2 
      3 Copyright 1988 by Hewlett-Packard Company
      4 Copyright 1987, 1988, 1989 by Digital Equipment Corporation, Maynard
      5 
      6 Permission to use, copy, modify, and distribute this software
      7 and its documentation for any purpose and without fee is hereby
      8 granted, provided that the above copyright notice appear in all
      9 copies and that both that copyright notice and this permission
     10 notice appear in supporting documentation, and that the names of
     11 Hewlett-Packard or Digital not be used in advertising or
     12 publicity pertaining to distribution of the software without specific,
     13 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 /*
     26 
     27 Copyright 1987, 1988, 1989, 1998  The Open Group
     28 
     29 Permission to use, copy, modify, distribute, and sell this software and its
     30 documentation for any purpose is hereby granted without fee, provided that
     31 the above copyright notice appear in all copies and that both that
     32 copyright notice and this permission notice appear in supporting
     33 documentation.
     34 
     35 The above copyright notice and this permission notice shall be included in
     36 all copies or substantial portions of the Software.
     37 
     38 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     39 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     40 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     41 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     42 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     43 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     44 
     45 Except as contained in this notice, the name of The Open Group shall not be
     46 used in advertising or otherwise to promote the sale, use or other dealings
     47 in this Software without prior written authorization from The Open Group.
     48 
     49 */
     50 
     51 #ifndef _PDI_h_
     52 #define _PDI_h_
     53 
     54 
     55 #define KEYBOARD TRUE
     56 #define POINTER  FALSE
     57 
     58 _XFUNCPROTOBEGIN
     59 
     60 typedef enum {
     61     XtNoServerGrab,
     62     XtPassiveServerGrab,
     63     XtActiveServerGrab,
     64     XtPseudoPassiveServerGrab,
     65     XtPseudoActiveServerGrab
     66 }XtServerGrabType;
     67 
     68 typedef struct _XtServerGrabRec {
     69     struct _XtServerGrabRec 	*next;
     70     Widget			widget;
     71     unsigned int		ownerEvents:1;
     72     unsigned int		pointerMode:1;
     73     unsigned int		keyboardMode:1;
     74     unsigned int		hasExt:1;
     75     unsigned int		confineToIsWidgetWin:1;
     76     KeyCode			keybut;
     77     unsigned short		modifiers;
     78     unsigned short		eventMask;
     79 } XtServerGrabRec, *XtServerGrabPtr;
     80 
     81 typedef struct _XtGrabExtRec {
     82     Mask			*pKeyButMask;
     83     Mask			*pModifiersMask;
     84     Window			confineTo;
     85     Cursor			cursor;
     86 } XtServerGrabExtRec, *XtServerGrabExtPtr;
     87 
     88 #define GRABEXT(p) ((XtServerGrabExtPtr)((p)+1))
     89 
     90 typedef struct _XtDeviceRec{
     91     XtServerGrabRec	grab; 	/* need copy in order to protect
     92 				   during grab */
     93     XtServerGrabType	grabType;
     94 }XtDeviceRec, *XtDevice;
     95 
     96 #define XtMyAncestor	0
     97 #define XtMyDescendant	1
     98 #define XtMyCousin	2
     99 #define XtMySelf	3
    100 #define XtUnrelated	4
    101 typedef char XtGeneology; /* do not use an enum makes PerWidgetInput larger */
    102 
    103 typedef struct {
    104     Widget		focusKid;
    105     XtServerGrabPtr	keyList, ptrList;
    106     Widget		queryEventDescendant;
    107     unsigned int	map_handler_added:1;
    108     unsigned int	realize_handler_added:1;
    109     unsigned int	active_handler_added:1;
    110     unsigned int	haveFocus:1;
    111     XtGeneology		focalPoint;
    112 }XtPerWidgetInputRec, *XtPerWidgetInput;
    113 
    114 typedef struct XtPerDisplayInputRec{
    115     XtGrabList 	grabList;
    116     XtDeviceRec keyboard, pointer;
    117     KeyCode	activatingKey;
    118     Widget 	*trace;
    119     int		traceDepth, traceMax;
    120     Widget 	focusWidget;
    121 }XtPerDisplayInputRec, *XtPerDisplayInput;
    122 
    123 #define IsServerGrab(g) ((g == XtPassiveServerGrab) ||\
    124 			 (g == XtActiveServerGrab))
    125 
    126 #define IsAnyGrab(g) ((g == XtPassiveServerGrab) ||\
    127 		      (g == XtActiveServerGrab)  ||\
    128 		      (g == XtPseudoPassiveServerGrab))
    129 
    130 #define IsEitherPassiveGrab(g) ((g == XtPassiveServerGrab) ||\
    131 				(g == XtPseudoPassiveServerGrab))
    132 
    133 #define IsPseudoGrab(g) ((g == XtPseudoPassiveServerGrab))
    134 
    135 extern void _XtDestroyServerGrabs(
    136     Widget		/* w */,
    137     XtPointer		/* pwi */, /*XtPerWidgetInput*/
    138     XtPointer		/* call_data */
    139 );
    140 
    141 extern XtPerWidgetInput _XtGetPerWidgetInput(
    142     Widget	/* widget */,
    143     _XtBoolean	/* create */
    144 );
    145 
    146 extern XtServerGrabPtr _XtCheckServerGrabsOnWidget(
    147     XEvent*		/* event */,
    148     Widget		/* widget */,
    149     _XtBoolean		/* isKeyboard */
    150 );
    151 
    152 /*
    153 extern XtGrabList* _XtGetGrabList( XtPerDisplayInput );
    154 */
    155 
    156 #define _XtGetGrabList(pdi) (&(pdi)->grabList)
    157 
    158 extern void _XtFreePerWidgetInput(
    159     Widget		/* w */,
    160     XtPerWidgetInput	/* pwi */
    161 );
    162 
    163 extern Widget _XtProcessKeyboardEvent(
    164     XKeyEvent*		/* event */,
    165     Widget		/* widget */,
    166     XtPerDisplayInput	/* pdi */
    167 );
    168 
    169 extern Widget _XtProcessPointerEvent(
    170     XButtonEvent*	/* event */,
    171     Widget		/* widget */,
    172     XtPerDisplayInput	/* pdi */
    173 );
    174 
    175 extern void _XtRegisterPassiveGrabs(
    176     Widget		/* widget */
    177 );
    178 
    179 extern void _XtClearAncestorCache(
    180     Widget		/* widget */
    181 );
    182 
    183 _XFUNCPROTOEND
    184 
    185 #endif /* _PDI_h_ */
    186