From bf1ae24e7cc854c1bc13f724ef1603e2a0b9a25d Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 12 Mar 2020 12:51:30 +0900 Subject: [PATCH] Handle key event cancel flag Change-Id: I9e8af6737f90a47245ad727110d009095a7b01d3 Signed-off-by: Jihoon Kim --- ism/extras/wayland_immodule/wayland_imcontext.c | 42 +++++++++++++++---------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index e14f4f3..8e36a59 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -807,18 +807,23 @@ static Eina_Bool key_down_filter_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_Event_Key *ev = (Ecore_Event_Key *)event; - if (!ev || !ev->keyname) return EINA_TRUE; /* the event is kept */ + if (!ev || !ev->keyname) return ECORE_CALLBACK_PASS_ON; /* the event is kept */ Ecore_IMF_Context *active_ctx = get_using_ctx (); - if (!active_ctx) return EINA_TRUE; /* the event is kept */ + if (!active_ctx) return ECORE_CALLBACK_PASS_ON; /* the event is kept */ - if (check_nograb_backkey()) return EINA_TRUE; /* the event is kept */ + if (check_nograb_backkey()) return ECORE_CALLBACK_PASS_ON; /* the event is kept */ if ((_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_SHOW || _input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_WILL_SHOW) && check_hide_key(ev->keyname)) { + if (ev->event_flags & ECORE_EVENT_FLAG_CANCEL) { + SECURE_LOGD ("%s key is cancelled.", ev->keyname); + return ECORE_CALLBACK_PASS_ON; + } + SECURE_LOGD ("%s key is pressed.", ev->keyname); Ecore_IMF_Event_Key_Down imf_event; @@ -832,26 +837,31 @@ key_down_filter_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) LOGD("no focus"); SECURE_LOGD ("%s key is pressed. ret : %d", ev->keyname, filter_ret); - return EINA_FALSE; /* the event is removed from the queue */ + return ECORE_CALLBACK_DONE; /* the event is removed from the queue */ } - return EINA_TRUE; /* the event is kept */ + return ECORE_CALLBACK_PASS_ON; /* the event is kept */ } static Eina_Bool key_up_filter_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_Event_Key *ev = (Ecore_Event_Key *)event; - if (!ev || !ev->keyname) return EINA_TRUE; /* the event is kept */ + if (!ev || !ev->keyname) return ECORE_CALLBACK_PASS_ON; /* the event is kept */ Ecore_IMF_Context *active_ctx = get_using_ctx (); - if (!active_ctx) return EINA_TRUE; /* the event is kept */ + if (!active_ctx) return ECORE_CALLBACK_PASS_ON; /* the event is kept */ - if (check_nograb_backkey()) return EINA_TRUE; /* the event is kept */ + if (check_nograb_backkey()) return ECORE_CALLBACK_PASS_ON; /* the event is kept */ if (_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_HIDE || !check_hide_key(ev->keyname)) - return EINA_TRUE; /* the event is kept */ + return ECORE_CALLBACK_PASS_ON; /* the event is kept */ + + if (ev->event_flags & ECORE_EVENT_FLAG_CANCEL) { + SECURE_LOGD ("%s key is cancelled.", ev->keyname); + return ECORE_CALLBACK_PASS_ON; + } SECURE_LOGD ("%s key is released.", ev->keyname); @@ -867,12 +877,12 @@ key_up_filter_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) SECURE_LOGD ("%s key is released. ret : %d", ev->keyname, filter_ret); if (filter_ret) { - return EINA_FALSE; /* the event is removed from the queue */ + return ECORE_CALLBACK_DONE; /* the event is removed from the queue */ } else { ecore_imf_context_reset(active_ctx); _input_panel_hide(active_ctx, EINA_TRUE); - return EINA_FALSE; /* the event is removed from the queue */ + return ECORE_CALLBACK_DONE; /* the event is removed from the queue */ } } @@ -880,7 +890,7 @@ static Eina_Bool rotary_event_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) { Ecore_Event_Detent_Rotate *ev = event; - if (!ev) return EINA_TRUE; + if (!ev) return ECORE_CALLBACK_PASS_ON; Ecore_IMF_Context *active_ctx = NULL; if (_show_req_ctx) @@ -888,10 +898,10 @@ rotary_event_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) else if (_focused_ctx) active_ctx = _focused_ctx; - if (!active_ctx) return EINA_TRUE; + if (!active_ctx) return ECORE_CALLBACK_PASS_ON; if (_input_panel_state == ECORE_IMF_INPUT_PANEL_STATE_HIDE) - return EINA_TRUE; + return ECORE_CALLBACK_PASS_ON; ecore_imf_context_reset(active_ctx); WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(active_ctx); @@ -908,7 +918,7 @@ rotary_event_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) if (buffer) free(buffer); } - return EINA_FALSE; + return ECORE_CALLBACK_DONE; } static Eina_Bool @@ -925,7 +935,7 @@ _ecore_event_filter_cb(void *data, void *loop_data EINA_UNUSED, int type, void * return rotary_event_cb(data, type, event); } - return EINA_TRUE; + return ECORE_CALLBACK_PASS_ON; } static void -- 2.7.4