From ff91d2eb8df49f183a350280fa47f110e55e0e4a Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 27 Jun 2017 17:36:26 +0900 Subject: [PATCH] Modified to call the preedit changed callback when the preedit cursor is changed If ISE calls update_preedit_caret() after updating preedit_string, the preedit changed callback could not be called. In this case, the application doesn't know the change of preedit cursor. Change-Id: Ia2f96cc4134135baac8887e0bdade331bd9f756e --- ism/extras/wayland_immodule/wayland_imcontext.c | 8 ++++++++ .../panelagent/wayland/wayland_panel_agent_module.cpp | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/ism/extras/wayland_immodule/wayland_imcontext.c b/ism/extras/wayland_immodule/wayland_imcontext.c index ca59644d..db2f461b 100644 --- a/ism/extras/wayland_immodule/wayland_imcontext.c +++ b/ism/extras/wayland_immodule/wayland_imcontext.c @@ -117,6 +117,7 @@ static double space_key_time = 0.0; static Eina_Bool autoperiod_allow = EINA_FALSE; static Eina_Bool autocap_allow = EINA_FALSE; static Eina_Bool hw_keyboard_mode = EINA_FALSE; +static Eina_Bool _preedit_cursor_changed = EINA_FALSE; static Input_Language input_lang = INPUT_LANG_OTHER; static Evas_Coord g_scr_w = 0, g_scr_h = 0; @@ -1299,6 +1300,7 @@ set_focus_out(Ecore_IMF_Context *ctx) _focused_ctx = NULL; imcontext->input = NULL; + _preedit_cursor_changed = EINA_FALSE; } // TIZEN_ONLY(20160217): ignore the duplicate show request @@ -1739,6 +1741,11 @@ text_input_preedit_string(void *data, else preedit_changed = (strlen(text) != 0); + if (_preedit_cursor_changed) { + preedit_changed = EINA_TRUE; + _preedit_cursor_changed = EINA_FALSE; + } + clear_preedit(imcontext); imcontext->preedit_text = strdup(text); @@ -1841,6 +1848,7 @@ text_input_preedit_cursor(void *data, WaylandIMContext *imcontext = (WaylandIMContext *)data; imcontext->pending_preedit.cursor = index; + _preedit_cursor_changed = EINA_TRUE; } static xkb_mod_index_t diff --git a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp index 015d3231..83acbe59 100644 --- a/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp +++ b/ism/modules/panelagent/wayland/wayland_panel_agent_module.cpp @@ -1948,6 +1948,10 @@ wsc_send_preedit (WSCContextISF* wsc_ctx, int32_t cursor) if (cursor > 0) index = cursor; + /* Note : Since the current wayland_immodule implementation does not call + * PREEDIT_CHANGED callback even when preedit_cursor gets updated, for now + * we must update preedit_string also whenever preedit_cursor is updated. + * So the below 2 lines cannot be called separately. */ wl_input_method_context_preedit_cursor (wsc_ctx->im_ctx, index); wl_input_method_context_preedit_string (wsc_ctx->im_ctx, wsc_ctx->serial, @@ -2487,6 +2491,7 @@ panel_slot_update_preedit_caret (int context, int caret) if (check_valid_ic (ic)) ic->impl->preedit_started = true; } + wsc_send_preedit (ic, caret); } else { g_info_manager->socket_update_preedit_caret (caret); } -- 2.34.1