From ae698736de626004fd26e4a82b5fe6d9a27e5a49 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Mon, 22 Jan 2018 20:31:30 +0900 Subject: [PATCH] Register EVAS_CALLBACK_CANVAS_FOCUS_IN when set_focus fails Change-Id: I592ce087d3fd6beb6975feb3a02a2c77741cf018 --- ism/extras/wayland_immodule/wayland_imcontext.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index 35bbbbb..fd34f82 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -117,6 +117,7 @@ static Ecore_IMF_Context *_show_req_ctx = NULL; static Ecore_IMF_Context *_hide_req_ctx = NULL; static Ecore_IMF_Context *_focus_req_ctx = NULL; static Ecore_IMF_Context *_input_panel_ctx = NULL; +static Eina_Bool _focus_req_only = EINA_TRUE; static Eina_Rectangle _keyboard_geometry = {0, 0, 0, 0}; @@ -1581,16 +1582,19 @@ get_purpose(Ecore_IMF_Context *ctx) static void _canvas_focus_in_cb(void *data, Evas *e, void *event_info) { - LOGD("ctx : %p", _focus_req_ctx); + LOGD("ctx : %p %d", _focus_req_ctx, _focus_req_only); if (_focus_req_ctx) { set_focus(_focus_req_ctx); - show_input_panel(_focus_req_ctx); + if (ecore_imf_context_input_panel_enabled_get (_focus_req_ctx) || !_focus_req_only) + if (!ecore_imf_context_input_panel_show_on_demand_get (_focus_req_ctx) || !_focus_req_only) + show_input_panel (_focus_req_ctx); WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(_focus_req_ctx); if (imcontext && imcontext->canvas) evas_event_callback_del(imcontext->canvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb); _focus_req_ctx = NULL; + _focus_req_only = EINA_TRUE; } } @@ -1609,6 +1613,7 @@ show_input_panel(Ecore_IMF_Context *ctx) set_focus(ctx); if (!imcontext->input) { _focus_req_ctx = ctx; + _focus_req_only = EINA_FALSE; if (imcontext->canvas) { evas_event_callback_del(imcontext->canvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb); evas_event_callback_add(imcontext->canvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL); @@ -2705,6 +2710,7 @@ wayland_im_context_del (Ecore_IMF_Context *ctx) evas_event_callback_del(imcontext->canvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb); _focus_req_ctx = NULL; + _focus_req_only = EINA_TRUE; } // @@ -2799,6 +2805,16 @@ wayland_im_context_focus_in(Ecore_IMF_Context *ctx) #endif if (!set_focus(ctx)) { + WaylandIMContext *imcontext = (WaylandIMContext *)ecore_imf_context_data_get(ctx); + if (imcontext && !imcontext->input) { + if (_focus_req_ctx != ctx) + _focus_req_only = EINA_TRUE; + _focus_req_ctx = ctx; + if (imcontext->canvas) { + evas_event_callback_del(imcontext->canvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb); + evas_event_callback_add(imcontext->canvas, EVAS_CALLBACK_CANVAS_FOCUS_IN, _canvas_focus_in_cb, NULL); + } + } LOGW("ctx : %p. Fail to set focus!", ctx); return; } @@ -2846,8 +2862,10 @@ wayland_im_context_focus_out(Ecore_IMF_Context *ctx) LOGD("ctx : %p", ctx); - if (_focus_req_ctx == ctx) + if (_focus_req_ctx == ctx) { _focus_req_ctx = NULL; + _focus_req_only = EINA_TRUE; + } if (!imcontext || !imcontext->input) return; -- 2.7.4