From 6f8fd6932b5b0d26933134d5c90ba35bbe9dbd1c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 27 Jan 2020 14:09:28 -0500 Subject: [PATCH] ecore/input: attempt to more accurately handle multi-touch mouse-in events when dealing with touch events, we should attempt to rely more on the hw event stream rather than synthesizing our own events with incorrect data. mouse in/out events don't usually provide device data, so we have no need to emit these events in the case of multi-touch event sequences Differential Revision: https://phab.enlightenment.org/D11205 --- src/lib/ecore_input_evas/ecore_input_evas.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c index bd2f0d1868..3c99dc48ed 100644 --- a/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/src/lib/ecore_input_evas/ecore_input_evas.c @@ -133,7 +133,10 @@ _ecore_event_evas_lookup(Evas_Device *evas_device, unsigned int device, //the number of last event is small, simple check is ok. EINA_LIST_FOREACH(_last_events, l, eel) if ((eel->device == device) && (eel->buttons == buttons) && (eel->evas_device == evas_device)) - return eel; + { + _last_events = eina_list_promote_list(_last_events, l); + return eel; + } if (!create_new) return NULL; eel = malloc(sizeof (Ecore_Event_Last)); if (!eel) return NULL; @@ -147,7 +150,7 @@ _ecore_event_evas_lookup(Evas_Device *evas_device, unsigned int device, eel->win = win; eel->evas_device = evas_device; - _last_events = eina_list_append(_last_events, eel); + _last_events = eina_list_prepend(_last_events, eel); return eel; } @@ -670,6 +673,8 @@ _ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io) { Ecore_Input_Window *lookup; Eo *seat; + Eina_List *l; + Ecore_Event_Last *eel; lookup = _ecore_event_window_match(e->event_window); if (!lookup) return ECORE_CALLBACK_PASS_ON; @@ -696,6 +701,15 @@ _ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io) break; } + /* check whether we have a multi-touch press event here */ + EINA_LIST_FOREACH(_last_events, l, eel) + { + if ((eel->state == ECORE_INPUT_DOWN) && eel->device) + return ECORE_CALLBACK_PASS_ON; + if (eel->state != ECORE_INPUT_DOWN) break; + } + /* a multi-touch event sequence will emit move events normally along with + * accurate device info, so we have no need to do anything here */ lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp); return ECORE_CALLBACK_PASS_ON; }