ecore-wl2: Fix issue(s) of setting wrong event device

As we may have both a pointer and touch device on a given system, we
need to accurately set event->device when sending mouse move, wheel,
down, and up events. Previous code here would always try to find a
mouse device first which could potentially end up setting the wrong
event->device (if a touch device also existed).

This patch fixes the issue by comparing the window used for the event
to our focused windows (either mouse or touch) and setting the proper
event->device based on that.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2017-06-20 11:59:36 -04:00
parent fb6530ca2e
commit 52f35fde0c
1 changed files with 19 additions and 8 deletions

View File

@ -205,9 +205,11 @@ _ecore_wl2_input_mouse_move_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *windo
ev->multi.y = input->pointer.sy;
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)
if ((input->focus.touch) && (input->focus.touch == window))
ev->dev = _ecore_wl2_touch_dev_get(input, window->id);
else if ((input->focus.pointer) && (input->focus.pointer == window))
ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
info = _ecore_wl2_input_mouse_down_info_get(device);
if (info)
@ -252,16 +254,21 @@ _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;
ev->dev = _ecore_wl2_mouse_dev_get(input, 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_touch_dev_get(input, 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);
{
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);
}
@ -351,9 +358,11 @@ _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)
if ((input->focus.touch) && (input->focus.touch == window))
ev->dev = _ecore_wl2_touch_dev_get(input, window->id);
else if ((input->focus.pointer) && (input->focus.pointer == window))
ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
}
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev,
@ -425,9 +434,11 @@ _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)
if ((input->focus.touch) && (input->focus.touch == window))
ev->dev = _ecore_wl2_touch_dev_get(input, window->id);
else if ((input->focus.pointer) && (input->focus.pointer == window))
ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev,
_input_event_cb_free, ev->dev);