summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Iscaro <iscaro@profusion.mobi>2016-12-01 12:29:54 -0200
committerGuilherme Iscaro <iscaro@profusion.mobi>2016-12-01 17:45:37 -0200
commit5ded9223315f067f2e209f250f9de4b3aab8c3a6 (patch)
treedd770dde8cdb87fc93350f519fd5cd0ca38461e7
parent2500a2d03e8a846e6137c392b9ac5ebce227b3cf (diff)
downloadefl-5ded9223315f067f2e209f250f9de4b3aab8c3a6.tar.gz
Ecore Input Evas: Ecore_Input_Last should contain the Evas device.
This struct should contain the Evas device that originated the event, otherwise events from different devices may mix up and lead to undifined behaviour.
-rw-r--r--src/lib/ecore_input_evas/ecore_input_evas.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c
index 1cef2daa08..6e37cc6d12 100644
--- a/src/lib/ecore_input_evas/ecore_input_evas.c
+++ b/src/lib/ecore_input_evas/ecore_input_evas.c
@@ -47,6 +47,7 @@ struct _Ecore_Input_Last
{
Ecore_Event_Mouse_Button *ev;
Ecore_Timer *timer;
+ Evas_Device *evas_device;
unsigned int device;
unsigned int buttons;
@@ -122,14 +123,16 @@ _ecore_event_last_check(Ecore_Event_Last *eel, Ecore_Event_Press press)
}
static Ecore_Event_Last *
-_ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Ecore_Window win, Eina_Bool create_new)
+_ecore_event_evas_lookup(Evas_Device *evas_device, unsigned int device,
+ unsigned int buttons, Ecore_Window win,
+ Eina_Bool create_new)
{
Ecore_Event_Last *eel;
Eina_List *l;
//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))
+ if ((eel->device == device) && (eel->buttons == buttons) && (eel->evas_device == evas_device))
return eel;
if (!create_new) return NULL;
eel = malloc(sizeof (Ecore_Event_Last));
@@ -142,6 +145,7 @@ _ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Ecore_Window
eel->state = ECORE_INPUT_NONE;
eel->faked = EINA_FALSE;
eel->win = win;
+ eel->evas_device = evas_device;
_last_events = eina_list_append(_last_events, eel);
return eel;
@@ -182,7 +186,7 @@ _ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre
Ecore_Input_Action action = ECORE_INPUT_CONTINUE;
//_ecore_event_evas_mouse_button already check press or cancel without history
- eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_TRUE);
+ eel = _ecore_event_evas_lookup(e->dev, e->multi.device, e->buttons, e->window, EINA_TRUE);
if (!eel) return EINA_FALSE;
INF("dev(%d), button(%d), last_press(%d), press(%d)", e->multi.device, e->buttons, eel->state, press);
@@ -491,7 +495,7 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
if (press != ECORE_DOWN)
{
//ECORE_UP or ECORE_CANCEL
- eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE);
+ eel = _ecore_event_evas_lookup(e->dev, e->multi.device, e->buttons, e->window, EINA_FALSE);
if (!eel)
{
WRN("ButtonEvent has no history.");