diff options
author | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-09 14:50:36 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2016-08-09 14:56:39 +0900 |
commit | ac0dd3107567de6da9b6552dc0ca0481a8a4cbd8 (patch) | |
tree | 91041bfb9f892f85e768ac6febe33451f6078759 /src/lib/ecore_input_evas/ecore_input_evas.c | |
parent | d6817f4d6e48ab4a11bfb26bc953ab0d3528c9f4 (diff) |
ecore_input_evas: Enable cancel events by default
After my input event changes, the propagation path has been altered
from:
ecore_x -> evas_event
to:
ecore_x -> ecore_input_evas -> evas_event
But ecore_input_evas was ignoring cancel events by default. There
should be no good reason to disable cancel events anymore,
according to @jypark. Also, this fixes an actual bug :)
Fixes T4301
Diffstat (limited to '')
-rw-r--r-- | src/lib/ecore_input_evas/ecore_input_evas.c | 49 |
1 files changed, 19 insertions, 30 deletions
diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c index 59bfc29cd6..1cef2daa08 100644 --- a/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/src/lib/ecore_input_evas/ecore_input_evas.c | |||
@@ -63,8 +63,6 @@ static Eina_Hash *_window_hash = NULL; | |||
63 | static Eina_List *_last_events = NULL; | 63 | static Eina_List *_last_events = NULL; |
64 | static double _last_events_timeout = 0.5; | 64 | static double _last_events_timeout = 0.5; |
65 | static Eina_Bool _last_events_enable = EINA_FALSE; | 65 | static Eina_Bool _last_events_enable = EINA_FALSE; |
66 | static Eina_Bool _cancel_events_enable = EINA_FALSE; | ||
67 | |||
68 | 66 | ||
69 | static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, | 67 | static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, |
70 | Ecore_Event_Press press, | 68 | Ecore_Event_Press press, |
@@ -490,36 +488,33 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr | |||
490 | //error handle | 488 | //error handle |
491 | // 1. ecore up without ecore down | 489 | // 1. ecore up without ecore down |
492 | // 2. ecore cancel without ecore down | 490 | // 2. ecore cancel without ecore down |
493 | if (_cancel_events_enable) | 491 | if (press != ECORE_DOWN) |
494 | { | 492 | { |
495 | if (press != ECORE_DOWN) | 493 | //ECORE_UP or ECORE_CANCEL |
494 | eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE); | ||
495 | if (!eel) | ||
496 | { | 496 | { |
497 | //ECORE_UP or ECORE_CANCEL | 497 | WRN("ButtonEvent has no history."); |
498 | eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE); | 498 | return ECORE_CALLBACK_PASS_ON; |
499 | if (!eel) | ||
500 | { | ||
501 | WRN("ButtonEvent has no history."); | ||
502 | return ECORE_CALLBACK_PASS_ON; | ||
503 | } | ||
504 | |||
505 | if ((e->window == eel->win) && | ||
506 | ((eel->state == ECORE_INPUT_UP) || | ||
507 | (eel->state == ECORE_INPUT_CANCEL))) | ||
508 | { | ||
509 | WRN("ButtonEvent has wrong history. Last state=%d", eel->state); | ||
510 | return ECORE_CALLBACK_PASS_ON; | ||
511 | } | ||
512 | } | 499 | } |
513 | 500 | ||
514 | if (!faked) | 501 | if ((e->window == eel->win) && |
502 | ((eel->state == ECORE_INPUT_UP) || | ||
503 | (eel->state == ECORE_INPUT_CANCEL))) | ||
515 | { | 504 | { |
516 | Eina_Bool ret = EINA_FALSE; | 505 | WRN("ButtonEvent has wrong history. Last state=%d", eel->state); |
517 | ret = _ecore_event_evas_push_mouse_button(e, press); | 506 | return ECORE_CALLBACK_PASS_ON; |
518 | /* This ButtonEvent is worng */ | ||
519 | if (!ret) return ECORE_CALLBACK_PASS_ON; | ||
520 | } | 507 | } |
521 | } | 508 | } |
522 | 509 | ||
510 | if (!faked) | ||
511 | { | ||
512 | Eina_Bool ret = EINA_FALSE; | ||
513 | ret = _ecore_event_evas_push_mouse_button(e, press); | ||
514 | /* This ButtonEvent is worng */ | ||
515 | if (!ret) return ECORE_CALLBACK_PASS_ON; | ||
516 | } | ||
517 | |||
523 | if (e->multi.device == 0) | 518 | if (e->multi.device == 0) |
524 | { | 519 | { |
525 | ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); | 520 | ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); |
@@ -651,8 +646,6 @@ ecore_event_evas_mouse_button_up(void *data EINA_UNUSED, int type EINA_UNUSED, v | |||
651 | EAPI Eina_Bool | 646 | EAPI Eina_Bool |
652 | ecore_event_evas_mouse_button_cancel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) | 647 | ecore_event_evas_mouse_button_cancel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) |
653 | { | 648 | { |
654 | if (!_cancel_events_enable) return EINA_FALSE; | ||
655 | |||
656 | return _ecore_event_evas_mouse_button_cancel((Ecore_Event_Mouse_Button *)event); | 649 | return _ecore_event_evas_mouse_button_cancel((Ecore_Event_Mouse_Button *)event); |
657 | } | 650 | } |
658 | 651 | ||
@@ -818,10 +811,6 @@ ecore_event_evas_init(void) | |||
818 | if (tmp) | 811 | if (tmp) |
819 | _last_events_timeout = ((double) atoi(tmp)) / 60; | 812 | _last_events_timeout = ((double) atoi(tmp)) / 60; |
820 | } | 813 | } |
821 | if (getenv("ECORE_INPUT_CANCEL")) | ||
822 | { | ||
823 | _cancel_events_enable = EINA_TRUE; | ||
824 | } | ||
825 | 814 | ||
826 | return _ecore_event_evas_init_count; | 815 | return _ecore_event_evas_init_count; |
827 | 816 | ||