forked from enlightenment/efl
ecore-input-evas: fix canvas mouse event dispatch
this was broken in 5cb6cdbc5e
such that
when multiple sources produce mouse events using the same device,
these events are marshalled as though they were from the same canvas.
the result is that eventing is wrong on at least one of the canvases,
and spurious mouse-up events are triggered before every mouse down
fix T2509
This commit is contained in:
parent
e9688e63a5
commit
fbb462371f
|
@ -48,6 +48,7 @@ struct _Ecore_Input_Last
|
||||||
unsigned int device;
|
unsigned int device;
|
||||||
unsigned int buttons;
|
unsigned int buttons;
|
||||||
Ecore_Input_State state;
|
Ecore_Input_State state;
|
||||||
|
Ecore_Window win;
|
||||||
|
|
||||||
Eina_Bool faked : 1;
|
Eina_Bool faked : 1;
|
||||||
};
|
};
|
||||||
|
@ -118,7 +119,7 @@ _ecore_event_last_check(Ecore_Event_Last *eel, Ecore_Event_Press press)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Ecore_Event_Last *
|
static Ecore_Event_Last *
|
||||||
_ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Eina_Bool create_new)
|
_ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Ecore_Window win, Eina_Bool create_new)
|
||||||
{
|
{
|
||||||
Ecore_Event_Last *eel;
|
Ecore_Event_Last *eel;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
@ -137,6 +138,7 @@ _ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Eina_Bool cr
|
||||||
eel->buttons = buttons;
|
eel->buttons = buttons;
|
||||||
eel->state = ECORE_INPUT_NONE;
|
eel->state = ECORE_INPUT_NONE;
|
||||||
eel->faked = EINA_FALSE;
|
eel->faked = EINA_FALSE;
|
||||||
|
eel->win = win;
|
||||||
|
|
||||||
_last_events = eina_list_append(_last_events, eel);
|
_last_events = eina_list_append(_last_events, eel);
|
||||||
return eel;
|
return eel;
|
||||||
|
@ -174,14 +176,15 @@ static Eina_Bool
|
||||||
_ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press)
|
_ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press)
|
||||||
{
|
{
|
||||||
Ecore_Event_Last *eel;
|
Ecore_Event_Last *eel;
|
||||||
Ecore_Input_Action action;
|
Ecore_Input_Action action = ECORE_INPUT_CONTINUE;
|
||||||
|
|
||||||
//_ecore_event_evas_mouse_button already check press or cancel without history
|
//_ecore_event_evas_mouse_button already check press or cancel without history
|
||||||
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, EINA_TRUE);
|
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_TRUE);
|
||||||
if (!eel) return EINA_FALSE;
|
if (!eel) return EINA_FALSE;
|
||||||
INF("dev(%d), button(%d), last_press(%d), press(%d)", e->multi.device, e->buttons, eel->state, press);
|
INF("dev(%d), button(%d), last_press(%d), press(%d)", e->multi.device, e->buttons, eel->state, press);
|
||||||
|
|
||||||
action = _ecore_event_last_check(eel, press);
|
if (e->window == eel->win)
|
||||||
|
action = _ecore_event_last_check(eel, press);
|
||||||
INF("action(%d)", action);
|
INF("action(%d)", action);
|
||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
|
@ -191,6 +194,7 @@ _ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre
|
||||||
break;
|
break;
|
||||||
case ECORE_INPUT_IGNORE:
|
case ECORE_INPUT_IGNORE:
|
||||||
default:
|
default:
|
||||||
|
eel->win = e->window;
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,6 +209,7 @@ _ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
eel->win = e->window;
|
||||||
|
|
||||||
//if up event not occurs from under layers of ecore
|
//if up event not occurs from under layers of ecore
|
||||||
//up event is generated by ecore
|
//up event is generated by ecore
|
||||||
|
@ -456,15 +461,16 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press pr
|
||||||
if (press != ECORE_DOWN)
|
if (press != ECORE_DOWN)
|
||||||
{
|
{
|
||||||
//ECORE_UP or ECORE_CANCEL
|
//ECORE_UP or ECORE_CANCEL
|
||||||
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, EINA_FALSE);
|
eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, EINA_FALSE);
|
||||||
if (!eel)
|
if (!eel)
|
||||||
{
|
{
|
||||||
WRN("ButtonEvent has no history.");
|
WRN("ButtonEvent has no history.");
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((eel->state == ECORE_INPUT_UP) ||
|
if ((e->window == eel->win) &&
|
||||||
(eel->state == ECORE_INPUT_CANCEL))
|
((eel->state == ECORE_INPUT_UP) ||
|
||||||
|
(eel->state == ECORE_INPUT_CANCEL)))
|
||||||
{
|
{
|
||||||
WRN("ButtonEvent has wrong history. Last state=%d", eel->state);
|
WRN("ButtonEvent has wrong history. Last state=%d", eel->state);
|
||||||
return ECORE_CALLBACK_PASS_ON;
|
return ECORE_CALLBACK_PASS_ON;
|
||||||
|
|
Loading…
Reference in New Issue