From dfd98b3e48a02c35fbbe14b709cbe72e65ea9500 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 18 Oct 2017 20:56:26 +0900 Subject: [PATCH] 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 --- src/lib/elementary/efl_ui_win.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 17819923bb..111032a73c 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -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);