diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-08 21:16:54 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-11 14:49:07 +1000 |
commit | 2712dbc2609ad75674c77df04d42899844968e10 (patch) | |
tree | 821356954ab24c5c0007ccc12914f4d4cb0fa504 /src | |
parent | 30c2e3f9398f3d9cbae70150e4bb5cec6dfcc0a1 (diff) |
Add support for XIHierarchyEvent.
Diffstat (limited to 'src')
-rw-r--r-- | src/XExtInt.c | 39 | ||||
-rw-r--r-- | src/XIFreeEvent.c | 3 |
2 files changed, 42 insertions, 0 deletions
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; } } |