diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-11 14:20:05 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-03-11 14:49:07 +1000 |
commit | ffa8a602e7ae20c7430090360818d635f13b392d (patch) | |
tree | 1551e7c377e7d3946c3589b44e6b4f97fb3d5927 /src | |
parent | 5ff39db5c98a9e7e0e85ead6f4ffc59f6f071bd6 (diff) |
Add support for XI2 Enter/Leave events
Diffstat (limited to 'src')
-rw-r--r-- | src/XExtInt.c | 51 | ||||
-rw-r--r-- | src/XIFreeEvent.c | 6 |
2 files changed, 57 insertions, 0 deletions
diff --git a/src/XExtInt.c b/src/XExtInt.c index 8022c26..02a4665 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -132,6 +132,8 @@ static int wireToHierarchyChangedEvent(xXIDeviceHierarchyEvent *in, XIDeviceHierarchyEvent* out); static int wireToRawEvent(xXIRawDeviceEvent *in, XIRawDeviceEvent *out); +static int +wireToEnterLeave(xXIEnterEvent *in, XIEnterEvent *out); static /* const */ XEvent emptyevent; @@ -829,6 +831,16 @@ XInputWireToEvent( break; } return ENQUEUE_EVENT; + case XI_Enter: + case XI_Leave: + *re = *save; + if (!wireToEnterLeave(event, re)) + { + printf("XInputWireToEvent: CONVERSION FAILURE! evtype=%d\n", + ge->evtype); + break; + } + return ENQUEUE_EVENT; default: printf("XInputWireToEvent: Unknown generic event. type %d\n", ge->evtype); @@ -998,3 +1010,42 @@ wireToRawEvent(xXIRawDeviceEvent *in, XIRawDeviceEvent *out) return 1; } + +static int +wireToEnterLeave(xXIEnterEvent *in, XIEnterEvent *out) +{ + out->type = in->type; + out->extension = in->extension; + out->evtype = in->evtype; + out->time = in->time; + out->detail = in->detail; + out->deviceid = in->deviceid; + out->root = in->root; + out->event = in->event; + out->child = in->child; + out->sourceid = in->sourceid; + out->root_x = in->root_x.integral; + out->root_y = in->root_y.integral; + out->event_x = in->event_x.integral; + out->event_y = in->event_y.integral; + out->mode = in->mode; + out->focus = in->focus; + out->same_screen = in->same_screen; + + out->mods = malloc(sizeof(XIModifierState)); + out->group = malloc(sizeof(XIGroupState)); + + out->mods->base = in->mods.base_mods; + out->mods->locked = in->mods.locked_mods; + out->mods->latched = in->mods.latched_mods; + out->group->base = in->group.base_group; + out->group->locked = in->group.locked_group; + out->group->latched = in->group.latched_group; + + out->buttons = malloc(sizeof(XIButtonState) + in->buttons_len * 4); + out->buttons->mask = (unsigned char*)&out->buttons[1]; + out->buttons->mask_len = in->buttons_len; + memcpy(out->buttons->mask, &in[1], out->buttons->mask_len); + + return 1; +} diff --git a/src/XIFreeEvent.c b/src/XIFreeEvent.c index 0c80602..e7ff229 100644 --- a/src/XIFreeEvent.c +++ b/src/XIFreeEvent.c @@ -60,5 +60,11 @@ XIFreeEventData(XIEvent *event) free(((XIRawDeviceEvent*)event)->valuators); free(((XIRawDeviceEvent*)event)->raw_values); break; + case XI_Enter: + case XI_Leave: + free(((XIEnterEvent*)event)->mods); + free(((XIEnterEvent*)event)->group); + free(((XIEnterEvent*)event)->buttons); + break; } } |