Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:29:40

0001 /************************************************************
0002 
0003 Copyright 1989, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
0026 
0027             All Rights Reserved
0028 
0029 Permission to use, copy, modify, and distribute this software and its
0030 documentation for any purpose and without fee is hereby granted,
0031 provided that the above copyright notice appear in all copies and that
0032 both that copyright notice and this permission notice appear in
0033 supporting documentation, and that the name of Hewlett-Packard not be
0034 used in advertising or publicity pertaining to distribution of the
0035 software without specific, written prior permission.
0036 
0037 HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
0038 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
0039 HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
0040 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
0041 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
0042 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
0043 SOFTWARE.
0044 
0045 ********************************************************/
0046 
0047 /* Definitions used by the library and client */
0048 
0049 #ifndef _XINPUT_H_
0050 #define _XINPUT_H_
0051 
0052 #include <X11/Xlib.h>
0053 #include <X11/extensions/XI.h>
0054 
0055 #define _deviceKeyPress     0
0056 #define _deviceKeyRelease   1
0057 
0058 #define _deviceButtonPress  0
0059 #define _deviceButtonRelease    1
0060 
0061 #define _deviceMotionNotify 0
0062 
0063 #define _deviceFocusIn      0
0064 #define _deviceFocusOut     1
0065 
0066 #define _proximityIn        0
0067 #define _proximityOut       1
0068 
0069 #define _deviceStateNotify  0
0070 #define _deviceMappingNotify    1
0071 #define _changeDeviceNotify 2
0072 /* Space of 3 between is necessary! Reserved for DeviceKeyStateNotify,
0073    DeviceButtonStateNotify, DevicePresenceNotify (essentially unused). This
0074    code has to be in sync with FixExtensionEvents() in xserver/Xi/extinit.c */
0075 #define _propertyNotify     6
0076 
0077 #define FindTypeAndClass(d,type,_class,classid,offset) \
0078     { int _i; XInputClassInfo *_ip; \
0079     type = 0; _class = 0; \
0080     for (_i=0, _ip= ((XDevice *) d)->classes; \
0081      _i< ((XDevice *) d)->num_classes; \
0082      _i++, _ip++) \
0083     if (_ip->input_class == classid) \
0084         {type =  _ip->event_type_base + offset; \
0085          _class =  ((XDevice *) d)->device_id << 8 | type;}}
0086 
0087 #define DeviceKeyPress(d,type,_class) \
0088     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
0089 
0090 #define DeviceKeyRelease(d,type,_class) \
0091     FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
0092 
0093 #define DeviceButtonPress(d,type,_class) \
0094     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
0095 
0096 #define DeviceButtonRelease(d,type,_class) \
0097     FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
0098 
0099 #define DeviceMotionNotify(d,type,_class) \
0100     FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
0101 
0102 #define DeviceFocusIn(d,type,_class) \
0103     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
0104 
0105 #define DeviceFocusOut(d,type,_class) \
0106     FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
0107 
0108 #define ProximityIn(d,type,_class) \
0109     FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
0110 
0111 #define ProximityOut(d,type,_class) \
0112     FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
0113 
0114 #define DeviceStateNotify(d,type,_class) \
0115     FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
0116 
0117 #define DeviceMappingNotify(d,type,_class) \
0118     FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
0119 
0120 #define ChangeDeviceNotify(d,type,_class) \
0121     FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
0122 
0123 #define DevicePropertyNotify(d, type, _class) \
0124     FindTypeAndClass(d, type, _class, OtherClass, _propertyNotify)
0125 
0126 #define DevicePointerMotionHint(d,type,_class) \
0127     { _class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
0128 
0129 #define DeviceButton1Motion(d,type,_class) \
0130     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
0131 
0132 #define DeviceButton2Motion(d,type,_class) \
0133     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
0134 
0135 #define DeviceButton3Motion(d,type,_class) \
0136     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
0137 
0138 #define DeviceButton4Motion(d,type, _class) \
0139     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
0140 
0141 #define DeviceButton5Motion(d,type,_class) \
0142     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
0143 
0144 #define DeviceButtonMotion(d,type, _class) \
0145     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
0146 
0147 #define DeviceOwnerGrabButton(d,type,_class) \
0148     { _class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
0149 
0150 #define DeviceButtonPressGrab(d,type,_class) \
0151     { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
0152 
0153 #define NoExtensionEvent(d,type,_class) \
0154     { _class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
0155 
0156 
0157 /* We need the declaration for DevicePresence. */
0158 #if defined(__cplusplus) || defined(c_plusplus)
0159 extern "C" {
0160 #endif
0161     extern int _XiGetDevicePresenceNotifyEvent(Display *);
0162     extern void _xibaddevice( Display *dpy, int *error);
0163     extern void _xibadclass( Display *dpy, int *error);
0164     extern void _xibadevent( Display *dpy, int *error);
0165     extern void _xibadmode( Display *dpy, int *error);
0166     extern void _xidevicebusy( Display *dpy, int *error);
0167 #if defined(__cplusplus) || defined(c_plusplus)
0168 }
0169 #endif
0170 
0171 #define DevicePresence(dpy, type, _class)                       \
0172     {                                                           \
0173         type = _XiGetDevicePresenceNotifyEvent(dpy);            \
0174         _class =  (0x10000 | _devicePresence);                  \
0175     }
0176 
0177 /* Errors */
0178 #define BadDevice(dpy,error) _xibaddevice(dpy, &error)
0179 
0180 #define BadClass(dpy,error) _xibadclass(dpy, &error)
0181 
0182 #define BadEvent(dpy,error) _xibadevent(dpy, &error)
0183 
0184 #define BadMode(dpy,error) _xibadmode(dpy, &error)
0185 
0186 #define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
0187 
0188 typedef struct _XAnyClassinfo *XAnyClassPtr;
0189 
0190 /***************************************************************
0191  *
0192  * DeviceKey events.  These events are sent by input devices that
0193  * support input class Keys.
0194  * The location of the X pointer is reported in the coordinate
0195  * fields of the x,y and x_root,y_root fields.
0196  *
0197  */
0198 
0199 typedef struct 
0200     {
0201     int            type;         /* of event */
0202     unsigned long  serial;       /* # of last request processed */
0203     Bool           send_event;   /* true if from SendEvent request */
0204     Display        *display;     /* Display the event was read from */
0205     Window         window;       /* "event" window reported relative to */
0206     XID            deviceid;
0207     Window         root;         /* root window event occured on */
0208     Window         subwindow;    /* child window */
0209     Time           time;         /* milliseconds */
0210     int            x, y;         /* x, y coordinates in event window */
0211     int            x_root;       /* coordinates relative to root */
0212     int            y_root;       /* coordinates relative to root */
0213     unsigned int   state;        /* key or button mask */
0214     unsigned int   keycode;      /* detail */
0215     Bool           same_screen;  /* same screen flag */
0216     unsigned int   device_state; /* device key or button mask */
0217     unsigned char  axes_count;
0218     unsigned char  first_axis;
0219     int            axis_data[6];
0220     } XDeviceKeyEvent;
0221 
0222 typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
0223 typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
0224 
0225 /*******************************************************************
0226  *
0227  * DeviceButton events.  These events are sent by extension devices
0228  * that support input class Buttons.
0229  *
0230  */
0231 
0232 typedef struct {
0233     int           type;         /* of event */
0234     unsigned long serial;       /* # of last request processed by server */
0235     Bool          send_event;   /* true if from a SendEvent request */
0236     Display       *display;     /* Display the event was read from */
0237     Window        window;       /* "event" window reported relative to */
0238     XID           deviceid;
0239     Window        root;         /* root window that the event occured on */
0240     Window        subwindow;    /* child window */
0241     Time          time;         /* milliseconds */
0242     int           x, y;         /* x, y coordinates in event window */
0243     int           x_root;       /* coordinates relative to root */
0244     int           y_root;       /* coordinates relative to root */
0245     unsigned int  state;        /* key or button mask */
0246     unsigned int  button;       /* detail */
0247     Bool          same_screen;  /* same screen flag */
0248     unsigned int  device_state; /* device key or button mask */
0249     unsigned char axes_count;
0250     unsigned char first_axis;
0251     int           axis_data[6];
0252     } XDeviceButtonEvent;
0253 
0254 typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
0255 typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
0256 
0257 /*******************************************************************
0258  *
0259  * DeviceMotionNotify event.  These events are sent by extension devices
0260  * that support input class Valuators.
0261  *
0262  */
0263 
0264 typedef struct 
0265     {
0266     int           type;        /* of event */
0267     unsigned long serial;      /* # of last request processed by server */
0268     Bool          send_event;  /* true if from a SendEvent request */
0269     Display       *display;    /* Display the event was read from */
0270     Window        window;      /* "event" window reported relative to */
0271     XID           deviceid;
0272     Window        root;        /* root window that the event occured on */
0273     Window        subwindow;   /* child window */
0274     Time          time;        /* milliseconds */
0275     int           x, y;        /* x, y coordinates in event window */
0276     int           x_root;      /* coordinates relative to root */
0277     int           y_root;      /* coordinates relative to root */
0278     unsigned int  state;       /* key or button mask */
0279     char          is_hint;     /* detail */
0280     Bool          same_screen; /* same screen flag */
0281     unsigned int  device_state; /* device key or button mask */
0282     unsigned char axes_count;
0283     unsigned char first_axis;
0284     int           axis_data[6];
0285     } XDeviceMotionEvent;
0286 
0287 /*******************************************************************
0288  *
0289  * DeviceFocusChange events.  These events are sent when the focus
0290  * of an extension device that can be focused is changed.
0291  *
0292  */
0293 
0294 typedef struct 
0295     {
0296     int           type;       /* of event */
0297     unsigned long serial;     /* # of last request processed by server */
0298     Bool          send_event; /* true if from a SendEvent request */
0299     Display       *display;   /* Display the event was read from */
0300     Window        window;     /* "event" window reported relative to */
0301     XID           deviceid;
0302     int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
0303     int           detail;
0304     /*
0305      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
0306      * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
0307      * NotifyPointerRoot, NotifyDetailNone 
0308      */
0309     Time                time;
0310     } XDeviceFocusChangeEvent;
0311 
0312 typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
0313 typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
0314 
0315 /*******************************************************************
0316  *
0317  * ProximityNotify events.  These events are sent by those absolute
0318  * positioning devices that are capable of generating proximity information.
0319  *
0320  */
0321 
0322 typedef struct 
0323     {
0324     int             type;      /* ProximityIn or ProximityOut */        
0325     unsigned long   serial;    /* # of last request processed by server */
0326     Bool            send_event; /* true if this came from a SendEvent request */
0327     Display         *display;  /* Display the event was read from */
0328     Window          window;      
0329     XID             deviceid;
0330     Window          root;            
0331     Window          subwindow;      
0332     Time            time;            
0333     int             x, y;            
0334     int             x_root, y_root;  
0335     unsigned int    state;           
0336     Bool            same_screen;     
0337     unsigned int    device_state; /* device key or button mask */
0338     unsigned char   axes_count;
0339     unsigned char   first_axis;
0340     int             axis_data[6];
0341     } XProximityNotifyEvent;
0342 typedef XProximityNotifyEvent XProximityInEvent;
0343 typedef XProximityNotifyEvent XProximityOutEvent;
0344 
0345 /*******************************************************************
0346  *
0347  * DeviceStateNotify events are generated on EnterWindow and FocusIn 
0348  * for those clients who have selected DeviceState.
0349  *
0350  */
0351 
0352 typedef struct
0353     {
0354 #if defined(__cplusplus) || defined(c_plusplus)
0355     unsigned char   c_class;
0356 #else
0357     unsigned char   class;
0358 #endif
0359     unsigned char   length;
0360     } XInputClass;
0361 
0362 typedef struct {
0363     int           type;
0364     unsigned long serial;       /* # of last request processed by server */
0365     Bool          send_event;   /* true if this came from a SendEvent request */
0366     Display       *display;     /* Display the event was read from */
0367     Window        window;
0368     XID           deviceid;
0369     Time          time;
0370     int           num_classes;
0371     char      data[64];
0372 } XDeviceStateNotifyEvent;  
0373 
0374 typedef struct {
0375 #if defined(__cplusplus) || defined(c_plusplus)
0376     unsigned char   c_class;
0377 #else
0378     unsigned char   class;
0379 #endif
0380     unsigned char   length;
0381     unsigned char   num_valuators;
0382     unsigned char   mode;
0383     int             valuators[6];
0384 } XValuatorStatus;
0385 
0386 typedef struct {
0387 #if defined(__cplusplus) || defined(c_plusplus)
0388     unsigned char   c_class;
0389 #else
0390     unsigned char   class;
0391 #endif
0392     unsigned char   length;
0393     short       num_keys;
0394     char            keys[32];
0395 } XKeyStatus;
0396 
0397 typedef struct {
0398 #if defined(__cplusplus) || defined(c_plusplus)
0399     unsigned char   c_class;
0400 #else
0401     unsigned char   class;
0402 #endif
0403     unsigned char   length;
0404     short       num_buttons;
0405     char            buttons[32];
0406 } XButtonStatus;
0407 
0408 /*******************************************************************
0409  *
0410  * DeviceMappingNotify event.  This event is sent when the key mapping,
0411  * modifier mapping, or button mapping of an extension device is changed.
0412  *
0413  */
0414 
0415 typedef struct {
0416     int           type;
0417     unsigned long serial;       /* # of last request processed by server */
0418     Bool          send_event;   /* true if this came from a SendEvent request */
0419     Display       *display;     /* Display the event was read from */
0420     Window        window;       /* unused */
0421     XID           deviceid;
0422     Time          time;
0423     int           request;      /* one of MappingModifier, MappingKeyboard,
0424                                     MappingPointer */
0425     int           first_keycode;/* first keycode */
0426     int           count;        /* defines range of change w. first_keycode*/
0427 } XDeviceMappingEvent;
0428 
0429 /*******************************************************************
0430  *
0431  * ChangeDeviceNotify event.  This event is sent when an 
0432  * XChangeKeyboard or XChangePointer request is made.
0433  *
0434  */
0435 
0436 typedef struct {
0437     int           type;
0438     unsigned long serial;       /* # of last request processed by server */
0439     Bool          send_event;   /* true if this came from a SendEvent request */
0440     Display       *display;     /* Display the event was read from */
0441     Window        window;       /* unused */
0442     XID           deviceid;
0443     Time          time;
0444     int           request;      /* NewPointer or NewKeyboard */
0445 } XChangeDeviceNotifyEvent;
0446 
0447 /*******************************************************************
0448  *
0449  * DevicePresenceNotify event.  This event is sent when the list of
0450  * input devices changes, in which case devchange will be false, and
0451  * no information about the change will be contained in the event;
0452  * the client should use XListInputDevices() to learn what has changed.
0453  *
0454  * If devchange is true, an attribute that the server believes is
0455  * important has changed on a device, and the client should use
0456  * XGetDeviceControl to examine the device.  If control is non-zero,
0457  * then that control has changed meaningfully.
0458  */
0459 
0460 typedef struct {
0461     int           type;
0462     unsigned long serial;       /* # of last request processed by server */
0463     Bool          send_event;   /* true if this came from a SendEvent request */
0464     Display       *display;     /* Display the event was read from */
0465     Window        window;       /* unused */
0466     Time          time;
0467     Bool          devchange;
0468     XID           deviceid;
0469     XID           control;
0470 } XDevicePresenceNotifyEvent;
0471 
0472 /*
0473  * Notifies the client that a property on a device has changed value. The
0474  * client is expected to query the server for updated value of the property.
0475  */
0476 typedef struct {
0477     int           type;
0478     unsigned long serial;       /* # of last request processed by server */
0479     Bool          send_event;   /* true if this came from a SendEvent request */
0480     Display       *display;     /* Display the event was read from */
0481     Window        window;       /* unused */
0482     Time          time;
0483     XID           deviceid;     /* id of the device that changed */
0484     Atom          atom;         /* the property that changed */
0485     int           state;        /* PropertyNewValue or PropertyDeleted */
0486 } XDevicePropertyNotifyEvent;
0487 
0488 
0489 /*******************************************************************
0490  *
0491  * Control structures for input devices that support input class
0492  * Feedback.  These are used by the XGetFeedbackControl and 
0493  * XChangeFeedbackControl functions.
0494  *
0495  */
0496 
0497 typedef struct {
0498 #if defined(__cplusplus) || defined(c_plusplus)
0499      XID            c_class;
0500 #else
0501      XID            class;
0502 #endif
0503      int            length;
0504      XID            id;
0505 } XFeedbackState;
0506 
0507 typedef struct {
0508 #if defined(__cplusplus) || defined(c_plusplus)
0509     XID     c_class;
0510 #else
0511     XID     class;
0512 #endif
0513     int     length;
0514     XID     id;
0515     int     click;
0516     int     percent;
0517     int     pitch;
0518     int     duration;
0519     int     led_mask;
0520     int     global_auto_repeat;
0521     char    auto_repeats[32];
0522 } XKbdFeedbackState;
0523 
0524 typedef struct {
0525 #if defined(__cplusplus) || defined(c_plusplus)
0526     XID     c_class;
0527 #else
0528     XID     class;
0529 #endif
0530     int     length;
0531     XID     id;
0532     int     accelNum;
0533     int     accelDenom;
0534     int     threshold;
0535 } XPtrFeedbackState;
0536 
0537 typedef struct {
0538 #if defined(__cplusplus) || defined(c_plusplus)
0539     XID     c_class;
0540 #else
0541     XID     class;
0542 #endif
0543     int     length;
0544     XID     id;
0545     int     resolution;
0546     int     minVal;
0547     int     maxVal;
0548 } XIntegerFeedbackState;
0549 
0550 typedef struct {
0551 #if defined(__cplusplus) || defined(c_plusplus)
0552     XID     c_class;
0553 #else
0554     XID     class;
0555 #endif
0556     int     length;
0557     XID     id;
0558     int     max_symbols;
0559     int     num_syms_supported;
0560     KeySym  *syms_supported;
0561 } XStringFeedbackState;
0562 
0563 typedef struct {
0564 #if defined(__cplusplus) || defined(c_plusplus)
0565     XID     c_class;
0566 #else
0567     XID     class;
0568 #endif
0569     int     length;
0570     XID     id;
0571     int     percent;
0572     int     pitch;
0573     int     duration;
0574 } XBellFeedbackState;
0575 
0576 typedef struct {
0577 #if defined(__cplusplus) || defined(c_plusplus)
0578     XID     c_class;
0579 #else
0580     XID     class;
0581 #endif
0582     int     length;
0583     XID     id;
0584     int     led_values;
0585     int     led_mask;
0586 } XLedFeedbackState;
0587 
0588 typedef struct {
0589 #if defined(__cplusplus) || defined(c_plusplus)
0590      XID            c_class;
0591 #else
0592      XID            class;
0593 #endif
0594      int            length;
0595      XID        id;
0596 } XFeedbackControl;
0597 
0598 typedef struct {
0599 #if defined(__cplusplus) || defined(c_plusplus)
0600     XID     c_class;
0601 #else
0602     XID     class;
0603 #endif
0604     int     length;
0605     XID     id;
0606     int     accelNum;
0607     int     accelDenom;
0608     int     threshold;
0609 } XPtrFeedbackControl;
0610 
0611 typedef struct {
0612 #if defined(__cplusplus) || defined(c_plusplus)
0613     XID     c_class;
0614 #else
0615     XID     class;
0616 #endif
0617     int     length;
0618     XID     id;
0619     int     click;
0620     int     percent;
0621     int     pitch;
0622     int     duration;
0623     int     led_mask;
0624     int     led_value;
0625     int     key;
0626     int     auto_repeat_mode;
0627 } XKbdFeedbackControl;
0628 
0629 typedef struct {
0630 #if defined(__cplusplus) || defined(c_plusplus)
0631     XID     c_class;
0632 #else
0633     XID     class;
0634 #endif
0635     int     length;
0636     XID     id;
0637     int     num_keysyms;
0638     KeySym  *syms_to_display;
0639 } XStringFeedbackControl;
0640 
0641 typedef struct {
0642 #if defined(__cplusplus) || defined(c_plusplus)
0643     XID     c_class;
0644 #else
0645     XID     class;
0646 #endif
0647     int     length;
0648     XID     id;
0649     int     int_to_display;
0650 } XIntegerFeedbackControl;
0651 
0652 typedef struct {
0653 #if defined(__cplusplus) || defined(c_plusplus)
0654     XID     c_class;
0655 #else
0656     XID     class;
0657 #endif
0658     int     length;
0659     XID     id;
0660     int     percent;
0661     int     pitch;
0662     int     duration;
0663 } XBellFeedbackControl;
0664 
0665 typedef struct {
0666 #if defined(__cplusplus) || defined(c_plusplus)
0667     XID     c_class;
0668 #else
0669     XID     class;
0670 #endif
0671     int     length;
0672     XID     id;
0673     int     led_mask;
0674     int     led_values;
0675 } XLedFeedbackControl;
0676 
0677 /*******************************************************************
0678  *
0679  * Device control structures.
0680  *
0681  */
0682 
0683 typedef struct {
0684      XID            control;
0685      int            length;
0686 } XDeviceControl;
0687 
0688 typedef struct {
0689      XID            control;
0690      int            length;
0691      int            first_valuator;
0692      int            num_valuators;
0693      int            *resolutions;
0694 } XDeviceResolutionControl;
0695 
0696 typedef struct {
0697      XID            control;
0698      int            length;
0699      int            num_valuators;
0700      int            *resolutions;
0701      int            *min_resolutions;
0702      int            *max_resolutions;
0703 } XDeviceResolutionState;
0704 
0705 typedef struct {
0706     XID             control;
0707     int             length;
0708     int             min_x;
0709     int             max_x;
0710     int             min_y;
0711     int             max_y;
0712     int             flip_x;
0713     int             flip_y;
0714     int             rotation;
0715     int             button_threshold;
0716 } XDeviceAbsCalibControl, XDeviceAbsCalibState;
0717 
0718 typedef struct {
0719     XID             control;
0720     int             length;
0721     int             offset_x;
0722     int             offset_y;
0723     int             width;
0724     int             height;
0725     int             screen;
0726     XID             following;
0727 } XDeviceAbsAreaControl, XDeviceAbsAreaState;
0728 
0729 typedef struct {
0730     XID             control;
0731     int             length;
0732     int             status;
0733 } XDeviceCoreControl;
0734 
0735 typedef struct {
0736     XID             control;
0737     int             length;
0738     int             status;
0739     int             iscore;
0740 } XDeviceCoreState;
0741 
0742 typedef struct {
0743     XID             control;
0744     int             length;
0745     int             enable;
0746 } XDeviceEnableControl, XDeviceEnableState;
0747 
0748 /*******************************************************************
0749  *
0750  * An array of XDeviceList structures is returned by the 
0751  * XListInputDevices function.  Each entry contains information
0752  * about one input device.  Among that information is an array of 
0753  * pointers to structures that describe the characteristics of 
0754  * the input device.
0755  *
0756  */
0757 
0758 typedef struct _XAnyClassinfo {
0759 #if defined(__cplusplus) || defined(c_plusplus)
0760     XID     c_class;
0761 #else
0762     XID     class;
0763 #endif
0764     int     length;
0765     } XAnyClassInfo;
0766 
0767 typedef struct _XDeviceInfo *XDeviceInfoPtr;
0768 
0769 typedef struct _XDeviceInfo
0770     {
0771     XID                 id;        
0772     Atom                type;
0773     char                *name;
0774     int                 num_classes;
0775     int                 use;
0776     XAnyClassPtr    inputclassinfo;
0777     } XDeviceInfo;
0778 
0779 typedef struct _XKeyInfo *XKeyInfoPtr;
0780 
0781 typedef struct _XKeyInfo
0782     {
0783 #if defined(__cplusplus) || defined(c_plusplus)
0784     XID         c_class;
0785 #else
0786     XID         class;
0787 #endif
0788     int         length;
0789     unsigned short      min_keycode;
0790     unsigned short      max_keycode;
0791     unsigned short      num_keys;
0792     } XKeyInfo;
0793 
0794 typedef struct _XButtonInfo *XButtonInfoPtr;
0795 
0796 typedef struct _XButtonInfo {
0797 #if defined(__cplusplus) || defined(c_plusplus)
0798     XID     c_class;
0799 #else
0800     XID     class;
0801 #endif
0802     int     length;
0803     short   num_buttons;
0804     } XButtonInfo;
0805 
0806 typedef struct _XAxisInfo *XAxisInfoPtr;
0807 
0808 typedef struct _XAxisInfo {
0809     int     resolution;
0810     int     min_value;
0811     int     max_value;
0812     } XAxisInfo;
0813 
0814 typedef struct _XValuatorInfo *XValuatorInfoPtr;
0815 
0816 typedef struct  _XValuatorInfo
0817     {
0818 #if defined(__cplusplus) || defined(c_plusplus)
0819     XID         c_class;
0820 #else
0821     XID         class;
0822 #endif
0823     int         length;
0824     unsigned char       num_axes;
0825     unsigned char       mode;
0826     unsigned long       motion_buffer;
0827     XAxisInfoPtr        axes;
0828     } XValuatorInfo;
0829 
0830 /*******************************************************************
0831  *
0832  * An XDevice structure is returned by the XOpenDevice function.  
0833  * It contains an array of pointers to XInputClassInfo structures.
0834  * Each contains information about a class of input supported by the
0835  * device, including a pointer to an array of data for each type of event
0836  * the device reports.
0837  *
0838  */
0839 
0840 
0841 typedef struct {
0842         unsigned char   input_class;
0843         unsigned char   event_type_base;
0844 } XInputClassInfo;
0845 
0846 typedef struct {
0847         XID                    device_id;
0848         int                    num_classes;
0849         XInputClassInfo        *classes;
0850 } XDevice;
0851 
0852 
0853 /*******************************************************************
0854  *
0855  * The following structure is used to return information for the 
0856  * XGetSelectedExtensionEvents function.
0857  *
0858  */
0859 
0860 typedef struct {
0861         XEventClass     event_type;
0862         XID             device;
0863 } XEventList;
0864 
0865 /*******************************************************************
0866  *
0867  * The following structure is used to return motion history data from 
0868  * an input device that supports the input class Valuators.
0869  * This information is returned by the XGetDeviceMotionEvents function.
0870  *
0871  */
0872 
0873 typedef struct {
0874         Time   time;
0875         int    *data;
0876 } XDeviceTimeCoord;
0877 
0878 
0879 /*******************************************************************
0880  *
0881  * Device state structure.
0882  * This is returned by the XQueryDeviceState request.
0883  *
0884  */
0885 
0886 typedef struct {
0887         XID     device_id;
0888         int     num_classes;
0889         XInputClass *data;
0890 } XDeviceState;
0891 
0892 /*******************************************************************
0893  *
0894  * Note that the mode field is a bitfield that reports the Proximity
0895  * status of the device as well as the mode.  The mode field should
0896  * be OR'd with the mask DeviceMode and compared with the values
0897  * Absolute and Relative to determine the mode, and should be OR'd
0898  * with the mask ProximityState and compared with the values InProximity
0899  * and OutOfProximity to determine the proximity state.
0900  *
0901  */
0902 
0903 typedef struct {
0904 #if defined(__cplusplus) || defined(c_plusplus)
0905     unsigned char   c_class;
0906 #else
0907     unsigned char   class;
0908 #endif
0909     unsigned char   length;
0910     unsigned char   num_valuators;
0911     unsigned char   mode;
0912     int             *valuators;
0913 } XValuatorState;
0914 
0915 typedef struct {
0916 #if defined(__cplusplus) || defined(c_plusplus)
0917     unsigned char   c_class;
0918 #else
0919     unsigned char   class;
0920 #endif
0921     unsigned char   length;
0922     short       num_keys;
0923     char            keys[32];
0924 } XKeyState;
0925 
0926 typedef struct {
0927 #if defined(__cplusplus) || defined(c_plusplus)
0928     unsigned char   c_class;
0929 #else
0930     unsigned char   class;
0931 #endif
0932     unsigned char   length;
0933     short       num_buttons;
0934     char            buttons[32];
0935 } XButtonState;
0936 
0937 
0938 
0939 /*******************************************************************
0940  *
0941  * Function definitions.
0942  *
0943  */
0944 
0945 _XFUNCPROTOBEGIN
0946 
0947 extern int  XChangeKeyboardDevice(
0948     Display*        /* display */,
0949     XDevice*        /* device */
0950 );
0951 
0952 extern int  XChangePointerDevice(
0953     Display*        /* display */,
0954     XDevice*        /* device */,
0955     int         /* xaxis */,
0956     int         /* yaxis */
0957 );
0958 
0959 extern int  XGrabDevice(
0960     Display*        /* display */,
0961     XDevice*        /* device */,
0962     Window      /* grab_window */,
0963     Bool        /* ownerEvents */,
0964     int         /* event count */,
0965     XEventClass*    /* event_list */,
0966     int         /* this_device_mode */,
0967     int         /* other_devices_mode */,
0968     Time        /* time */
0969 );
0970 
0971 extern int  XUngrabDevice(
0972     Display*        /* display */,
0973     XDevice*        /* device */,
0974     Time        /* time */
0975 );
0976 
0977 extern int  XGrabDeviceKey(
0978     Display*        /* display */,
0979     XDevice*        /* device */,
0980     unsigned int    /* key */,
0981     unsigned int    /* modifiers */,
0982     XDevice*        /* modifier_device */,
0983     Window      /* grab_window */,
0984     Bool        /* owner_events */,
0985     unsigned int    /* event_count */,
0986     XEventClass*    /* event_list */,
0987     int         /* this_device_mode */,
0988     int         /* other_devices_mode */
0989 );
0990 
0991 extern int  XUngrabDeviceKey(
0992     Display*        /* display */,
0993     XDevice*        /* device */,
0994     unsigned int    /* key */,
0995     unsigned int    /* modifiers */,
0996     XDevice*        /* modifier_dev */,
0997     Window      /* grab_window */
0998 );
0999 
1000 extern int  XGrabDeviceButton(
1001     Display*        /* display */,
1002     XDevice*        /* device */,
1003     unsigned int    /* button */,
1004     unsigned int    /* modifiers */,
1005     XDevice*        /* modifier_device */,
1006     Window      /* grab_window */,
1007     Bool        /* owner_events */,
1008     unsigned int    /* event_count */,
1009     XEventClass*    /* event_list */,
1010     int         /* this_device_mode */,
1011     int         /* other_devices_mode */
1012 );
1013 
1014 extern int  XUngrabDeviceButton(
1015     Display*        /* display */,
1016     XDevice*        /* device */,
1017     unsigned int    /* button */,
1018     unsigned int    /* modifiers */,
1019     XDevice*        /* modifier_dev */,
1020     Window      /* grab_window */
1021 );
1022 
1023 extern int  XAllowDeviceEvents(
1024     Display*        /* display */,
1025     XDevice*        /* device */,
1026     int         /* event_mode */,
1027     Time        /* time */
1028 );
1029 
1030 extern int  XGetDeviceFocus(
1031     Display*        /* display */,
1032     XDevice*        /* device */,
1033     Window*     /* focus */,
1034     int*        /* revert_to */,
1035     Time*       /* time */
1036 );
1037 
1038 extern int  XSetDeviceFocus(
1039     Display*        /* display */,
1040     XDevice*        /* device */,
1041     Window      /* focus */,
1042     int         /* revert_to */,
1043     Time        /* time */
1044 );
1045 
1046 extern XFeedbackState   *XGetFeedbackControl(
1047     Display*        /* display */,
1048     XDevice*        /* device */,
1049     int*        /* num_feedbacks */
1050 );
1051 
1052 extern void XFreeFeedbackList(
1053     XFeedbackState* /* list */
1054 );
1055 
1056 extern int  XChangeFeedbackControl(
1057     Display*        /* display */,
1058     XDevice*        /* device */,
1059     unsigned long   /* mask */,
1060     XFeedbackControl*   /* f */
1061 );
1062 
1063 extern int  XDeviceBell(
1064     Display*        /* display */,
1065     XDevice*        /* device */,
1066     XID         /* feedbackclass */,
1067     XID         /* feedbackid */,
1068     int         /* percent */
1069 );
1070 
1071 extern KeySym   *XGetDeviceKeyMapping(
1072     Display*        /* display */,
1073     XDevice*        /* device */,
1074 #if NeedWidePrototypes
1075     unsigned int    /* first */,
1076 #else
1077     KeyCode     /* first */,
1078 #endif
1079     int         /* keycount */,
1080     int*        /* syms_per_code */
1081 );
1082 
1083 extern int  XChangeDeviceKeyMapping(
1084     Display*        /* display */,
1085     XDevice*        /* device */,
1086     int         /* first */,
1087     int         /* syms_per_code */,
1088     KeySym*     /* keysyms */,
1089     int         /* count */
1090 );
1091 
1092 extern XModifierKeymap  *XGetDeviceModifierMapping(
1093     Display*        /* display */,
1094     XDevice*        /* device */
1095 );
1096 
1097 extern int  XSetDeviceModifierMapping(
1098     Display*        /* display */,
1099     XDevice*        /* device */,
1100     XModifierKeymap*    /* modmap */
1101 );
1102 
1103 extern int  XSetDeviceButtonMapping(
1104     Display*        /* display */,
1105     XDevice*        /* device */,
1106     unsigned char*  /* map[] */,
1107     int         /* nmap */
1108 );
1109 
1110 extern int  XGetDeviceButtonMapping(
1111     Display*        /* display */,
1112     XDevice*        /* device */,
1113     unsigned char*  /* map[] */,
1114     unsigned int    /* nmap */
1115 );
1116 
1117 extern XDeviceState *XQueryDeviceState(
1118     Display*        /* display */,
1119     XDevice*        /* device */
1120 );
1121 
1122 extern void XFreeDeviceState(
1123     XDeviceState*   /* list */
1124 );
1125 
1126 extern XExtensionVersion    *XGetExtensionVersion(
1127     Display*        /* display */,
1128     _Xconst char*   /* name */
1129 );
1130 
1131 extern XDeviceInfo  *XListInputDevices(
1132     Display*        /* display */,
1133     int*        /* ndevices */
1134 );
1135 
1136 extern void XFreeDeviceList(
1137     XDeviceInfo*    /* list */
1138 );
1139 
1140 extern XDevice  *XOpenDevice(
1141     Display*        /* display */,
1142     XID         /* id */
1143 );
1144 
1145 extern int  XCloseDevice(
1146     Display*        /* display */,
1147     XDevice*        /* device */
1148 );
1149 
1150 extern int  XSetDeviceMode(
1151     Display*        /* display */,
1152     XDevice*        /* device */,
1153     int         /* mode */
1154 );
1155 
1156 extern int  XSetDeviceValuators(
1157     Display*        /* display */,
1158     XDevice*        /* device */,
1159     int*        /* valuators */,
1160     int         /* first_valuator */,
1161     int         /* num_valuators */
1162 );
1163 
1164 extern XDeviceControl   *XGetDeviceControl(
1165     Display*        /* display */,
1166     XDevice*        /* device */,
1167     int         /* control */
1168 );
1169 
1170 extern int  XChangeDeviceControl(
1171     Display*        /* display */,
1172     XDevice*        /* device */,
1173     int         /* control */,
1174     XDeviceControl* /* d */
1175 );
1176 
1177 extern int  XSelectExtensionEvent(
1178     Display*        /* display */,
1179     Window      /* w */,
1180     XEventClass*    /* event_list */,
1181     int         /* count */
1182 );
1183 
1184 extern int XGetSelectedExtensionEvents(
1185     Display*        /* display */,
1186     Window      /* w */,
1187     int*        /* this_client_count */,
1188     XEventClass**   /* this_client_list */,
1189     int*        /* all_clients_count */,
1190     XEventClass**   /* all_clients_list */
1191 );
1192 
1193 extern int  XChangeDeviceDontPropagateList(
1194     Display*        /* display */,
1195     Window      /* window */,
1196     int         /* count */,
1197     XEventClass*    /* events */,
1198     int         /* mode */
1199 );
1200 
1201 extern XEventClass  *XGetDeviceDontPropagateList(
1202     Display*        /* display */,
1203     Window      /* window */,
1204     int*        /* count */
1205 );
1206 
1207 extern Status   XSendExtensionEvent(
1208     Display*        /* display */,
1209     XDevice*        /* device */,
1210     Window      /* dest */,
1211     Bool        /* prop */,
1212     int         /* count */,
1213     XEventClass*    /* list */,
1214     XEvent*     /* event */
1215 );
1216 
1217 extern XDeviceTimeCoord *XGetDeviceMotionEvents(
1218     Display*        /* display */,
1219     XDevice*        /* device */,
1220     Time        /* start */,
1221     Time        /* stop */,
1222     int*        /* nEvents */,
1223     int*        /* mode */,
1224     int*        /* axis_count */
1225 );
1226 
1227 extern void XFreeDeviceMotionEvents(
1228     XDeviceTimeCoord*   /* events */
1229 );
1230 
1231 extern void XFreeDeviceControl(
1232     XDeviceControl* /* control */
1233 );
1234 
1235 extern Atom*   XListDeviceProperties(
1236     Display*            /* dpy */,
1237     XDevice*            /* dev */,
1238     int*                /* nprops_return */
1239 );
1240 
1241 extern void XChangeDeviceProperty(
1242     Display*            /* dpy */,
1243     XDevice*            /* dev */,
1244     Atom                /* property */,
1245     Atom                /* type */,
1246     int                 /* format */,
1247     int                 /* mode */,
1248     _Xconst unsigned char * /*data */,
1249     int                 /* nelements */
1250 );
1251 
1252 extern void
1253 XDeleteDeviceProperty(
1254     Display*            /* dpy */,
1255     XDevice*            /* dev */,
1256     Atom                /* property */
1257 );
1258 
1259 extern Status
1260 XGetDeviceProperty(
1261      Display*           /* dpy*/,
1262      XDevice*           /* dev*/,
1263      Atom               /* property*/,
1264      long               /* offset*/,
1265      long               /* length*/,
1266      Bool               /* delete*/,
1267      Atom               /* req_type*/,
1268      Atom*              /* actual_type*/,
1269      int*               /* actual_format*/,
1270      unsigned long*     /* nitems*/,
1271      unsigned long*     /* bytes_after*/,
1272      unsigned char**    /* prop*/
1273 );
1274 
1275 _XFUNCPROTOEND
1276 
1277 #endif /* _XINPUT_H_ */