diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-08 21:32:31 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-20 15:17:56 +1000 |
commit | 32f338263ff7de1a2e76d570c98f5be979c18d4e (patch) | |
tree | 9aeb5374d025da9ffee8178317bf3a222eb841a8 /Xi/extinit.c | |
parent | 97e89a59572a4be6757510a317c142ec1d82e8f8 (diff) |
Xi: Deliver XI2 HierarchyEvents when the hierarchy changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi/extinit.c')
-rw-r--r-- | Xi/extinit.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Xi/extinit.c b/Xi/extinit.c index f0aa9f672..8c9f9e111 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -739,6 +739,32 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to) } } +static void SDeviceHierarchyEvent(xXIDeviceHierarchyEvent *from, + xXIDeviceHierarchyEvent *to) +{ + int i; + char n; + xXIHierarchyInfo *info; + + *to = *from; + memcpy(&to[1], &from[1], from->length * 4); + swaps(&to->sequenceNumber, n); + swapl(&to->length, n); + swaps(&to->evtype, n); + swaps(&to->deviceid, n); + swapl(&to->time, n); + swapl(&to->flags, n); + swaps(&to->num_devices, n); + + info = (xXIHierarchyInfo*)&to[1]; + for (i = 0; i< from->num_devices; i++) + { + swaps(&info->deviceid, n); + swaps(&info->attachment, n); + info++; + } +} + /** Event swapping function for XI2 events. */ static void XI2EventSwap(xGenericEvent *from, xGenericEvent *to) @@ -753,6 +779,9 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to) SDeviceChangedEvent((xXIDeviceChangedEvent*)from, (xXIDeviceChangedEvent*)to); break; + case XI_HierarchyChanged: + SDeviceHierarchyEvent((xXIDeviceHierarchyEvent*)from, + (xXIDeviceHierarchyEvent*)to); default: SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to); break; |