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 <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-01-17 12:31:01 -05:00
parent 2af4858e2a
commit 2e0dc2a1f9
1 changed files with 26 additions and 0 deletions

View File

@ -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);