aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_wl2/ecore_wl2_input.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-01-17 12:31:01 -0500
committerChris Michael <cp.michael@samsung.com>2017-01-17 12:31:01 -0500
commit2e0dc2a1f94edc40fc0c1ba938bb92d3c3a4d43f (patch)
treeb3b7a109c293a3e91955e5e29da2b527a4ebc69c /src/lib/ecore_wl2/ecore_wl2_input.c
parentelput: Return touch coordinates when we have no pointer (diff)
downloadefl-2e0dc2a1f94edc40fc0c1ba938bb92d3c3a4d43f.tar.gz
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 https://phab.enlightenment.org/T5094 Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_input.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c26
1 files changed, 26 insertions, 0 deletions
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
@@ -84,6 +84,18 @@ _ecore_wl2_mouse_dev_get(Ecore_Wl2_Input *input, int window_id)
}
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)
{
Ecore_Wl2_Input_Devices *devices;
@@ -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);