diff options
author | Chris Michael <cp.michael@samsung.com> | 2017-01-12 11:09:47 -0500 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2017-01-12 11:11:50 -0500 |
commit | 251f52006fc5b73fbe27b89ad65688ef906c7869 (patch) | |
tree | 6fe67e07b56f45116b8cbfae2616f3fc0a9d06a5 /src/lib/elput | |
parent | 343a27232899c377397466877201f45f1ec94a10 (diff) |
elput: Send touch motion before sending touch button events
This patch sends a touch motion event before sending of touch up/down
events. This allows some compositors (enlightenment) to update their
internal representation of where the mouse pointer is before handling
button events (as touch down/up is treated as a mouse button down/up).
Fixes T5094 for the old man ;)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/elput')
-rw-r--r-- | src/lib/elput/elput_evdev.c | 84 |
1 files changed, 41 insertions, 43 deletions
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c index 6a4f1706a4..8bbb5917b5 100644 --- a/src/lib/elput/elput_evdev.c +++ b/src/lib/elput/elput_evdev.c | |||
@@ -582,8 +582,6 @@ _touch_create(Elput_Seat *seat) | |||
582 | touch = calloc(1, sizeof(Elput_Touch)); | 582 | touch = calloc(1, sizeof(Elput_Touch)); |
583 | if (!touch) return NULL; | 583 | if (!touch) return NULL; |
584 | 584 | ||
585 | touch->x = -1; | ||
586 | touch->y = -1; | ||
587 | touch->seat = seat; | 585 | touch->seat = seat; |
588 | 586 | ||
589 | return touch; | 587 | return touch; |
@@ -1006,6 +1004,45 @@ _touch_event_send(Elput_Device *dev, int type) | |||
1006 | } | 1004 | } |
1007 | 1005 | ||
1008 | static void | 1006 | static void |
1007 | _touch_motion_send(Elput_Device *dev) | ||
1008 | { | ||
1009 | Elput_Touch *touch; | ||
1010 | Ecore_Event_Mouse_Move *ev; | ||
1011 | |||
1012 | touch = _evdev_touch_get(dev->seat); | ||
1013 | if (!touch) return; | ||
1014 | |||
1015 | ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)); | ||
1016 | if (!ev) return; | ||
1017 | |||
1018 | ev->window = dev->seat->manager->window; | ||
1019 | ev->event_window = dev->seat->manager->window; | ||
1020 | ev->root_window = dev->seat->manager->window; | ||
1021 | ev->timestamp = touch->timestamp; | ||
1022 | ev->same_screen = 1; | ||
1023 | |||
1024 | ev->x = touch->x; | ||
1025 | ev->y = touch->y; | ||
1026 | ev->root.x = touch->x; | ||
1027 | ev->root.y = touch->y; | ||
1028 | |||
1029 | ev->modifiers = dev->seat->modifiers; | ||
1030 | |||
1031 | ev->multi.device = touch->slot; | ||
1032 | ev->multi.radius = 1; | ||
1033 | ev->multi.radius_x = 1; | ||
1034 | ev->multi.radius_y = 1; | ||
1035 | ev->multi.pressure = 1.0; | ||
1036 | ev->multi.angle = 0.0; | ||
1037 | ev->multi.x = ev->x; | ||
1038 | ev->multi.y = ev->y; | ||
1039 | ev->multi.root.x = ev->x; | ||
1040 | ev->multi.root.y = ev->y; | ||
1041 | |||
1042 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); | ||
1043 | } | ||
1044 | |||
1045 | static void | ||
1009 | _touch_down(struct libinput_device *idevice, struct libinput_event_touch *event) | 1046 | _touch_down(struct libinput_device *idevice, struct libinput_event_touch *event) |
1010 | { | 1047 | { |
1011 | Elput_Device *dev; | 1048 | Elput_Device *dev; |
@@ -1036,6 +1073,7 @@ _touch_down(struct libinput_device *idevice, struct libinput_event_touch *event) | |||
1036 | 1073 | ||
1037 | touch->points++; | 1074 | touch->points++; |
1038 | 1075 | ||
1076 | _touch_motion_send(dev); | ||
1039 | _touch_event_send(dev, ECORE_EVENT_MOUSE_BUTTON_DOWN); | 1077 | _touch_event_send(dev, ECORE_EVENT_MOUSE_BUTTON_DOWN); |
1040 | 1078 | ||
1041 | if (touch->points == 1) | 1079 | if (touch->points == 1) |
@@ -1062,52 +1100,12 @@ _touch_up(struct libinput_device *idevice, struct libinput_event_touch *event) | |||
1062 | touch->points--; | 1100 | touch->points--; |
1063 | touch->slot = libinput_event_touch_get_seat_slot(event); | 1101 | touch->slot = libinput_event_touch_get_seat_slot(event); |
1064 | touch->timestamp = libinput_event_touch_get_time(event); | 1102 | touch->timestamp = libinput_event_touch_get_time(event); |
1065 | touch->x = 0; | ||
1066 | touch->y = 0; | ||
1067 | 1103 | ||
1104 | _touch_motion_send(dev); | ||
1068 | _touch_event_send(dev, ECORE_EVENT_MOUSE_BUTTON_UP); | 1105 | _touch_event_send(dev, ECORE_EVENT_MOUSE_BUTTON_UP); |
1069 | } | 1106 | } |
1070 | 1107 | ||
1071 | static void | 1108 | static void |
1072 | _touch_motion_send(Elput_Device *dev) | ||
1073 | { | ||
1074 | Elput_Touch *touch; | ||
1075 | Ecore_Event_Mouse_Move *ev; | ||
1076 | |||
1077 | touch = _evdev_touch_get(dev->seat); | ||
1078 | if (!touch) return; | ||
1079 | |||
1080 | ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)); | ||
1081 | if (!ev) return; | ||
1082 | |||
1083 | ev->window = dev->seat->manager->window; | ||
1084 | ev->event_window = dev->seat->manager->window; | ||
1085 | ev->root_window = dev->seat->manager->window; | ||
1086 | ev->timestamp = touch->timestamp; | ||
1087 | ev->same_screen = 1; | ||
1088 | |||
1089 | ev->x = touch->x; | ||
1090 | ev->y = touch->y; | ||
1091 | ev->root.x = touch->x; | ||
1092 | ev->root.y = touch->y; | ||
1093 | |||
1094 | ev->modifiers = dev->seat->modifiers; | ||
1095 | |||
1096 | ev->multi.device = touch->slot; | ||
1097 | ev->multi.radius = 1; | ||
1098 | ev->multi.radius_x = 1; | ||
1099 | ev->multi.radius_y = 1; | ||
1100 | ev->multi.pressure = 1.0; | ||
1101 | ev->multi.angle = 0.0; | ||
1102 | ev->multi.x = ev->x; | ||
1103 | ev->multi.y = ev->y; | ||
1104 | ev->multi.root.x = ev->x; | ||
1105 | ev->multi.root.y = ev->y; | ||
1106 | |||
1107 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); | ||
1108 | } | ||
1109 | |||
1110 | static void | ||
1111 | _touch_motion(struct libinput_device *idevice, struct libinput_event_touch *event) | 1109 | _touch_motion(struct libinput_device *idevice, struct libinput_event_touch *event) |
1112 | { | 1110 | { |
1113 | Elput_Device *dev; | 1111 | Elput_Device *dev; |