forked from enlightenment/efl
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,
This commit is contained in:
parent
56a5ef9d86
commit
be2a4342b4
|
@ -60,6 +60,8 @@ static Eina_Hash *_window_hash = NULL;
|
||||||
static Eina_List *_last_events = NULL;
|
static Eina_List *_last_events = NULL;
|
||||||
static double _last_events_timeout = 0.5;
|
static double _last_events_timeout = 0.5;
|
||||||
static Eina_Bool _last_events_enable = EINA_FALSE;
|
static Eina_Bool _last_events_enable = EINA_FALSE;
|
||||||
|
static Eina_Bool _cancel_events_enable = EINA_FALSE;
|
||||||
|
|
||||||
|
|
||||||
static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e,
|
static Eina_Bool _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e,
|
||||||
Ecore_Event_Press press,
|
Ecore_Event_Press press,
|
||||||
|
@ -458,33 +460,36 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
|
||||||
//error handle
|
//error handle
|
||||||
// 1. ecore up without ecore down
|
// 1. ecore up without ecore down
|
||||||
// 2. ecore cancel without ecore down
|
// 2. ecore cancel without ecore down
|
||||||
if (press != ECORE_DOWN)
|
if (_cancel_events_enable)
|
||||||
{
|
{
|
||||||
//ECORE_UP or ECORE_CANCEL
|
if (press != ECORE_DOWN)
|
||||||
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE);
|
|
||||||
if (!eel)
|
|
||||||
{
|
{
|
||||||
WRN("ButtonEvent has no history.");
|
//ECORE_UP or ECORE_CANCEL
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE);
|
||||||
|
if (!eel)
|
||||||
|
{
|
||||||
|
WRN("ButtonEvent has no history.");
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((e->window == eel->win) &&
|
||||||
|
((eel->state == ECORE_INPUT_UP) ||
|
||||||
|
(eel->state == ECORE_INPUT_CANCEL)))
|
||||||
|
{
|
||||||
|
WRN("ButtonEvent has wrong history. Last state=%d", eel->state);
|
||||||
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((e->window == eel->win) &&
|
if (!faked)
|
||||||
((eel->state == ECORE_INPUT_UP) ||
|
|
||||||
(eel->state == ECORE_INPUT_CANCEL)))
|
|
||||||
{
|
{
|
||||||
WRN("ButtonEvent has wrong history. Last state=%d", eel->state);
|
Eina_Bool ret = EINA_FALSE;
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
ret = _ecore_event_evas_push_mouse_button(e, press);
|
||||||
|
/* This ButtonEvent is worng */
|
||||||
|
if (!ret) return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!faked)
|
|
||||||
{
|
|
||||||
Eina_Bool ret = EINA_FALSE;
|
|
||||||
ret = _ecore_event_evas_push_mouse_button(e, press);
|
|
||||||
/* This ButtonEvent is worng */
|
|
||||||
if (!ret) return ECORE_CALLBACK_PASS_ON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e->multi.device == 0)
|
if (e->multi.device == 0)
|
||||||
{
|
{
|
||||||
ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
|
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
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
ecore_event_evas_mouse_button_cancel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
ecore_event_evas_mouse_button_cancel(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||||
{
|
{
|
||||||
|
if (!_cancel_events_enable) return EINA_FALSE;
|
||||||
|
|
||||||
return _ecore_event_evas_mouse_button_cancel((Ecore_Event_Mouse_Button *)event);
|
return _ecore_event_evas_mouse_button_cancel((Ecore_Event_Mouse_Button *)event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,6 +742,10 @@ ecore_event_evas_init(void)
|
||||||
if (tmp)
|
if (tmp)
|
||||||
_last_events_timeout = ((double) atoi(tmp)) / 60;
|
_last_events_timeout = ((double) atoi(tmp)) / 60;
|
||||||
}
|
}
|
||||||
|
if (getenv("ECORE_INPUT_CANCEL"))
|
||||||
|
{
|
||||||
|
_cancel_events_enable = EINA_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
return _ecore_event_evas_init_count;
|
return _ecore_event_evas_init_count;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue