summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-03-08 21:16:54 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-03-11 14:49:07 +1000
commit2712dbc2609ad75674c77df04d42899844968e10 (patch)
tree821356954ab24c5c0007ccc12914f4d4cb0fa504
parent30c2e3f9398f3d9cbae70150e4bb5cec6dfcc0a1 (diff)
Add support for XIHierarchyEvent.
-rw-r--r--include/X11/extensions/XInput2.h13
-rw-r--r--src/XExtInt.c39
-rw-r--r--src/XIFreeEvent.c3
3 files changed, 54 insertions, 1 deletions
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h
index 4ef622c..e0ca45a 100644
--- a/include/X11/extensions/XInput2.h
+++ b/include/X11/extensions/XInput2.h
@@ -131,6 +131,14 @@ typedef struct {
char pad[68]; /* force same size as XEvent */
} XIEvent;
+
+typedef struct {
+ int deviceid;
+ int attachment;
+ int use;
+ Bool enabled;
+} XIHierarchyInfo;
+
/*
* Notifies the client that the device hierarchy has been changed. The client
* is expected to re-query the server for the device hierarchy.
@@ -143,7 +151,10 @@ typedef struct {
int extension; /* XI extension offset */
int evtype; /* XI_DeviceHierarchyChangedNotify */
Time time;
-} XDeviceHierarchyChangedEvent;
+ int flags;
+ int num_devices;
+ XIHierarchyInfo *info;
+} XIDeviceHierarchyEvent;
/*
* Notifies the client that the classes have been changed. This happens when
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 77575b3..22c054e 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -128,6 +128,8 @@ static int
wireToDeviceEvent(xXIDeviceEvent *in, XIDeviceEvent* out);
static int
wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XIDeviceChangedEvent* out);
+static int
+wireToHierarchyChangedEvent(xXIDeviceHierarchyEvent *in, XIDeviceHierarchyEvent* out);
static /* const */ XEvent emptyevent;
@@ -806,6 +808,15 @@ XInputWireToEvent(
break;
}
return ENQUEUE_EVENT;
+ case XI_HierarchyChanged:
+ *re = *save;
+ if (!wireToHierarchyChangedEvent(event, re))
+ {
+ printf("XInputWireToEvent: CONVERSION FAILURE! evtype=%d\n",
+ ge->evtype);
+ break;
+ }
+ return ENQUEUE_EVENT;
#if 0
case XI_HierarchyChangedNotify:
@@ -964,3 +975,31 @@ wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XIDeviceChangedEvent* out)
return 1;
}
+static int
+wireToHierarchyChangedEvent(xXIDeviceHierarchyEvent *in, XIDeviceHierarchyEvent* out)
+{
+ int i;
+ XIHierarchyInfo *info_out;
+ xXIHierarchyInfo *info_in;
+
+ out->info = Xmalloc(in->num_devices * sizeof(XIHierarchyInfo));
+ out->type = in->type;
+ out->extension = in->extension;
+ out->evtype = in->evtype;
+ out->time = in->time;
+ out->flags = in->flags;
+ out->num_devices = in->num_devices;
+
+ info_out = out->info;
+ info_in = (xXIHierarchyInfo*)&in[1];
+
+ for (i = 0; i < out->num_devices; i++, info_out++, info_in++)
+ {
+ info_out->deviceid = info_in->deviceid;
+ info_out->attachment = info_in->attachment;
+ info_out->use = info_in->use;
+ info_out->enabled = info_in->enabled;
+ }
+
+ return 1;
+}
diff --git a/src/XIFreeEvent.c b/src/XIFreeEvent.c
index 053cd2e..004b9e4 100644
--- a/src/XIFreeEvent.c
+++ b/src/XIFreeEvent.c
@@ -52,5 +52,8 @@ XIFreeEventData(XIEvent *event)
case XI_DeviceChanged:
free(((XIDeviceChangedEvent*)event)->classes);
break;
+ case XI_HierarchyChanged:
+ free(((XIDeviceHierarchyEvent*)event)->info);
+ break;
}
}