Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  * Copyright © 2009 Red Hat, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice (including the next
0012  * paragraph) shall be included in all copies or substantial portions of the
0013  * Software.
0014  *
0015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0018  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0020  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0021  * DEALINGS IN THE SOFTWARE.
0022  *
0023  */
0024 
0025 /* Definitions used by the library and client */
0026 
0027 #ifndef _XINPUT2_H_
0028 #define _XINPUT2_H_
0029 
0030 #include <X11/Xlib.h>
0031 #include <X11/extensions/XI2.h>
0032 #include <X11/extensions/Xge.h>
0033 #include <X11/extensions/Xfixes.h> /* PointerBarrier */
0034 
0035 /*******************************************************************
0036  *
0037  */
0038 typedef struct {
0039     int                 type;
0040     char*               name;
0041     Bool                send_core;
0042     Bool                enable;
0043 } XIAddMasterInfo;
0044 
0045 typedef struct {
0046     int                 type;
0047     int                 deviceid;
0048     int                 return_mode; /* AttachToMaster, Floating */
0049     int                 return_pointer;
0050     int                 return_keyboard;
0051 } XIRemoveMasterInfo;
0052 
0053 typedef struct {
0054     int                 type;
0055     int                 deviceid;
0056     int                 new_master;
0057 } XIAttachSlaveInfo;
0058 
0059 typedef struct {
0060     int                 type;
0061     int                 deviceid;
0062 } XIDetachSlaveInfo;
0063 
0064 typedef union {
0065     int                   type; /* must be first element */
0066     XIAddMasterInfo       add;
0067     XIRemoveMasterInfo    remove;
0068     XIAttachSlaveInfo     attach;
0069     XIDetachSlaveInfo     detach;
0070 } XIAnyHierarchyChangeInfo;
0071 
0072 typedef struct
0073 {
0074     int    base;
0075     int    latched;
0076     int    locked;
0077     int    effective;
0078 } XIModifierState;
0079 
0080 typedef XIModifierState XIGroupState;
0081 
0082 typedef struct {
0083     int           mask_len;
0084     unsigned char *mask;
0085 } XIButtonState;
0086 
0087 typedef struct {
0088     int           mask_len;
0089     unsigned char *mask;
0090     double        *values;
0091 } XIValuatorState;
0092 
0093 
0094 typedef struct
0095 {
0096     int                 deviceid;
0097     int                 mask_len;
0098     unsigned char*      mask;
0099 } XIEventMask;
0100 
0101 typedef struct
0102 {
0103     int         type;
0104     int         sourceid;
0105 } XIAnyClassInfo;
0106 
0107 typedef struct
0108 {
0109     int         type;
0110     int         sourceid;
0111     int         num_buttons;
0112     Atom        *labels;
0113     XIButtonState state;
0114 } XIButtonClassInfo;
0115 
0116 typedef struct
0117 {
0118     int         type;
0119     int         sourceid;
0120     int         num_keycodes;
0121     int         *keycodes;
0122 } XIKeyClassInfo;
0123 
0124 typedef struct
0125 {
0126     int         type;
0127     int         sourceid;
0128     int         number;
0129     Atom        label;
0130     double      min;
0131     double      max;
0132     double      value;
0133     int         resolution;
0134     int         mode;
0135 } XIValuatorClassInfo;
0136 
0137 /* new in XI 2.1 */
0138 typedef struct
0139 {
0140     int         type;
0141     int         sourceid;
0142     int         number;
0143     int         scroll_type;
0144     double      increment;
0145     int         flags;
0146 } XIScrollClassInfo;
0147 
0148 typedef struct
0149 {
0150     int         type;
0151     int         sourceid;
0152     int         mode;
0153     int         num_touches;
0154 } XITouchClassInfo;
0155 
0156 typedef struct
0157 {
0158     int                 deviceid;
0159     char                *name;
0160     int                 use;
0161     int                 attachment;
0162     Bool                enabled;
0163     int                 num_classes;
0164     XIAnyClassInfo      **classes;
0165 } XIDeviceInfo;
0166 
0167 typedef struct
0168 {
0169     int                 modifiers;
0170     int                 status;
0171 } XIGrabModifiers;
0172 
0173 typedef unsigned int BarrierEventID;
0174 
0175 typedef struct
0176 {
0177     int                 deviceid;
0178     PointerBarrier      barrier;
0179     BarrierEventID      eventid;
0180 } XIBarrierReleasePointerInfo;
0181 
0182 /**
0183  * Generic XI2 event. All XI2 events have the same header.
0184  */
0185 typedef struct {
0186     int           type;         /* GenericEvent */
0187     unsigned long serial;       /* # of last request processed by server */
0188     Bool          send_event;   /* true if this came from a SendEvent request */
0189     Display       *display;     /* Display the event was read from */
0190     int           extension;    /* XI extension offset */
0191     int           evtype;
0192     Time          time;
0193 } XIEvent;
0194 
0195 
0196 typedef struct {
0197     int           deviceid;
0198     int           attachment;
0199     int           use;
0200     Bool          enabled;
0201     int           flags;
0202 } XIHierarchyInfo;
0203 
0204 /*
0205  * Notifies the client that the device hierarchy has been changed. The client
0206  * is expected to re-query the server for the device hierarchy.
0207  */
0208 typedef struct {
0209     int           type;         /* GenericEvent */
0210     unsigned long serial;       /* # of last request processed by server */
0211     Bool          send_event;   /* true if this came from a SendEvent request */
0212     Display       *display;     /* Display the event was read from */
0213     int           extension;    /* XI extension offset */
0214     int           evtype;       /* XI_HierarchyChanged */
0215     Time          time;
0216     int           flags;
0217     int           num_info;
0218     XIHierarchyInfo *info;
0219 } XIHierarchyEvent;
0220 
0221 /*
0222  * Notifies the client that the classes have been changed. This happens when
0223  * the slave device that sends through the master changes.
0224  */
0225 typedef struct {
0226     int           type;         /* GenericEvent */
0227     unsigned long serial;       /* # of last request processed by server */
0228     Bool          send_event;   /* true if this came from a SendEvent request */
0229     Display       *display;     /* Display the event was read from */
0230     int           extension;    /* XI extension offset */
0231     int           evtype;       /* XI_DeviceChanged */
0232     Time          time;
0233     int           deviceid;     /* id of the device that changed */
0234     int           sourceid;     /* Source for the new classes. */
0235     int           reason;       /* Reason for the change */
0236     int           num_classes;
0237     XIAnyClassInfo **classes; /* same as in XIDeviceInfo */
0238 } XIDeviceChangedEvent;
0239 
0240 typedef struct {
0241     int           type;         /* GenericEvent */
0242     unsigned long serial;       /* # of last request processed by server */
0243     Bool          send_event;   /* true if this came from a SendEvent request */
0244     Display       *display;     /* Display the event was read from */
0245     int           extension;    /* XI extension offset */
0246     int           evtype;
0247     Time          time;
0248     int           deviceid;
0249     int           sourceid;
0250     int           detail;
0251     Window        root;
0252     Window        event;
0253     Window        child;
0254     double        root_x;
0255     double        root_y;
0256     double        event_x;
0257     double        event_y;
0258     int           flags;
0259     XIButtonState       buttons;
0260     XIValuatorState     valuators;
0261     XIModifierState     mods;
0262     XIGroupState        group;
0263 } XIDeviceEvent;
0264 
0265 typedef struct {
0266     int           type;         /* GenericEvent */
0267     unsigned long serial;       /* # of last request processed by server */
0268     Bool          send_event;   /* true if this came from a SendEvent request */
0269     Display       *display;     /* Display the event was read from */
0270     int           extension;    /* XI extension offset */
0271     int           evtype;       /* XI_RawKeyPress, XI_RawKeyRelease, etc. */
0272     Time          time;
0273     int           deviceid;
0274     int           sourceid;     /* Bug: Always 0. https://bugs.freedesktop.org//show_bug.cgi?id=34240 */
0275     int           detail;
0276     int           flags;
0277     XIValuatorState valuators;
0278     double        *raw_values;
0279 } XIRawEvent;
0280 
0281 typedef struct {
0282     int           type;         /* GenericEvent */
0283     unsigned long serial;       /* # of last request processed by server */
0284     Bool          send_event;   /* true if this came from a SendEvent request */
0285     Display       *display;     /* Display the event was read from */
0286     int           extension;    /* XI extension offset */
0287     int           evtype;
0288     Time          time;
0289     int           deviceid;
0290     int           sourceid;
0291     int           detail;
0292     Window        root;
0293     Window        event;
0294     Window        child;
0295     double        root_x;
0296     double        root_y;
0297     double        event_x;
0298     double        event_y;
0299     int           mode;
0300     Bool          focus;
0301     Bool          same_screen;
0302     XIButtonState       buttons;
0303     XIModifierState     mods;
0304     XIGroupState        group;
0305 } XIEnterEvent;
0306 
0307 typedef XIEnterEvent XILeaveEvent;
0308 typedef XIEnterEvent XIFocusInEvent;
0309 typedef XIEnterEvent XIFocusOutEvent;
0310 
0311 typedef struct {
0312     int           type;         /* GenericEvent */
0313     unsigned long serial;       /* # of last request processed by server */
0314     Bool          send_event;   /* true if this came from a SendEvent request */
0315     Display       *display;     /* Display the event was read from */
0316     int           extension;    /* XI extension offset */
0317     int           evtype;       /* XI_PropertyEvent */
0318     Time          time;
0319     int           deviceid;     /* id of the device that changed */
0320     Atom          property;
0321     int           what;
0322 } XIPropertyEvent;
0323 
0324 typedef struct {
0325     int           type;         /* GenericEvent */
0326     unsigned long serial;       /* # of last request processed by server */
0327     Bool          send_event;   /* true if this came from a SendEvent request */
0328     Display       *display;     /* Display the event was read from */
0329     int           extension;    /* XI extension offset */
0330     int           evtype;
0331     Time          time;
0332     int           deviceid;
0333     int           sourceid;
0334     unsigned int  touchid;
0335     Window        root;
0336     Window        event;
0337     Window        child;
0338     int           flags;
0339 } XITouchOwnershipEvent;
0340 
0341 typedef struct {
0342     int           type;         /* GenericEvent */
0343     unsigned long serial;       /* # of last request processed by server */
0344     Bool          send_event;   /* true if this came from a SendEvent request */
0345     Display       *display;     /* Display the event was read from */
0346     int           extension;    /* XI extension offset */
0347     int           evtype;
0348     Time          time;
0349     int           deviceid;
0350     int           sourceid;
0351     Window        event;
0352     Window        root;
0353     double        root_x;
0354     double        root_y;
0355     double        dx;
0356     double        dy;
0357     int           dtime;
0358     int           flags;
0359     PointerBarrier barrier;
0360     BarrierEventID eventid;
0361 } XIBarrierEvent;
0362 
0363 _XFUNCPROTOBEGIN
0364 
0365 extern Bool     XIQueryPointer(
0366     Display*            display,
0367     int                 deviceid,
0368     Window              win,
0369     Window*             root,
0370     Window*             child,
0371     double*             root_x,
0372     double*             root_y,
0373     double*             win_x,
0374     double*             win_y,
0375     XIButtonState       *buttons,
0376     XIModifierState     *mods,
0377     XIGroupState        *group
0378 );
0379 
0380 extern Bool     XIWarpPointer(
0381     Display*            display,
0382     int                 deviceid,
0383     Window              src_win,
0384     Window              dst_win,
0385     double              src_x,
0386     double              src_y,
0387     unsigned int        src_width,
0388     unsigned int        src_height,
0389     double              dst_x,
0390     double              dst_y
0391 );
0392 
0393 extern Status   XIDefineCursor(
0394     Display*            display,
0395     int                 deviceid,
0396     Window              win,
0397     Cursor              cursor
0398 );
0399 
0400 extern Status   XIUndefineCursor(
0401     Display*            display,
0402     int                 deviceid,
0403     Window              win
0404 );
0405 
0406 extern Status   XIChangeHierarchy(
0407     Display*            display,
0408     XIAnyHierarchyChangeInfo*  changes,
0409     int                 num_changes
0410 );
0411 
0412 extern Status   XISetClientPointer(
0413     Display*            dpy,
0414     Window              win,
0415     int                 deviceid
0416 );
0417 
0418 extern Bool     XIGetClientPointer(
0419     Display*            dpy,
0420     Window              win,
0421     int*                deviceid
0422 );
0423 
0424 extern int      XISelectEvents(
0425      Display*            dpy,
0426      Window              win,
0427      XIEventMask         *masks,
0428      int                 num_masks
0429 );
0430 
0431 extern XIEventMask *XIGetSelectedEvents(
0432      Display*            dpy,
0433      Window              win,
0434      int                 *num_masks_return
0435 );
0436 
0437 extern Status XIQueryVersion(
0438      Display*           dpy,
0439      int*               major_version_inout,
0440      int*               minor_version_inout
0441 );
0442 
0443 extern XIDeviceInfo* XIQueryDevice(
0444      Display*           dpy,
0445      int                deviceid,
0446      int*               ndevices_return
0447 );
0448 
0449 extern Status XISetFocus(
0450      Display*           dpy,
0451      int                deviceid,
0452      Window             focus,
0453      Time               time
0454 );
0455 
0456 extern Status XIGetFocus(
0457      Display*           dpy,
0458      int                deviceid,
0459      Window             *focus_return);
0460 
0461 extern Status XIGrabDevice(
0462      Display*           dpy,
0463      int                deviceid,
0464      Window             grab_window,
0465      Time               time,
0466      Cursor             cursor,
0467      int                grab_mode,
0468      int                paired_device_mode,
0469      Bool               owner_events,
0470      XIEventMask        *mask
0471 );
0472 
0473 extern Status XIUngrabDevice(
0474      Display*           dpy,
0475      int                deviceid,
0476      Time               time
0477 );
0478 
0479 extern Status XIAllowEvents(
0480     Display*            display,
0481     int                 deviceid,
0482     int                 event_mode,
0483     Time                time
0484 );
0485 
0486 extern Status XIAllowTouchEvents(
0487     Display*            display,
0488     int                 deviceid,
0489     unsigned int        touchid,
0490     Window              grab_window,
0491     int                 event_mode
0492 );
0493 
0494 extern int XIGrabButton(
0495     Display*            display,
0496     int                 deviceid,
0497     int                 button,
0498     Window              grab_window,
0499     Cursor              cursor,
0500     int                 grab_mode,
0501     int                 paired_device_mode,
0502     int                 owner_events,
0503     XIEventMask         *mask,
0504     int                 num_modifiers,
0505     XIGrabModifiers     *modifiers_inout
0506 );
0507 
0508 extern int XIGrabKeycode(
0509     Display*            display,
0510     int                 deviceid,
0511     int                 keycode,
0512     Window              grab_window,
0513     int                 grab_mode,
0514     int                 paired_device_mode,
0515     int                 owner_events,
0516     XIEventMask         *mask,
0517     int                 num_modifiers,
0518     XIGrabModifiers     *modifiers_inout
0519 );
0520 
0521 extern int XIGrabEnter(
0522     Display*            display,
0523     int                 deviceid,
0524     Window              grab_window,
0525     Cursor              cursor,
0526     int                 grab_mode,
0527     int                 paired_device_mode,
0528     int                 owner_events,
0529     XIEventMask         *mask,
0530     int                 num_modifiers,
0531     XIGrabModifiers     *modifiers_inout
0532 );
0533 
0534 extern int XIGrabFocusIn(
0535     Display*            display,
0536     int                 deviceid,
0537     Window              grab_window,
0538     int                 grab_mode,
0539     int                 paired_device_mode,
0540     int                 owner_events,
0541     XIEventMask         *mask,
0542     int                 num_modifiers,
0543     XIGrabModifiers     *modifiers_inout
0544 );
0545 
0546 extern int XIGrabTouchBegin(
0547     Display*            display,
0548     int                 deviceid,
0549     Window              grab_window,
0550     int                 owner_events,
0551     XIEventMask         *mask,
0552     int                 num_modifiers,
0553     XIGrabModifiers     *modifiers_inout
0554 );
0555 
0556 extern Status XIUngrabButton(
0557     Display*            display,
0558     int                 deviceid,
0559     int                 button,
0560     Window              grab_window,
0561     int                 num_modifiers,
0562     XIGrabModifiers     *modifiers
0563 );
0564 
0565 extern Status XIUngrabKeycode(
0566     Display*            display,
0567     int                 deviceid,
0568     int                 keycode,
0569     Window              grab_window,
0570     int                 num_modifiers,
0571     XIGrabModifiers     *modifiers
0572 );
0573 
0574 extern Status XIUngrabEnter(
0575     Display*            display,
0576     int                 deviceid,
0577     Window              grab_window,
0578     int                 num_modifiers,
0579     XIGrabModifiers     *modifiers
0580 );
0581 
0582 extern Status XIUngrabFocusIn(
0583     Display*            display,
0584     int                 deviceid,
0585     Window              grab_window,
0586     int                 num_modifiers,
0587     XIGrabModifiers     *modifiers
0588 );
0589 
0590 extern Status XIUngrabTouchBegin(
0591     Display*            display,
0592     int                 deviceid,
0593     Window              grab_window,
0594     int                 num_modifiers,
0595     XIGrabModifiers     *modifiers
0596 );
0597 
0598 extern Atom *XIListProperties(
0599     Display*            display,
0600     int                 deviceid,
0601     int                 *num_props_return
0602 );
0603 
0604 extern void XIChangeProperty(
0605     Display*            display,
0606     int                 deviceid,
0607     Atom                property,
0608     Atom                type,
0609     int                 format,
0610     int                 mode,
0611     unsigned char       *data,
0612     int                 num_items
0613 );
0614 
0615 extern void
0616 XIDeleteProperty(
0617     Display*            display,
0618     int                 deviceid,
0619     Atom                property
0620 );
0621 
0622 extern Status
0623 XIGetProperty(
0624     Display*            display,
0625     int                 deviceid,
0626     Atom                property,
0627     long                offset,
0628     long                length,
0629     Bool                delete_property,
0630     Atom                type,
0631     Atom                *type_return,
0632     int                 *format_return,
0633     unsigned long       *num_items_return,
0634     unsigned long       *bytes_after_return,
0635     unsigned char       **data
0636 );
0637 
0638 extern void
0639 XIBarrierReleasePointers(
0640     Display*                    display,
0641     XIBarrierReleasePointerInfo *barriers,
0642     int                         num_barriers
0643 );
0644 
0645 extern void
0646 XIBarrierReleasePointer(
0647     Display*                    display,
0648     int                         deviceid,
0649     PointerBarrier              barrier,
0650     BarrierEventID              eventid
0651 );
0652 
0653 extern void XIFreeDeviceInfo(XIDeviceInfo       *info);
0654 
0655 _XFUNCPROTOEND
0656 
0657 #endif /* XINPUT2_H */