win: Do not forward all key events on win (legacy)

OMG... I do not like this patch.

See T6148, two key down events are received when a key grab is installed
on a Win object. This is because all input events are propagated from
ecore all the way up to win and can be listened on. Unfortunately this
breaks existing applications that use the key grab API properly to
listen to key events.

Another side effect is that ALL key events are received by the window,
which means it's not limited to what the application expected (from its
list of grabs).

Solution (ugly): block propagation of key down/up events if the window
is a legacy window. This means that no key grab is required for EO
windows, but key grabs are still required for legacy windows.

Fixes T6148

@fix
This commit is contained in:
Jean-Philippe Andre 2017-10-18 20:56:26 +09:00
parent 80a5297ae4
commit dfd98b3e48
1 changed files with 8 additions and 0 deletions

View File

@ -1935,12 +1935,16 @@ _win_event_add_cb(void *data, const Efl_Event *ev)
}
else if (array[i].desc == EFL_EVENT_KEY_DOWN)
{
// Legacy API: Must grab key
if (elm_widget_is_legacy(win)) return;
if (!(sd->event_forward.key_down++))
efl_event_callback_add(sd->evas, array[i].desc,
_evas_event_key_cb, win);
}
else if (array[i].desc == EFL_EVENT_KEY_UP)
{
// Legacy API: Must grab key
if (elm_widget_is_legacy(win)) return;
if (!(sd->event_forward.key_up++))
efl_event_callback_add(sd->evas, array[i].desc,
_evas_event_key_cb, win);
@ -2062,12 +2066,16 @@ _win_event_del_cb(void *data, const Efl_Event *ev)
}
else if (array[i].desc == EFL_EVENT_KEY_DOWN)
{
// Legacy API: Must grab key
if (elm_widget_is_legacy(win)) return;
if (!(--sd->event_forward.key_down))
efl_event_callback_del(sd->evas, array[i].desc,
_evas_event_key_cb, win);
}
else if (array[i].desc == EFL_EVENT_KEY_UP)
{
// Legacy API: Must grab key
if (elm_widget_is_legacy(win)) return;
if (!(--sd->event_forward.key_up))
efl_event_callback_del(sd->evas, array[i].desc,
_evas_event_key_cb, win);