aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_wl2/ecore_wl2_input.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-06-20 11:59:36 -0400
committerChris Michael <cp.michael@samsung.com>2017-06-20 11:59:36 -0400
commit52f35fde0ce3073d9fcc45aa3343fd8a25bf7909 (patch)
tree04a4bb6734553e424312bcbcae1b161db5689942 /src/lib/ecore_wl2/ecore_wl2_input.c
parentexamples/elm: Use POSIX threads on Windows (diff)
downloadefl-52f35fde0ce3073d9fcc45aa3343fd8a25bf7909.tar.gz
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>
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_input.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index c544a8940c..8eef0158c3 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -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);