Home | History | Annotate | Download | only in extensions
      1 /* $Xorg: XInput.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $ */
      2 
      3 /************************************************************
      4 
      5 Copyright 1989, 1998  The Open Group
      6 
      7 Permission to use, copy, modify, distribute, and sell this software and its
      8 documentation for any purpose is hereby granted without fee, provided that
      9 the above copyright notice appear in all copies and that both that
     10 copyright notice and this permission notice appear in supporting
     11 documentation.
     12 
     13 The above copyright notice and this permission notice shall be included in
     14 all copies or substantial portions of the Software.
     15 
     16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     19 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     22 
     23 Except as contained in this notice, the name of The Open Group shall not be
     24 used in advertising or otherwise to promote the sale, use or other dealings
     25 in this Software without prior written authorization from The Open Group.
     26 
     27 Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
     28 
     29 			All Rights Reserved
     30 
     31 Permission to use, copy, modify, and distribute this software and its
     32 documentation for any purpose and without fee is hereby granted,
     33 provided that the above copyright notice appear in all copies and that
     34 both that copyright notice and this permission notice appear in
     35 supporting documentation, and that the name of Hewlett-Packard not be
     36 used in advertising or publicity pertaining to distribution of the
     37 software without specific, written prior permission.
     38 
     39 HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
     40 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
     41 HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
     42 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
     43 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
     44 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
     45 SOFTWARE.
     46 
     47 ********************************************************/
     48 /* $XFree86: xc/include/extensions/XInput.h,v 1.3 2001/12/14 19:53:28 dawes Exp $ */
     49 
     50 /* Definitions used by the library and client */
     51 
     52 #ifndef _XINPUT_H_
     53 #define _XINPUT_H_
     54 
     55 #include <X11/Xlib.h>
     56 #include <X11/extensions/XI.h>
     57 
     58 #define _deviceKeyPress		0
     59 #define _deviceKeyRelease	1
     60 
     61 #define _deviceButtonPress	0
     62 #define _deviceButtonRelease	1
     63 
     64 #define _deviceMotionNotify	0
     65 
     66 #define _deviceFocusIn		0
     67 #define _deviceFocusOut		1
     68 
     69 #define _proximityIn		0
     70 #define _proximityOut		1
     71 
     72 #define _deviceStateNotify	0
     73 #define _deviceMappingNotify	1
     74 #define _changeDeviceNotify	2
     75 
     76 #define FindTypeAndClass(d,type,_class,classid,offset) \
     77     { int _i; XInputClassInfo *_ip; \
     78     type = 0; _class = 0; \
     79     for (_i=0, _ip= ((XDevice *) d)->classes; \
     80 	 _i< ((XDevice *) d)->num_classes; \
     81 	 _i++, _ip++) \
     82 	if (_ip->input_class == classid) \
     83 	    {type =  _ip->event_type_base + offset; \
     84 	     _class =  ((XDevice *) d)->device_id << 8 | type;}}
     85 
     86 #define DeviceKeyPress(d,type,_class) \
     87     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
     88 
     89 #define DeviceKeyRelease(d,type,_class) \
     90     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
     91 
     92 #define DeviceButtonPress(d,type,_class) \
     93     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
     94 
     95 #define DeviceButtonRelease(d,type,_class) \
     96     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
     97 
     98 #define DeviceMotionNotify(d,type,_class) \
     99     FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
    100 
    101 #define DeviceFocusIn(d,type,_class) \
    102     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
    103 
    104 #define DeviceFocusOut(d,type,_class) \
    105     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
    106 
    107 #define ProximityIn(d,type,_class) \
    108     FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
    109 
    110 #define ProximityOut(d,type,_class) \
    111     FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
    112 
    113 #define DeviceStateNotify(d,type,_class) \
    114     FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
    115 
    116 #define DeviceMappingNotify(d,type,_class) \
    117     FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
    118 
    119 #define ChangeDeviceNotify(d,type,_class) \
    120     FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
    121 
    122 #define DevicePointerMotionHint(d,type,_class) \
    123     { _class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
    124 
    125 #define DeviceButton1Motion(d,type,_class) \
    126     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
    127 
    128 #define DeviceButton2Motion(d,type,_class) \
    129     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
    130 
    131 #define DeviceButton3Motion(d,type,_class) \
    132     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
    133 
    134 #define DeviceButton4Motion(d,type, _class) \
    135     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
    136 
    137 #define DeviceButton5Motion(d,type,_class) \
    138     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
    139 
    140 #define DeviceButtonMotion(d,type, _class) \
    141     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
    142 
    143 #define DeviceOwnerGrabButton(d,type,_class) \
    144     { _class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
    145 
    146 #define DeviceButtonPressGrab(d,type,_class) \
    147     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
    148 
    149 #define NoExtensionEvent(d,type,_class) \
    150     { _class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
    151 
    152 #define DevicePresence(dpy, type, _class)                       \
    153     {                                                           \
    154         extern int _XiGetDevicePresenceNotifyEvent(Display *);  \
    155         type = _XiGetDevicePresenceNotifyEvent(dpy);            \
    156         _class =  (0x10000 | _devicePresence);                  \
    157     }
    158 
    159 #define BadDevice(dpy,error) _xibaddevice(dpy, &error)
    160 
    161 #define BadClass(dpy,error) _xibadclass(dpy, &error)
    162 
    163 #define BadEvent(dpy,error) _xibadevent(dpy, &error)
    164 
    165 #define BadMode(dpy,error) _xibadmode(dpy, &error)
    166 
    167 #define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
    168 
    169 /***************************************************************
    170  *
    171  * DeviceKey events.  These events are sent by input devices that
    172  * support input class Keys.
    173  * The location of the X pointer is reported in the coordinate
    174  * fields of the x,y and x_root,y_root fields.
    175  *
    176  */
    177 
    178 typedef struct
    179     {
    180     int            type;         /* of event */
    181     unsigned long  serial;       /* # of last request processed */
    182     Bool           send_event;   /* true if from SendEvent request */
    183     Display        *display;     /* Display the event was read from */
    184     Window         window;       /* "event" window reported relative to */
    185     XID            deviceid;
    186     Window         root;         /* root window event occured on */
    187     Window         subwindow;    /* child window */
    188     Time           time;         /* milliseconds */
    189     int            x, y;         /* x, y coordinates in event window */
    190     int            x_root;       /* coordinates relative to root */
    191     int            y_root;       /* coordinates relative to root */
    192     unsigned int   state;        /* key or button mask */
    193     unsigned int   keycode;      /* detail */
    194     Bool           same_screen;  /* same screen flag */
    195     unsigned int   device_state; /* device key or button mask */
    196     unsigned char  axes_count;
    197     unsigned char  first_axis;
    198     int            axis_data[6];
    199     } XDeviceKeyEvent;
    200 
    201 typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
    202 typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
    203 
    204 /*******************************************************************
    205  *
    206  * DeviceButton events.  These events are sent by extension devices
    207  * that support input class Buttons.
    208  *
    209  */
    210 
    211 typedef struct {
    212     int           type;         /* of event */
    213     unsigned long serial;       /* # of last request processed by server */
    214     Bool          send_event;   /* true if from a SendEvent request */
    215     Display       *display;     /* Display the event was read from */
    216     Window        window;       /* "event" window reported relative to */
    217     XID           deviceid;
    218     Window        root;         /* root window that the event occured on */
    219     Window        subwindow;    /* child window */
    220     Time          time;         /* milliseconds */
    221     int           x, y;         /* x, y coordinates in event window */
    222     int           x_root;       /* coordinates relative to root */
    223     int           y_root;       /* coordinates relative to root */
    224     unsigned int  state;        /* key or button mask */
    225     unsigned int  button;       /* detail */
    226     Bool          same_screen;  /* same screen flag */
    227     unsigned int  device_state; /* device key or button mask */
    228     unsigned char axes_count;
    229     unsigned char first_axis;
    230     int           axis_data[6];
    231     } XDeviceButtonEvent;
    232 
    233 typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
    234 typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
    235 
    236 /*******************************************************************
    237  *
    238  * DeviceMotionNotify event.  These events are sent by extension devices
    239  * that support input class Valuators.
    240  *
    241  */
    242 
    243 typedef struct
    244     {
    245     int           type;        /* of event */
    246     unsigned long serial;      /* # of last request processed by server */
    247     Bool          send_event;  /* true if from a SendEvent request */
    248     Display       *display;    /* Display the event was read from */
    249     Window        window;      /* "event" window reported relative to */
    250     XID           deviceid;
    251     Window        root;        /* root window that the event occured on */
    252     Window        subwindow;   /* child window */
    253     Time          time;        /* milliseconds */
    254     int           x, y;        /* x, y coordinates in event window */
    255     int           x_root;      /* coordinates relative to root */
    256     int           y_root;      /* coordinates relative to root */
    257     unsigned int  state;       /* key or button mask */
    258     char          is_hint;     /* detail */
    259     Bool          same_screen; /* same screen flag */
    260     unsigned int  device_state; /* device key or button mask */
    261     unsigned char axes_count;
    262     unsigned char first_axis;
    263     int           axis_data[6];
    264     } XDeviceMotionEvent;
    265 
    266 /*******************************************************************
    267  *
    268  * DeviceFocusChange events.  These events are sent when the focus
    269  * of an extension device that can be focused is changed.
    270  *
    271  */
    272 
    273 typedef struct
    274     {
    275     int           type;       /* of event */
    276     unsigned long serial;     /* # of last request processed by server */
    277     Bool          send_event; /* true if from a SendEvent request */
    278     Display       *display;   /* Display the event was read from */
    279     Window        window;     /* "event" window reported relative to */
    280     XID           deviceid;
    281     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
    282     int           detail;
    283 	/*
    284 	 * NotifyAncestor, NotifyVirtual, NotifyInferior,
    285 	 * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
    286 	 * NotifyPointerRoot, NotifyDetailNone
    287 	 */
    288     Time                time;
    289     } XDeviceFocusChangeEvent;
    290 
    291 typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
    292 typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
    293 
    294 /*******************************************************************
    295  *
    296  * ProximityNotify events.  These events are sent by those absolute
    297  * positioning devices that are capable of generating proximity information.
    298  *
    299  */
    300 
    301 typedef struct
    302     {
    303     int             type;      /* ProximityIn or ProximityOut */
    304     unsigned long   serial;    /* # of last request processed by server */
    305     Bool            send_event; /* true if this came from a SendEvent request */
    306     Display         *display;  /* Display the event was read from */
    307     Window          window;
    308     XID	            deviceid;
    309     Window          root;
    310     Window          subwindow;
    311     Time            time;
    312     int             x, y;
    313     int             x_root, y_root;
    314     unsigned int    state;
    315     Bool            same_screen;
    316     unsigned int    device_state; /* device key or button mask */
    317     unsigned char   axes_count;
    318     unsigned char   first_axis;
    319     int             axis_data[6];
    320     } XProximityNotifyEvent;
    321 typedef XProximityNotifyEvent XProximityInEvent;
    322 typedef XProximityNotifyEvent XProximityOutEvent;
    323 
    324 /*******************************************************************
    325  *
    326  * DeviceStateNotify events are generated on EnterWindow and FocusIn
    327  * for those clients who have selected DeviceState.
    328  *
    329  */
    330 
    331 typedef struct
    332     {
    333 #if defined(__cplusplus) || defined(c_plusplus)
    334     unsigned char	c_class;
    335 #else
    336     unsigned char	class;
    337 #endif
    338     unsigned char	length;
    339     } XInputClass;
    340 
    341 typedef struct {
    342     int           type;
    343     unsigned long serial;       /* # of last request processed by server */
    344     Bool          send_event;   /* true if this came from a SendEvent request */
    345     Display       *display;     /* Display the event was read from */
    346     Window        window;
    347     XID           deviceid;
    348     Time          time;
    349     int           num_classes;
    350     char	  data[64];
    351 } XDeviceStateNotifyEvent;
    352 
    353 typedef struct {
    354 #if defined(__cplusplus) || defined(c_plusplus)
    355     unsigned char	c_class;
    356 #else
    357     unsigned char	class;
    358 #endif
    359     unsigned char	length;
    360     unsigned char	num_valuators;
    361     unsigned char	mode;
    362     int        		valuators[6];
    363 } XValuatorStatus;
    364 
    365 typedef struct {
    366 #if defined(__cplusplus) || defined(c_plusplus)
    367     unsigned char	c_class;
    368 #else
    369     unsigned char	class;
    370 #endif
    371     unsigned char	length;
    372     short		num_keys;
    373     char        	keys[32];
    374 } XKeyStatus;
    375 
    376 typedef struct {
    377 #if defined(__cplusplus) || defined(c_plusplus)
    378     unsigned char	c_class;
    379 #else
    380     unsigned char	class;
    381 #endif
    382     unsigned char	length;
    383     short		num_buttons;
    384     char        	buttons[32];
    385 } XButtonStatus;
    386 
    387 /*******************************************************************
    388  *
    389  * DeviceMappingNotify event.  This event is sent when the key mapping,
    390  * modifier mapping, or button mapping of an extension device is changed.
    391  *
    392  */
    393 
    394 typedef struct {
    395     int           type;
    396     unsigned long serial;       /* # of last request processed by server */
    397     Bool          send_event;   /* true if this came from a SendEvent request */
    398     Display       *display;     /* Display the event was read from */
    399     Window        window;       /* unused */
    400     XID           deviceid;
    401     Time          time;
    402     int           request;      /* one of MappingModifier, MappingKeyboard,
    403                                     MappingPointer */
    404     int           first_keycode;/* first keycode */
    405     int           count;        /* defines range of change w. first_keycode*/
    406 } XDeviceMappingEvent;
    407 
    408 /*******************************************************************
    409  *
    410  * ChangeDeviceNotify event.  This event is sent when an
    411  * XChangeKeyboard or XChangePointer request is made.
    412  *
    413  */
    414 
    415 typedef struct {
    416     int           type;
    417     unsigned long serial;       /* # of last request processed by server */
    418     Bool          send_event;   /* true if this came from a SendEvent request */
    419     Display       *display;     /* Display the event was read from */
    420     Window        window;       /* unused */
    421     XID           deviceid;
    422     Time          time;
    423     int           request;      /* NewPointer or NewKeyboard */
    424 } XChangeDeviceNotifyEvent;
    425 
    426 /*******************************************************************
    427  *
    428  * DevicePresenceNotify event.  This event is sent when the list of
    429  * input devices changes, in which case devchange will be false, and
    430  * no information about the change will be contained in the event;
    431  * the client should use XListInputDevices() to learn what has changed.
    432  *
    433  * If devchange is true, an attribute that the server believes is
    434  * important has changed on a device, and the client should use
    435  * XGetDeviceControl to examine the device.  If control is non-zero,
    436  * then that control has changed meaningfully.
    437  */
    438 
    439 typedef struct {
    440     int           type;
    441     unsigned long serial;       /* # of last request processed by server */
    442     Bool          send_event;   /* true if this came from a SendEvent request */
    443     Display       *display;     /* Display the event was read from */
    444     Window        window;       /* unused */
    445     Time          time;
    446     Bool          devchange;
    447     XID           deviceid;
    448     XID           control;
    449 } XDevicePresenceNotifyEvent;
    450 
    451 /*******************************************************************
    452  *
    453  * Control structures for input devices that support input class
    454  * Feedback.  These are used by the XGetFeedbackControl and
    455  * XChangeFeedbackControl functions.
    456  *
    457  */
    458 
    459 typedef struct {
    460 #if defined(__cplusplus) || defined(c_plusplus)
    461      XID            c_class;
    462 #else
    463      XID            class;
    464 #endif
    465      int            length;
    466      XID            id;
    467 } XFeedbackState;
    468 
    469 typedef struct {
    470 #if defined(__cplusplus) || defined(c_plusplus)
    471     XID     c_class;
    472 #else
    473     XID     class;
    474 #endif
    475     int     length;
    476     XID     id;
    477     int     click;
    478     int     percent;
    479     int     pitch;
    480     int     duration;
    481     int     led_mask;
    482     int     global_auto_repeat;
    483     char    auto_repeats[32];
    484 } XKbdFeedbackState;
    485 
    486 typedef struct {
    487 #if defined(__cplusplus) || defined(c_plusplus)
    488     XID     c_class;
    489 #else
    490     XID     class;
    491 #endif
    492     int     length;
    493     XID     id;
    494     int     accelNum;
    495     int     accelDenom;
    496     int     threshold;
    497 } XPtrFeedbackState;
    498 
    499 typedef struct {
    500 #if defined(__cplusplus) || defined(c_plusplus)
    501     XID     c_class;
    502 #else
    503     XID     class;
    504 #endif
    505     int     length;
    506     XID     id;
    507     int     resolution;
    508     int     minVal;
    509     int     maxVal;
    510 } XIntegerFeedbackState;
    511 
    512 typedef struct {
    513 #if defined(__cplusplus) || defined(c_plusplus)
    514     XID     c_class;
    515 #else
    516     XID     class;
    517 #endif
    518     int     length;
    519     XID     id;
    520     int     max_symbols;
    521     int     num_syms_supported;
    522     KeySym  *syms_supported;
    523 } XStringFeedbackState;
    524 
    525 typedef struct {
    526 #if defined(__cplusplus) || defined(c_plusplus)
    527     XID     c_class;
    528 #else
    529     XID     class;
    530 #endif
    531     int     length;
    532     XID     id;
    533     int     percent;
    534     int     pitch;
    535     int     duration;
    536 } XBellFeedbackState;
    537 
    538 typedef struct {
    539 #if defined(__cplusplus) || defined(c_plusplus)
    540     XID     c_class;
    541 #else
    542     XID     class;
    543 #endif
    544     int     length;
    545     XID     id;
    546     int     led_values;
    547     int     led_mask;
    548 } XLedFeedbackState;
    549 
    550 typedef struct {
    551 #if defined(__cplusplus) || defined(c_plusplus)
    552      XID            c_class;
    553 #else
    554      XID            class;
    555 #endif
    556      int            length;
    557      XID	    id;
    558 } XFeedbackControl;
    559 
    560 typedef struct {
    561 #if defined(__cplusplus) || defined(c_plusplus)
    562     XID     c_class;
    563 #else
    564     XID     class;
    565 #endif
    566     int     length;
    567     XID     id;
    568     int     accelNum;
    569     int     accelDenom;
    570     int     threshold;
    571 } XPtrFeedbackControl;
    572 
    573 typedef struct {
    574 #if defined(__cplusplus) || defined(c_plusplus)
    575     XID     c_class;
    576 #else
    577     XID     class;
    578 #endif
    579     int     length;
    580     XID     id;
    581     int     click;
    582     int     percent;
    583     int     pitch;
    584     int     duration;
    585     int     led_mask;
    586     int     led_value;
    587     int     key;
    588     int     auto_repeat_mode;
    589 } XKbdFeedbackControl;
    590 
    591 typedef struct {
    592 #if defined(__cplusplus) || defined(c_plusplus)
    593     XID     c_class;
    594 #else
    595     XID     class;
    596 #endif
    597     int     length;
    598     XID     id;
    599     int     num_keysyms;
    600     KeySym  *syms_to_display;
    601 } XStringFeedbackControl;
    602 
    603 typedef struct {
    604 #if defined(__cplusplus) || defined(c_plusplus)
    605     XID     c_class;
    606 #else
    607     XID     class;
    608 #endif
    609     int     length;
    610     XID     id;
    611     int     int_to_display;
    612 } XIntegerFeedbackControl;
    613 
    614 typedef struct {
    615 #if defined(__cplusplus) || defined(c_plusplus)
    616     XID     c_class;
    617 #else
    618     XID     class;
    619 #endif
    620     int     length;
    621     XID     id;
    622     int     percent;
    623     int     pitch;
    624     int     duration;
    625 } XBellFeedbackControl;
    626 
    627 typedef struct {
    628 #if defined(__cplusplus) || defined(c_plusplus)
    629     XID     c_class;
    630 #else
    631     XID     class;
    632 #endif
    633     int     length;
    634     XID     id;
    635     int     led_mask;
    636     int     led_values;
    637 } XLedFeedbackControl;
    638 
    639 /*******************************************************************
    640  *
    641  * Device control structures.
    642  *
    643  */
    644 
    645 typedef struct {
    646      XID            control;
    647      int            length;
    648 } XDeviceControl;
    649 
    650 typedef struct {
    651      XID            control;
    652      int            length;
    653      int            first_valuator;
    654      int            num_valuators;
    655      int            *resolutions;
    656 } XDeviceResolutionControl;
    657 
    658 typedef struct {
    659      XID            control;
    660      int            length;
    661      int            num_valuators;
    662      int            *resolutions;
    663      int            *min_resolutions;
    664      int            *max_resolutions;
    665 } XDeviceResolutionState;
    666 
    667 typedef struct {
    668     XID             control;
    669     int             length;
    670     int             min_x;
    671     int             max_x;
    672     int             min_y;
    673     int             max_y;
    674     int             flip_x;
    675     int             flip_y;
    676     int             rotation;
    677     int             button_threshold;
    678 } XDeviceAbsCalibControl, XDeviceAbsCalibState;
    679 
    680 typedef struct {
    681     XID             control;
    682     int             length;
    683     int             offset_x;
    684     int             offset_y;
    685     int             width;
    686     int             height;
    687     int             screen;
    688     XID             following;
    689 } XDeviceAbsAreaControl, XDeviceAbsAreaState;
    690 
    691 typedef struct {
    692     XID             control;
    693     int             length;
    694     int             status;
    695 } XDeviceCoreControl;
    696 
    697 typedef struct {
    698     XID             control;
    699     int             length;
    700     int             status;
    701     int             iscore;
    702 } XDeviceCoreState;
    703 
    704 typedef struct {
    705     XID             control;
    706     int             length;
    707     int             enable;
    708 } XDeviceEnableControl, XDeviceEnableState;
    709 
    710 /*******************************************************************
    711  *
    712  * An array of XDeviceList structures is returned by the
    713  * XListInputDevices function.  Each entry contains information
    714  * about one input device.  Among that information is an array of
    715  * pointers to structures that describe the characteristics of
    716  * the input device.
    717  *
    718  */
    719 
    720 typedef struct _XAnyClassinfo *XAnyClassPtr;
    721 
    722 typedef struct _XAnyClassinfo {
    723 #if defined(__cplusplus) || defined(c_plusplus)
    724     XID 	c_class;
    725 #else
    726     XID 	class;
    727 #endif
    728     int 	length;
    729     } XAnyClassInfo;
    730 
    731 typedef struct _XDeviceInfo *XDeviceInfoPtr;
    732 
    733 typedef struct _XDeviceInfo
    734     {
    735     XID                 id;
    736     Atom                type;
    737     char                *name;
    738     int                 num_classes;
    739     int                 use;
    740     XAnyClassPtr 	inputclassinfo;
    741     } XDeviceInfo;
    742 
    743 typedef struct _XKeyInfo *XKeyInfoPtr;
    744 
    745 typedef struct _XKeyInfo
    746     {
    747 #if defined(__cplusplus) || defined(c_plusplus)
    748     XID			c_class;
    749 #else
    750     XID			class;
    751 #endif
    752     int			length;
    753     unsigned short      min_keycode;
    754     unsigned short      max_keycode;
    755     unsigned short      num_keys;
    756     } XKeyInfo;
    757 
    758 typedef struct _XButtonInfo *XButtonInfoPtr;
    759 
    760 typedef struct _XButtonInfo {
    761 #if defined(__cplusplus) || defined(c_plusplus)
    762     XID		c_class;
    763 #else
    764     XID		class;
    765 #endif
    766     int		length;
    767     short 	num_buttons;
    768     } XButtonInfo;
    769 
    770 typedef struct _XAxisInfo *XAxisInfoPtr;
    771 
    772 typedef struct _XAxisInfo {
    773     int 	resolution;
    774     int 	min_value;
    775     int 	max_value;
    776     } XAxisInfo;
    777 
    778 typedef struct _XValuatorInfo *XValuatorInfoPtr;
    779 
    780 typedef struct	_XValuatorInfo
    781     {
    782 #if defined(__cplusplus) || defined(c_plusplus)
    783     XID			c_class;
    784 #else
    785     XID			class;
    786 #endif
    787     int			length;
    788     unsigned char       num_axes;
    789     unsigned char       mode;
    790     unsigned long       motion_buffer;
    791     XAxisInfoPtr        axes;
    792     } XValuatorInfo;
    793 
    794 
    795 /*******************************************************************
    796  *
    797  * An XDevice structure is returned by the XOpenDevice function.
    798  * It contains an array of pointers to XInputClassInfo structures.
    799  * Each contains information about a class of input supported by the
    800  * device, including a pointer to an array of data for each type of event
    801  * the device reports.
    802  *
    803  */
    804 
    805 
    806 typedef struct {
    807         unsigned char   input_class;
    808         unsigned char   event_type_base;
    809 } XInputClassInfo;
    810 
    811 typedef struct {
    812         XID                    device_id;
    813         int                    num_classes;
    814         XInputClassInfo        *classes;
    815 } XDevice;
    816 
    817 
    818 /*******************************************************************
    819  *
    820  * The following structure is used to return information for the
    821  * XGetSelectedExtensionEvents function.
    822  *
    823  */
    824 
    825 typedef struct {
    826         XEventClass     event_type;
    827         XID             device;
    828 } XEventList;
    829 
    830 /*******************************************************************
    831  *
    832  * The following structure is used to return motion history data from
    833  * an input device that supports the input class Valuators.
    834  * This information is returned by the XGetDeviceMotionEvents function.
    835  *
    836  */
    837 
    838 typedef struct {
    839         Time   time;
    840         int    *data;
    841 } XDeviceTimeCoord;
    842 
    843 
    844 /*******************************************************************
    845  *
    846  * Device state structure.
    847  * This is returned by the XQueryDeviceState request.
    848  *
    849  */
    850 
    851 typedef struct {
    852         XID		device_id;
    853         int		num_classes;
    854         XInputClass	*data;
    855 } XDeviceState;
    856 
    857 /*******************************************************************
    858  *
    859  * Note that the mode field is a bitfield that reports the Proximity
    860  * status of the device as well as the mode.  The mode field should
    861  * be OR'd with the mask DeviceMode and compared with the values
    862  * Absolute and Relative to determine the mode, and should be OR'd
    863  * with the mask ProximityState and compared with the values InProximity
    864  * and OutOfProximity to determine the proximity state.
    865  *
    866  */
    867 
    868 typedef struct {
    869 #if defined(__cplusplus) || defined(c_plusplus)
    870     unsigned char	c_class;
    871 #else
    872     unsigned char	class;
    873 #endif
    874     unsigned char	length;
    875     unsigned char	num_valuators;
    876     unsigned char	mode;
    877     int        		*valuators;
    878 } XValuatorState;
    879 
    880 typedef struct {
    881 #if defined(__cplusplus) || defined(c_plusplus)
    882     unsigned char	c_class;
    883 #else
    884     unsigned char	class;
    885 #endif
    886     unsigned char	length;
    887     short		num_keys;
    888     char        	keys[32];
    889 } XKeyState;
    890 
    891 typedef struct {
    892 #if defined(__cplusplus) || defined(c_plusplus)
    893     unsigned char	c_class;
    894 #else
    895     unsigned char	class;
    896 #endif
    897     unsigned char	length;
    898     short		num_buttons;
    899     char        	buttons[32];
    900 } XButtonState;
    901 
    902 /*******************************************************************
    903  *
    904  * Function definitions.
    905  *
    906  */
    907 
    908 _XFUNCPROTOBEGIN
    909 
    910 extern int	XChangeKeyboardDevice(
    911     Display*		/* display */,
    912     XDevice*		/* device */
    913 );
    914 
    915 extern int	XChangePointerDevice(
    916     Display*		/* display */,
    917     XDevice*		/* device */,
    918     int			/* xaxis */,
    919     int			/* yaxis */
    920 );
    921 
    922 extern int	XGrabDevice(
    923     Display*		/* display */,
    924     XDevice*		/* device */,
    925     Window		/* grab_window */,
    926     Bool		/* ownerEvents */,
    927     int			/* event count */,
    928     XEventClass*	/* event_list */,
    929     int			/* this_device_mode */,
    930     int			/* other_devices_mode */,
    931     Time		/* time */
    932 );
    933 
    934 extern int	XUngrabDevice(
    935     Display*		/* display */,
    936     XDevice*		/* device */,
    937     Time 		/* time */
    938 );
    939 
    940 extern int	XGrabDeviceKey(
    941     Display*		/* display */,
    942     XDevice*		/* device */,
    943     unsigned int	/* key */,
    944     unsigned int	/* modifiers */,
    945     XDevice*		/* modifier_device */,
    946     Window		/* grab_window */,
    947     Bool		/* owner_events */,
    948     unsigned int	/* event_count */,
    949     XEventClass*	/* event_list */,
    950     int			/* this_device_mode */,
    951     int			/* other_devices_mode */
    952 );
    953 
    954 extern int	XUngrabDeviceKey(
    955     Display*		/* display */,
    956     XDevice*		/* device */,
    957     unsigned int	/* key */,
    958     unsigned int	/* modifiers */,
    959     XDevice*		/* modifier_dev */,
    960     Window		/* grab_window */
    961 );
    962 
    963 extern int	XGrabDeviceButton(
    964     Display*		/* display */,
    965     XDevice*		/* device */,
    966     unsigned int	/* button */,
    967     unsigned int	/* modifiers */,
    968     XDevice*		/* modifier_device */,
    969     Window		/* grab_window */,
    970     Bool		/* owner_events */,
    971     unsigned int	/* event_count */,
    972     XEventClass*	/* event_list */,
    973     int			/* this_device_mode */,
    974     int			/* other_devices_mode */
    975 );
    976 
    977 extern int	XUngrabDeviceButton(
    978     Display*		/* display */,
    979     XDevice*		/* device */,
    980     unsigned int	/* button */,
    981     unsigned int	/* modifiers */,
    982     XDevice*		/* modifier_dev */,
    983     Window		/* grab_window */
    984 );
    985 
    986 extern int	XAllowDeviceEvents(
    987     Display*		/* display */,
    988     XDevice*		/* device */,
    989     int			/* event_mode */,
    990     Time		/* time */
    991 );
    992 
    993 extern int	XGetDeviceFocus(
    994     Display*		/* display */,
    995     XDevice*		/* device */,
    996     Window*		/* focus */,
    997     int*		/* revert_to */,
    998     Time*		/* time */
    999 );
   1000 
   1001 extern int	XSetDeviceFocus(
   1002     Display*		/* display */,
   1003     XDevice*		/* device */,
   1004     Window		/* focus */,
   1005     int			/* revert_to */,
   1006     Time		/* time */
   1007 );
   1008 
   1009 extern XFeedbackState	*XGetFeedbackControl(
   1010     Display*		/* display */,
   1011     XDevice*		/* device */,
   1012     int*		/* num_feedbacks */
   1013 );
   1014 
   1015 extern void	XFreeFeedbackList(
   1016     XFeedbackState*	/* list */
   1017 );
   1018 
   1019 extern int	XChangeFeedbackControl(
   1020     Display*		/* display */,
   1021     XDevice*		/* device */,
   1022     unsigned long	/* mask */,
   1023     XFeedbackControl*	/* f */
   1024 );
   1025 
   1026 extern int	XDeviceBell(
   1027     Display*		/* display */,
   1028     XDevice*		/* device */,
   1029     XID			/* feedbackclass */,
   1030     XID			/* feedbackid */,
   1031     int			/* percent */
   1032 );
   1033 
   1034 extern KeySym	*XGetDeviceKeyMapping(
   1035     Display*		/* display */,
   1036     XDevice*		/* device */,
   1037 #if NeedWidePrototypes
   1038     unsigned int	/* first */,
   1039 #else
   1040     KeyCode		/* first */,
   1041 #endif
   1042     int			/* keycount */,
   1043     int*		/* syms_per_code */
   1044 );
   1045 
   1046 extern int	XChangeDeviceKeyMapping(
   1047     Display*		/* display */,
   1048     XDevice*		/* device */,
   1049     int			/* first */,
   1050     int			/* syms_per_code */,
   1051     KeySym*		/* keysyms */,
   1052     int			/* count */
   1053 );
   1054 
   1055 extern XModifierKeymap	*XGetDeviceModifierMapping(
   1056     Display*		/* display */,
   1057     XDevice*		/* device */
   1058 );
   1059 
   1060 extern int	XSetDeviceModifierMapping(
   1061     Display*		/* display */,
   1062     XDevice*		/* device */,
   1063     XModifierKeymap*	/* modmap */
   1064 );
   1065 
   1066 extern int	XSetDeviceButtonMapping(
   1067     Display*		/* display */,
   1068     XDevice*		/* device */,
   1069     unsigned char*	/* map[] */,
   1070     int			/* nmap */
   1071 );
   1072 
   1073 extern int	XGetDeviceButtonMapping(
   1074     Display*		/* display */,
   1075     XDevice*		/* device */,
   1076     unsigned char*	/* map[] */,
   1077     unsigned int	/* nmap */
   1078 );
   1079 
   1080 extern XDeviceState	*XQueryDeviceState(
   1081     Display*		/* display */,
   1082     XDevice*		/* device */
   1083 );
   1084 
   1085 extern void	XFreeDeviceState(
   1086     XDeviceState*	/* list */
   1087 );
   1088 
   1089 extern XExtensionVersion	*XGetExtensionVersion(
   1090     Display*		/* display */,
   1091     _Xconst char*	/* name */
   1092 );
   1093 
   1094 extern XDeviceInfo	*XListInputDevices(
   1095     Display*		/* display */,
   1096     int*		/* ndevices */
   1097 );
   1098 
   1099 extern void	XFreeDeviceList(
   1100     XDeviceInfo*	/* list */
   1101 );
   1102 
   1103 extern XDevice	*XOpenDevice(
   1104     Display*		/* display */,
   1105     XID			/* id */
   1106 );
   1107 
   1108 extern int	XCloseDevice(
   1109     Display*		/* display */,
   1110     XDevice*		/* device */
   1111 );
   1112 
   1113 extern int	XSetDeviceMode(
   1114     Display*		/* display */,
   1115     XDevice*		/* device */,
   1116     int			/* mode */
   1117 );
   1118 
   1119 extern int	XSetDeviceValuators(
   1120     Display*		/* display */,
   1121     XDevice*		/* device */,
   1122     int*		/* valuators */,
   1123     int			/* first_valuator */,
   1124     int			/* num_valuators */
   1125 );
   1126 
   1127 extern XDeviceControl	*XGetDeviceControl(
   1128     Display*		/* display */,
   1129     XDevice*		/* device */,
   1130     int			/* control */
   1131 );
   1132 
   1133 extern int	XChangeDeviceControl(
   1134     Display*		/* display */,
   1135     XDevice*		/* device */,
   1136     int			/* control */,
   1137     XDeviceControl*	/* d */
   1138 );
   1139 
   1140 extern int	XSelectExtensionEvent(
   1141     Display*		/* display */,
   1142     Window		/* w */,
   1143     XEventClass*	/* event_list */,
   1144     int			/* count */
   1145 );
   1146 
   1147 extern int XGetSelectedExtensionEvents(
   1148     Display*		/* display */,
   1149     Window		/* w */,
   1150     int*		/* this_client_count */,
   1151     XEventClass**	/* this_client_list */,
   1152     int*		/* all_clients_count */,
   1153     XEventClass**	/* all_clients_list */
   1154 );
   1155 
   1156 extern int	XChangeDeviceDontPropagateList(
   1157     Display*		/* display */,
   1158     Window		/* window */,
   1159     int			/* count */,
   1160     XEventClass*	/* events */,
   1161     int			/* mode */
   1162 );
   1163 
   1164 extern XEventClass	*XGetDeviceDontPropagateList(
   1165     Display*		/* display */,
   1166     Window		/* window */,
   1167     int*		/* count */
   1168 );
   1169 
   1170 extern Status	XSendExtensionEvent(
   1171     Display*		/* display */,
   1172     XDevice*		/* device */,
   1173     Window		/* dest */,
   1174     Bool		/* prop */,
   1175     int			/* count */,
   1176     XEventClass*	/* list */,
   1177     XEvent*		/* event */
   1178 );
   1179 
   1180 extern XDeviceTimeCoord	*XGetDeviceMotionEvents(
   1181     Display*		/* display */,
   1182     XDevice*		/* device */,
   1183     Time		/* start */,
   1184     Time		/* stop */,
   1185     int*		/* nEvents */,
   1186     int*		/* mode */,
   1187     int*		/* axis_count */
   1188 );
   1189 
   1190 extern void	XFreeDeviceMotionEvents(
   1191     XDeviceTimeCoord*	/* events */
   1192 );
   1193 
   1194 extern void	XFreeDeviceControl(
   1195     XDeviceControl*	/* control */
   1196 );
   1197 
   1198 _XFUNCPROTOEND
   1199 
   1200 #endif /* _XINPUT_H_ */
   1201