Add DeviceClassesChangedEvent.
authorPeter Hutterer <peter@cs.unisa.edu.au>
Tue, 13 Nov 2007 00:59:06 +0000 (11:29 +1030)
committerPeter Hutterer <peter@cs.unisa.edu.au>
Tue, 13 Nov 2007 00:59:06 +0000 (11:29 +1030)
XI.h
XInput.h
XIproto.h

diff --git a/XI.h b/XI.h
index 79d4fcb..1306bc7 100644 (file)
--- a/XI.h
+++ b/XI.h
@@ -319,6 +319,7 @@ SOFTWARE.
 
 /* GE masks */
 #define XI_DeviceHierarchyChangedMask  (1 << 0)
+#define XI_DeviceClassesChangedMask    (1 << 1)
 #define XI_RawDeviceEventMask          (1 << 2)
 
 
index 459ea78..ba3bf6a 100644 (file)
--- a/XInput.h
+++ b/XInput.h
@@ -186,6 +186,8 @@ extern "C" {
 
 #define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
 
+typedef struct _XAnyClassinfo *XAnyClassPtr;
+
 /***************************************************************
  *
  * DeviceKey events.  These events are sent by input devices that
@@ -510,7 +512,26 @@ typedef struct {
 } XDeviceHierarchyChangedEvent;
 
 /*
- * RawDeviceEvent. 
+ * Notifies the client that the classes have been changed. This happens when
+ * the slave device that sends through the master changes.
+ */
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_DeviceHierarchyChangedNotify */
+    Time          time;
+    XID           deviceid;     /* id of the device that changed */
+    XID           slaveid;      /* id of the slave device that caused the
+                                   change */
+    int           num_classes;
+    XAnyClassPtr  inputclassinfo; /* same as in XDeviceInfo */
+} XDeviceClassesChangedEvent;
+
+/*
+ * RawDeviceEvent.
  * Data as received directly from the device.
  */
 typedef struct {
@@ -522,7 +543,7 @@ typedef struct {
     int           evtype;       /* XI_RawDeviceEvent */
     int           event_type;   /* MotionNotify, ButtonPress or
                                    ButtonRelease*/
-    int           deviceid; 
+    XID           deviceid;
     int           buttons;
     int           num_valuators;
     int           first_valuator;
@@ -799,8 +820,6 @@ typedef struct {
  *
  */
 
-typedef struct _XAnyClassinfo *XAnyClassPtr;
-
 typedef struct _XAnyClassinfo {
 #if defined(__cplusplus) || defined(c_plusplus)
     XID        c_class;
index efb7e83..ab676ef 100644 (file)
--- a/XIproto.h
+++ b/XIproto.h
@@ -120,6 +120,7 @@ struct tmask
 
 /* GE events */
 #define XI_DeviceHierarchyChangedNotify        0
+#define XI_DeviceClassesChangedNotify          1
 #define XI_RawDeviceEvent                      2
 
 
@@ -2129,6 +2130,34 @@ typedef struct
     CARD32      pad5 B32;
     } deviceHierarchyChangedEvent;
 
+/*********************************************************
+ * DeviceClassesChangedEvent
+ *
+ * Send whenever a master device changes classes (due to another slave device
+ * sending events).
+ *
+ * Event is followed by the same type of class list as used in the
+ * ListInputDevices request.
+ */
+
+typedef struct
+    {
+    BYTE        type;                /* always GenericEvent */
+    BYTE        extension;           /* XI extension offset */
+    CARD16      sequenceNumber B16;
+    CARD32      length B32;
+    CARD16      evtype B16;          /* XI_DeviceClassesChangedNotify */
+    CARD8       deviceid;            /* id of master */
+    CARD8       new_slave;           /* id of new slave */
+    CARD32      time B32;
+    CARD8       num_classes;
+    CARD8       pad0;
+    CARD16      pad1 B16;
+    CARD32      pad2 B32;
+    CARD32      pad4 B32;
+    CARD32      pad5 B32;
+    } deviceClassesChangedEvent;
+
 
 #undef Window
 #undef Time