diff options
author | Guilherme Iscaro <iscaro@profusion.mobi> | 2016-12-01 12:29:54 -0200 |
---|---|---|
committer | Bruno Dilly <bdilly@profusion.mobi> | 2016-12-02 09:57:50 -0200 |
commit | 5442e9c908f3a846aab9758cfb905234e8686e53 (patch) | |
tree | 3621f660bb5c059518222c03cce607ee24d33620 /src/lib/ecore_input_evas/ecore_input_evas.c | |
parent | 2ce2a6514899e1c47c4a58f2c5305d62cddf1a7c (diff) |
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.
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_input_evas/ecore_input_evas.c | 12 |
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 | |||
47 | { | 47 | { |
48 | Ecore_Event_Mouse_Button *ev; | 48 | Ecore_Event_Mouse_Button *ev; |
49 | Ecore_Timer *timer; | 49 | Ecore_Timer *timer; |
50 | Evas_Device *evas_device; | ||
50 | 51 | ||
51 | unsigned int device; | 52 | unsigned int device; |
52 | unsigned int buttons; | 53 | unsigned int buttons; |
@@ -122,14 +123,16 @@ _ecore_event_last_check(Ecore_Event_Last *eel, Ecore_Event_Press press) | |||
122 | } | 123 | } |
123 | 124 | ||
124 | static Ecore_Event_Last * | 125 | static Ecore_Event_Last * |
125 | _ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Ecore_Window win, Eina_Bool create_new) | 126 | _ecore_event_evas_lookup(Evas_Device *evas_device, unsigned int device, |
127 | unsigned int buttons, Ecore_Window win, | ||
128 | Eina_Bool create_new) | ||
126 | { | 129 | { |
127 | Ecore_Event_Last *eel; | 130 | Ecore_Event_Last *eel; |
128 | Eina_List *l; | 131 | Eina_List *l; |
129 | 132 | ||
130 | //the number of last event is small, simple check is ok. | 133 | //the number of last event is small, simple check is ok. |
131 | EINA_LIST_FOREACH(_last_events, l, eel) | 134 | EINA_LIST_FOREACH(_last_events, l, eel) |
132 | if ((eel->device == device) && (eel->buttons == buttons)) | 135 | if ((eel->device == device) && (eel->buttons == buttons) && (eel->evas_device == evas_device)) |
133 | return eel; | 136 | return eel; |
134 | if (!create_new) return NULL; | 137 | if (!create_new) return NULL; |
135 | eel = malloc(sizeof (Ecore_Event_Last)); | 138 | eel = malloc(sizeof (Ecore_Event_Last)); |
@@ -142,6 +145,7 @@ _ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Ecore_Window | |||
142 | eel->state = ECORE_INPUT_NONE; | 145 | eel->state = ECORE_INPUT_NONE; |
143 | eel->faked = EINA_FALSE; | 146 | eel->faked = EINA_FALSE; |
144 | eel->win = win; | 147 | eel->win = win; |
148 | eel->evas_device = evas_device; | ||
145 | 149 | ||
146 | _last_events = eina_list_append(_last_events, eel); | 150 | _last_events = eina_list_append(_last_events, eel); |
147 | return eel; | 151 | return eel; |
@@ -182,7 +186,7 @@ _ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre | |||
182 | Ecore_Input_Action action = ECORE_INPUT_CONTINUE; | 186 | Ecore_Input_Action action = ECORE_INPUT_CONTINUE; |
183 | 187 | ||
184 | //_ecore_event_evas_mouse_button already check press or cancel without history | 188 | //_ecore_event_evas_mouse_button already check press or cancel without history |
185 | eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_TRUE); | 189 | eel = _ecore_event_evas_lookup(e->dev, e->multi.device, e->buttons, e->window, EINA_TRUE); |
186 | if (!eel) return EINA_FALSE; | 190 | if (!eel) return EINA_FALSE; |
187 | INF("dev(%d), button(%d), last_press(%d), press(%d)", e->multi.device, e->buttons, eel->state, press); | 191 | INF("dev(%d), button(%d), last_press(%d), press(%d)", e->multi.device, e->buttons, eel->state, press); |
188 | 192 | ||
@@ -491,7 +495,7 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr | |||
491 | if (press != ECORE_DOWN) | 495 | if (press != ECORE_DOWN) |
492 | { | 496 | { |
493 | //ECORE_UP or ECORE_CANCEL | 497 | //ECORE_UP or ECORE_CANCEL |
494 | eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE); | 498 | eel = _ecore_event_evas_lookup(e->dev, e->multi.device, e->buttons, e->window, EINA_FALSE); |
495 | if (!eel) | 499 | if (!eel) |
496 | { | 500 | { |
497 | WRN("ButtonEvent has no history."); | 501 | WRN("ButtonEvent has no history."); |