From 2e0dc2a1f94edc40fc0c1ba938bb92d3c3a4d43f Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 17 Jan 2017 12:31:01 -0500 Subject: [PATCH] ecore-wl2: Add function to get touch device When we are sending input events, if we have no pointer device then we should be setting ev->dev to a touch device (as touch events are treated as pointer events inside EFL). NB: This allows EFL clients to get touch events in Enlightenment. There are still some small hiccups here (can't close terminology by pressing the 'x' in the corner, cannot scroll elm_test srollbar, etc). Likely EFL needs to change wrt all this...perhaps adding events for touch that are separate from pointer ?... ref T5094 Signed-off-by: Chris Michael --- src/lib/ecore_wl2/ecore_wl2_input.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c index 3e7fd98753..96665b9091 100644 --- a/src/lib/ecore_wl2/ecore_wl2_input.c +++ b/src/lib/ecore_wl2/ecore_wl2_input.c @@ -83,6 +83,18 @@ _ecore_wl2_mouse_dev_get(Ecore_Wl2_Input *input, int window_id) return NULL; } +static Eo * +_ecore_wl2_touch_dev_get(Ecore_Wl2_Input *input, int window_id) +{ + Ecore_Wl2_Input_Devices *devices; + + devices = _ecore_wl2_devices_get(input, window_id); + if (devices && devices->touch_dev) + return efl_ref(devices->touch_dev); + + return NULL; +} + static Eo * _ecore_wl2_seat_dev_get(Ecore_Wl2_Input *input, int window_id) { @@ -169,6 +181,8 @@ _ecore_wl2_input_mouse_move_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *windo ev->multi.root.x = input->pointer.sx; ev->multi.root.y = input->pointer.sy; ev->dev = _ecore_wl2_mouse_dev_get(input, window->id); + if (!ev->dev) + ev->dev = _ecore_wl2_touch_dev_get(input, window->id); info = _ecore_wl2_input_mouse_down_info_get(device); if (info) @@ -214,7 +228,15 @@ _ecore_wl2_input_mouse_wheel_send(Ecore_Wl2_Input *input, unsigned int axis, int ev->window = input->focus.pointer->id; ev->event_window = input->focus.pointer->id; } + else if (input->focus.touch) + { + ev->window = input->focus.touch->id; + ev->event_window = input->focus.touch->id; + } + ev->dev = _ecore_wl2_mouse_dev_get(input, ev->window); + if (!ev->dev) + ev->dev = _ecore_wl2_touch_dev_get(input, ev->window); ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _input_event_cb_free, ev->dev); } @@ -305,6 +327,8 @@ _ecore_wl2_input_mouse_down_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *windo ev->window = window->id; ev->event_window = window->id; ev->dev = _ecore_wl2_mouse_dev_get(input, window->id); + if (!ev->dev) + ev->dev = _ecore_wl2_touch_dev_get(input, window->id); } ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, @@ -377,6 +401,8 @@ _ecore_wl2_input_mouse_up_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, ev->window = window->id; ev->event_window = window->id; ev->dev = _ecore_wl2_mouse_dev_get(input, window->id); + if (!ev->dev) + ev->dev = _ecore_wl2_touch_dev_get(input, window->id); ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, _input_event_cb_free, ev->dev);