diff options
author | Ji-Youn Park <jy0703.park@samsung.com> | 2015-07-29 21:56:15 +0900 |
---|---|---|
committer | Ji-Youn Park <jy0703.park@samsung.com> | 2015-07-29 21:56:15 +0900 |
commit | be2a4342b40f7ec073c39e785c39e4c629762ef4 (patch) | |
tree | 5523344efe027760ef8d80572c28fcf79e625345 /src/lib/ecore_input_evas | |
parent | 56a5ef9d86d7005b294e9fe6e34717916054a121 (diff) |
ecore_evas_input: add value to enable mouse button cancel feature
mike reported this feature break the behavior in E19, but I have trouble to reproduce it.
so I first add value to enable this feature and after that,
Diffstat (limited to 'src/lib/ecore_input_evas')
-rw-r--r-- | src/lib/ecore_input_evas/ecore_input_evas.c | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c b/src/lib/ecore_input_evas/ecore_input_evas.c index d332b4c2e0..bea13cb2ea 100644 --- a/src/lib/ecore_input_evas/ecore_input_evas.c +++ b/src/lib/ecore_input_evas/ecore_input_evas.c | |||
@@ -60,6 +60,8 @@ static Eina_Hash *_window_hash = NULL; | |||
60 | static Eina_List *_last_events = NULL; | 60 | static Eina_List *_last_events = NULL; |
61 | static double _last_events_timeout = 0.5; | 61 | static double _last_events_timeout = 0.5; |
62 | static Eina_Bool _last_events_enable = EINA_FALSE; | 62 | static Eina_Bool _last_events_enable = EINA_FALSE; |
63 | static Eina_Bool _cancel_events_enable = EINA_FALSE; | ||
64 | |||
63 | 65 | ||
64 | static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, | 66 | static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, |
65 | Ecore_Event_Press press, | 67 | Ecore_Event_Press press, |
@@ -458,33 +460,36 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr | |||
458 | //error handle | 460 | //error handle |
459 | // 1. ecore up without ecore down | 461 | // 1. ecore up without ecore down |
460 | // 2. ecore cancel without ecore down | 462 | // 2. ecore cancel without ecore down |
461 | if (press != ECORE_DOWN) | 463 | if (_cancel_events_enable) |
462 | { | 464 | { |
463 | //ECORE_UP or ECORE_CANCEL | 465 | if (press != ECORE_DOWN) |
464 | eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE); | ||
465 | if (!eel) | ||
466 | { | 466 | { |
467 | WRN("ButtonEvent has no history."); | 467 | //ECORE_UP or ECORE_CANCEL |
468 | return ECORE_CALLBACK_PASS_ON; | 468 | eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE); |
469 | if (!eel) | ||
470 | { | ||
471 | WRN("ButtonEvent has no history."); | ||
472 | return ECORE_CALLBACK_PASS_ON; | ||
473 | } | ||
474 | |||
475 | if ((e->window == eel->win) && | ||
476 | ((eel->state == ECORE_INPUT_UP) || | ||
477 | (eel->state == ECORE_INPUT_CANCEL))) | ||
478 | { | ||
479 | WRN("ButtonEvent has wrong history. Last state=%d", eel->state); | ||
480 | return ECORE_CALLBACK_PASS_ON; | ||
481 | } | ||
469 | } | 482 | } |
470 | 483 | ||
471 | if ((e->window == eel->win) && | 484 | if (!faked) |
472 | ((eel->state == ECORE_INPUT_UP) || | ||
473 | (eel->state == ECORE_INPUT_CANCEL))) | ||
474 | { | 485 | { |
475 | WRN("ButtonEvent has wrong history. Last state=%d", eel->state); | 486 | Eina_Bool ret = EINA_FALSE; |
476 | return ECORE_CALLBACK_PASS_ON; | 487 | ret = _ecore_event_evas_push_mouse_button(e, press); |
488 | /* This ButtonEvent is worng */ | ||
489 | if (!ret) return ECORE_CALLBACK_PASS_ON; | ||
477 | } | 490 | } |
478 | } | 491 | } |
479 | 492 | ||
480 | if (!faked) | ||
481 | { | ||
482 | Eina_Bool ret = EINA_FALSE; | ||
483 | ret = _ecore_event_evas_push_mouse_button(e, press); | ||
484 | /* This ButtonEvent is worng */ | ||
485 | if (!ret) return ECORE_CALLBACK_PASS_ON; | ||
486 | } | ||
487 | |||
488 | if (e->multi.device == 0) | 493 | if (e->multi.device == 0) |
489 | { | 494 | { |
490 | ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); | 495 | ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); |
@@ -588,6 +593,8 @@ ecore_event_evas_mouse_button_up(void *data EINA_UNUSED, int type EINA_UNUSED, v | |||
588 | EAPI Eina_Bool | 593 | EAPI Eina_Bool |
589 | ecore_event_evas_mouse_button_cancel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) | 594 | ecore_event_evas_mouse_button_cancel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) |
590 | { | 595 | { |
596 | if (!_cancel_events_enable) return EINA_FALSE; | ||
597 | |||
591 | return _ecore_event_evas_mouse_button_cancel((Ecore_Event_Mouse_Button *)event); | 598 | return _ecore_event_evas_mouse_button_cancel((Ecore_Event_Mouse_Button *)event); |
592 | } | 599 | } |
593 | 600 | ||
@@ -735,6 +742,10 @@ ecore_event_evas_init(void) | |||
735 | if (tmp) | 742 | if (tmp) |
736 | _last_events_timeout = ((double) atoi(tmp)) / 60; | 743 | _last_events_timeout = ((double) atoi(tmp)) / 60; |
737 | } | 744 | } |
745 | if (getenv("ECORE_INPUT_CANCEL")) | ||
746 | { | ||
747 | _cancel_events_enable = EINA_TRUE; | ||
748 | } | ||
738 | 749 | ||
739 | return _ecore_event_evas_init_count; | 750 | return _ecore_event_evas_init_count; |
740 | 751 | ||