diff options
author | Jiyoun Park <jy0703.park@samsung.com> | 2013-05-05 11:52:33 +0900 |
---|---|---|
committer | Jiyoun Park <jy0703.park@samsung.com> | 2013-05-05 11:52:33 +0900 |
commit | 8f0089e28ffd50a16ad57bd8ef03d661fe661378 (patch) | |
tree | 963fa77be9d5b92793437f382e3d2960982cf33b /src/lib/ecore_input_evas/ecore_input_evas.c | |
parent | 656a2ad45f2bb7a576c8f4f544dbc6d43b4eab7d (diff) |
Ecore_Input_Evas: Fix ecore_input_evas didn't check the device id of
mouse event
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_input_evas/ecore_input_evas.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c index cdbdbee467..2e2bbe0f7c 100644 --- a/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/src/lib/ecore_input_evas/ecore_input_evas.c | |||
@@ -38,6 +38,7 @@ struct _Ecore_Input_Last | |||
38 | Ecore_Event_Mouse_Button *ev; | 38 | Ecore_Event_Mouse_Button *ev; |
39 | Ecore_Timer *timer; | 39 | Ecore_Timer *timer; |
40 | 40 | ||
41 | unsigned int device; | ||
41 | unsigned int buttons; | 42 | unsigned int buttons; |
42 | Ecore_Input_State state; | 43 | Ecore_Input_State state; |
43 | 44 | ||
@@ -57,20 +58,22 @@ static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, | |||
57 | Eina_Bool faked); | 58 | Eina_Bool faked); |
58 | 59 | ||
59 | static Ecore_Event_Last * | 60 | static Ecore_Event_Last * |
60 | _ecore_event_evas_lookup(unsigned int buttons) | 61 | _ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Eina_Bool create_new) |
61 | { | 62 | { |
62 | Ecore_Event_Last *eel; | 63 | Ecore_Event_Last *eel; |
63 | Eina_List *l; | 64 | Eina_List *l; |
64 | 65 | ||
66 | //the number of last event is small, simple check is ok. | ||
65 | EINA_LIST_FOREACH(_last_events, l, eel) | 67 | EINA_LIST_FOREACH(_last_events, l, eel) |
66 | if (eel->buttons == buttons) | 68 | if ((eel->device == device) && (eel->buttons == buttons)) |
67 | return eel; | 69 | return eel; |
68 | 70 | if (!create_new) return NULL; | |
69 | eel = malloc(sizeof (Ecore_Event_Last)); | 71 | eel = malloc(sizeof (Ecore_Event_Last)); |
70 | if (!eel) return NULL; | 72 | if (!eel) return NULL; |
71 | 73 | ||
72 | eel->timer = NULL; | 74 | eel->timer = NULL; |
73 | eel->ev = NULL; | 75 | eel->ev = NULL; |
76 | eel->device = device; | ||
74 | eel->buttons = buttons; | 77 | eel->buttons = buttons; |
75 | eel->state = ECORE_INPUT_NONE; | 78 | eel->state = ECORE_INPUT_NONE; |
76 | eel->faked = EINA_FALSE; | 79 | eel->faked = EINA_FALSE; |
@@ -113,7 +116,7 @@ _ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre | |||
113 | 116 | ||
114 | if (!_last_events_enable) return ; | 117 | if (!_last_events_enable) return ; |
115 | 118 | ||
116 | eel = _ecore_event_evas_lookup(e->buttons); | 119 | eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, EINA_TRUE); |
117 | if (!eel) return ; | 120 | if (!eel) return ; |
118 | 121 | ||
119 | switch (eel->state) | 122 | switch (eel->state) |
@@ -345,9 +348,20 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr | |||
345 | if (!lookup) return ECORE_CALLBACK_PASS_ON; | 348 | if (!lookup) return ECORE_CALLBACK_PASS_ON; |
346 | if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK; | 349 | if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK; |
347 | if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK; | 350 | if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK; |
351 | INF("\tButtonEvent:ecore_event_evas press(%d), device(%d), button(%d), fake(%d)", press, e->multi.device, e->buttons, faked); | ||
352 | if (_last_events_enable) | ||
353 | { | ||
354 | //error handle: if ecore up without ecore down | ||
355 | if ((press == ECORE_UP) && (!_ecore_event_evas_lookup(e->multi.device, e->buttons, EINA_FALSE))) | ||
356 | { | ||
357 | INF("ButtonEvent: up event without down event."); | ||
358 | return ECORE_CALLBACK_PASS_ON; | ||
359 | } | ||
360 | } | ||
361 | |||
362 | if (!faked) _ecore_event_evas_push_mouse_button(e, press); | ||
348 | if (e->multi.device == 0) | 363 | if (e->multi.device == 0) |
349 | { | 364 | { |
350 | if (!faked) _ecore_event_evas_push_mouse_button(e, press); | ||
351 | ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); | 365 | ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); |
352 | if (press == ECORE_DOWN) | 366 | if (press == ECORE_DOWN) |
353 | evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, | 367 | evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, |