summaryrefslogtreecommitdiff
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
parentfb6530ca2ee9d63bef50c985ea91bbf7ba5321c4 (diff)
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
205 ev->multi.y = input->pointer.sy; 205 ev->multi.y = input->pointer.sy;
206 ev->multi.root.x = input->pointer.sx; 206 ev->multi.root.x = input->pointer.sx;
207 ev->multi.root.y = input->pointer.sy; 207 ev->multi.root.y = input->pointer.sy;
208 ev->dev = _ecore_wl2_mouse_dev_get(input, window->id); 208
209 if (!ev->dev) 209 if ((input->focus.touch) && (input->focus.touch == window))
210 ev->dev = _ecore_wl2_touch_dev_get(input, window->id); 210 ev->dev = _ecore_wl2_touch_dev_get(input, window->id);
211 else if ((input->focus.pointer) && (input->focus.pointer == window))
212 ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
211 213
212 info = _ecore_wl2_input_mouse_down_info_get(device); 214 info = _ecore_wl2_input_mouse_down_info_get(device);
213 if (info) 215 if (info)
@@ -252,16 +254,21 @@ _ecore_wl2_input_mouse_wheel_send(Ecore_Wl2_Input *input, unsigned int axis, int
252 { 254 {
253 ev->window = input->focus.pointer->id; 255 ev->window = input->focus.pointer->id;
254 ev->event_window = input->focus.pointer->id; 256 ev->event_window = input->focus.pointer->id;
257 ev->dev = _ecore_wl2_mouse_dev_get(input, input->focus.pointer->id);
255 } 258 }
256 else if (input->focus.touch) 259 else if (input->focus.touch)
257 { 260 {
258 ev->window = input->focus.touch->id; 261 ev->window = input->focus.touch->id;
259 ev->event_window = input->focus.touch->id; 262 ev->event_window = input->focus.touch->id;
263 ev->dev = _ecore_wl2_touch_dev_get(input, input->focus.touch->id);
260 } 264 }
261 265
262 ev->dev = _ecore_wl2_mouse_dev_get(input, ev->window);
263 if (!ev->dev) 266 if (!ev->dev)
264 ev->dev = _ecore_wl2_touch_dev_get(input, ev->window); 267 {
268 ev->dev = _ecore_wl2_mouse_dev_get(input, ev->window);
269 if (!ev->dev)
270 ev->dev = _ecore_wl2_touch_dev_get(input, ev->window);
271 }
265 272
266 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _input_event_cb_free, ev->dev); 273 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, _input_event_cb_free, ev->dev);
267} 274}
@@ -351,9 +358,11 @@ _ecore_wl2_input_mouse_down_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *windo
351 { 358 {
352 ev->window = window->id; 359 ev->window = window->id;
353 ev->event_window = window->id; 360 ev->event_window = window->id;
354 ev->dev = _ecore_wl2_mouse_dev_get(input, window->id); 361
355 if (!ev->dev) 362 if ((input->focus.touch) && (input->focus.touch == window))
356 ev->dev = _ecore_wl2_touch_dev_get(input, window->id); 363 ev->dev = _ecore_wl2_touch_dev_get(input, window->id);
364 else if ((input->focus.pointer) && (input->focus.pointer == window))
365 ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
357 } 366 }
358 367
359 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, 368 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,
425 434
426 ev->window = window->id; 435 ev->window = window->id;
427 ev->event_window = window->id; 436 ev->event_window = window->id;
428 ev->dev = _ecore_wl2_mouse_dev_get(input, window->id); 437
429 if (!ev->dev) 438 if ((input->focus.touch) && (input->focus.touch == window))
430 ev->dev = _ecore_wl2_touch_dev_get(input, window->id); 439 ev->dev = _ecore_wl2_touch_dev_get(input, window->id);
440 else if ((input->focus.pointer) && (input->focus.pointer == window))
441 ev->dev = _ecore_wl2_mouse_dev_get(input, window->id);
431 442
432 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, 443 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev,
433 _input_event_cb_free, ev->dev); 444 _input_event_cb_free, ev->dev);