From 1a6eb52a2c199b0092a2b5e586fd54eb50f4bce5 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 7 Mar 2017 11:14:26 +0900 Subject: [PATCH 01/16] Allow previous input context to hide input panel Since there are cases an application that manually calls input_panel_show() / hide() without considering system's input panel policy, sometimes they are requesting to hide input panel on input context that did not explicitly requested to show in the past. For now this patch will fix the issues above, but will be reverted in the future since this patch will break the policy that "ONLY the context that requested to show input panel, can hide input panel". Change-Id: I903213eebe78d0211113173651412fa15c7e62f7 --- src/e_mod_main.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 089118b..a8a5ca5 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -105,6 +105,7 @@ static Ecore_Timer *g_timer_will_hide = NULL; static enum _E_Input_Panel_State g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE; static E_Client *client_surface_ec = NULL; static E_Text_Input *g_show_text_input = NULL; +static E_Text_Input *g_old_text_input = NULL; static Eina_List *hooks_ec = NULL; @@ -1123,7 +1124,13 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource return; if (old) - _e_text_input_deactivate(old, input_method, EINA_TRUE); + { + _e_text_input_deactivate(old, input_method, EINA_TRUE); + if (g_input_panel_state == E_INPUT_PANEL_STATE_DID_SHOW || g_input_panel_state == E_INPUT_PANEL_STATE_WILL_SHOW) + { + g_old_text_input = old; + } + } if (!_e_text_input_method_create_context(client, input_method, text_input, EINA_TRUE)) return; @@ -1175,6 +1182,11 @@ _e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_reso g_client = NULL; } + if (text_input == g_old_text_input) + { + g_old_text_input = NULL; + } + /* FIXME: should get input_method object from seat. */ if (g_input_method && g_input_method->resource) input_method = wl_resource_get_user_data(g_input_method->resource); @@ -1304,11 +1316,20 @@ static void _e_text_input_cb_input_panel_hide(struct wl_client *client, struct wl_resource *resource) { E_Text_Input *text_input = wl_resource_get_user_data(resource); + Eina_Bool hide_allowed = EINA_FALSE; + + if (!g_text_input || (text_input && g_show_text_input == text_input)) + hide_allowed = EINA_TRUE; + + if (g_old_text_input && text_input == g_old_text_input && g_client == client) + hide_allowed = EINA_TRUE; - if (!g_text_input || (text_input && g_show_text_input == text_input)) { - _input_panel_hide(client, resource, EINA_FALSE); - g_show_text_input = NULL; - } + if (hide_allowed) + { + _input_panel_hide(client, resource, EINA_FALSE); + g_show_text_input = NULL; + g_old_text_input = NULL; + } } static void -- 2.7.4 From 2f082a4db66ea18d7f5dfe869d73956e71150f6a Mon Sep 17 00:00:00 2001 From: InHong Han Date: Tue, 7 Mar 2017 18:58:38 +0900 Subject: [PATCH 02/16] Modified to compare show_req_ctx with text_input when calling the input_panel_hide() Change-Id: Ibe4f7246e960beaec1eedfad677f6acd40b986b0 --- src/e_mod_main.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index a8a5ca5..113aa77 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1740,24 +1740,20 @@ _e_text_input_cb_resource_destroy(struct wl_resource *resource) return; } - if (g_text_input == text_input) + if (g_show_text_input == text_input) { if (text_input->input_panel_visibile) { - if (g_client) - _input_panel_hide(g_client, resource, EINA_TRUE); + _input_panel_hide(g_client, resource, EINA_TRUE); } - g_text_input = NULL; - g_client = NULL; + g_show_text_input = NULL; } - if (text_input == g_show_text_input) - g_show_text_input = NULL; - - if (g_text_input == NULL && text_input->input_panel_visibile) + if (g_text_input == text_input) { - _input_panel_hide(NULL, resource, EINA_TRUE); + g_text_input = NULL; + g_client = NULL; } EINA_LIST_FREE(text_input->input_methods, input_method) -- 2.7.4 From cce2770df970a937e822472c6a8be0087583e893 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 7 Mar 2017 19:10:18 +0900 Subject: [PATCH 03/16] Update package version to 0.1.95 Change-Id: Ib05c8b77c50e135595f1cd59aa130119c917ab76 --- packaging/e-mod-tizen-wl-textinput.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-mod-tizen-wl-textinput.spec b/packaging/e-mod-tizen-wl-textinput.spec index c1a2c31..6f331ce 100644 --- a/packaging/e-mod-tizen-wl-textinput.spec +++ b/packaging/e-mod-tizen-wl-textinput.spec @@ -1,7 +1,7 @@ %bcond_with wayland Name: e-mod-tizen-wl-textinput Summary: The Enlightenment WM Wayland Text Input Module for Tizen -Version: 0.1.94 +Version: 0.1.95 Release: 1 Group: Graphics & UI Framework/Other License: BSD-2-Clause and MIT -- 2.7.4 From 81015c607878b4f98e6f33625a6986d22687ef46 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 8 Mar 2017 17:51:53 +0900 Subject: [PATCH 04/16] Revert "Support key input in case of no focus" This reverts commit 8090905046e3ef201a5c00029fdece9ddff7d10d. Change-Id: I7dc2c5112dcf92018fcef25499c2e40e970d1163 --- src/e_mod_main.c | 108 +++++++++++++++++++++++++------------------------------ 1 file changed, 48 insertions(+), 60 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 113aa77..6f4cd8a 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -92,7 +92,6 @@ enum _E_Input_Panel_State static E_Input_Method *g_input_method = NULL; static E_Text_Input *g_text_input = NULL; static struct wl_client *g_client = NULL; -static struct wl_client *g_focused_client = NULL; static Eina_List *shutdown_list = NULL; static Eina_Bool g_disable_show_panel = EINA_FALSE; static Eeze_Udev_Watch *eeze_udev_watch_hander = NULL; @@ -242,7 +241,7 @@ _input_panel_hide(struct wl_client *client, struct wl_resource *resource, Eina_B Because input_panel_hide event can be called after focus_out(deactivate) by application. And Input Method(IME) should know the state of their own input_panel to manage their resource when the input_panel is hidden. */ - if (input_method && + if (input_method && ((!input_method->context) || (!input_method->context->resource))) _context_created = _e_text_input_method_create_context(client, input_method, text_input, EINA_FALSE); @@ -638,32 +637,9 @@ _e_text_input_method_context_cb_keysym(struct wl_client *client EINA_UNUSED, str return; } - struct wl_resource *text_input_resource = NULL; - Eina_Bool resource_created = EINA_FALSE; - if ((context->input) && (context->input->resource)) - text_input_resource = context->input->resource; - - if (!text_input_resource) - { - LOGD("Create text input resource...\n"); - if (g_focused_client) - { - text_input_resource = wl_resource_create(g_focused_client, &wl_text_input_interface, 1, 0); - - if (text_input_resource) - resource_created = EINA_TRUE; - } - } - - if (text_input_resource) - { - wl_text_input_send_keysym(text_input_resource, - serial, time, sym, state, modifiers); - - if (resource_created) - wl_resource_destroy(text_input_resource); - } + wl_text_input_send_keysym(context->input->resource, + serial, time, sym, state, modifiers); } #if ENABLE_GRAB_KEYBOARD @@ -1056,8 +1032,6 @@ _e_mod_ecore_key_down_cb(void *data, int type, void *event) static void _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method, Eina_Bool need_focus_in) { - LOGD("text_input : %p, input_method : %p\n", text_input, input_method); - if (text_input == g_text_input) { g_text_input = NULL; @@ -1084,6 +1058,12 @@ _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method, ecore_key_down_handler = NULL; } + input_method->input = NULL; + if (input_method->context) input_method->context->input = NULL; + input_method->context = NULL; + + text_input->input_methods = eina_list_remove(text_input->input_methods, input_method); + if (text_input->resource) wl_text_input_send_leave(text_input->resource); @@ -1099,6 +1079,7 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource E_Text_Input *text_input = NULL; E_Input_Method *input_method = NULL; E_Text_Input *old = NULL; + E_Input_Method_Context *context = NULL; EINA_SAFETY_ON_NULL_GOTO(resource, err); EINA_SAFETY_ON_NULL_GOTO(seat, err); @@ -1111,14 +1092,14 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource EINA_SAFETY_ON_TRUE_GOTO(e_object_is_del(E_OBJECT(ec)), err); client_surface_ec = ec; + text_input = wl_resource_get_user_data(resource); + g_text_input = text_input; + g_client = client; + /* FIXME: should get input_method object from seat. */ input_method = wl_resource_get_user_data(g_input_method->resource); - LOGD("resource : %p, inputmethod : %p\n", g_input_method->resource, input_method); EINA_SAFETY_ON_NULL_GOTO(input_method, err); - text_input = wl_resource_get_user_data(resource); - LOGD("client : %p, text_input : %p, input_method : %p\n", client, text_input, input_method); - old = input_method->input; if (old == text_input) return; @@ -1132,15 +1113,41 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource } } - if (!_e_text_input_method_create_context(client, input_method, text_input, EINA_TRUE)) - return; + input_method->input = text_input; + text_input->input_methods = eina_list_append(text_input->input_methods, input_method); + + if (input_method->resource) + { + if (!(context = E_NEW(E_Input_Method_Context, 1))) + { + wl_client_post_no_memory(client); + ERR("Could not allocate space for Input_Method_Context"); + return; + } + + if (!ecore_key_down_handler) + ecore_key_down_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + _e_mod_ecore_key_down_cb, + NULL); + + context->resource = + wl_resource_create(wl_resource_get_client(input_method->resource), + &wl_input_method_context_interface, 1, 0); + - g_focused_client = client; + if (context->resource) + wl_resource_set_implementation(context->resource, + &_e_text_input_method_context_implementation, + context, _e_text_input_method_context_cb_resource_destroy); + + context->input = text_input; + context->input_method = input_method; + input_method->context = context; + + if (context->resource) + wl_input_method_send_activate(input_method->resource, context->resource, text_input->id, EINA_TRUE); + } - if (!ecore_key_down_handler) - ecore_key_down_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, - _e_mod_ecore_key_down_cb, - NULL); #ifdef _TV set_soft_keyboard_mode(); #endif @@ -1214,9 +1221,7 @@ _e_text_input_method_create_context(struct wl_client *client, E_Input_Method *in g_text_input = text_input; g_client = client; input_method->input = text_input; - - if (!text_input->input_methods) - text_input->input_methods = eina_list_append(text_input->input_methods, input_method); + text_input->input_methods = eina_list_append(text_input->input_methods, input_method); if (!(context = E_NEW(E_Input_Method_Context, 1))) { @@ -1730,8 +1735,6 @@ _e_text_input_cb_resource_destroy(struct wl_resource *resource) E_Text_Input *text_input = wl_resource_get_user_data(resource); E_Input_Method *input_method = NULL; - LOGD("text input : %p\n", text_input); - if (!text_input) { WTI_WARNING(resource, @@ -1758,16 +1761,7 @@ _e_text_input_cb_resource_destroy(struct wl_resource *resource) EINA_LIST_FREE(text_input->input_methods, input_method) { - LOGD("destroy input method : %p\n", input_method); _e_text_input_deactivate(text_input, input_method, EINA_TRUE); - - if (input_method->input == text_input) - { - input_method->input = NULL; - if (input_method->context) input_method->context->input = NULL; - input_method->context = NULL; - text_input->input_methods = eina_list_remove(text_input->input_methods, input_method); - } } free(text_input); @@ -1776,12 +1770,6 @@ _e_text_input_cb_resource_destroy(struct wl_resource *resource) static void _e_text_input_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource) { - E_Text_Input *text_input = wl_resource_get_user_data(resource); - LOGD("client : %p, text input : %p\n", client, text_input); - - if (g_focused_client == client) - g_focused_client = NULL; - wl_resource_destroy(resource); } -- 2.7.4 From 4357f76277062a496f0afcc8bfb7c88e40577e4d Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 8 Mar 2017 21:50:03 +0900 Subject: [PATCH 05/16] Support backspace key in case of no focus In multibutton entry widget in EFL, this feature is necessary. Change-Id: I3320aec5847ffa92dff22b8573a82a8de4cb2680 Signed-off-by: Jihoon Kim --- src/e_mod_main.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 6f4cd8a..c34401b 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -241,7 +241,7 @@ _input_panel_hide(struct wl_client *client, struct wl_resource *resource, Eina_B Because input_panel_hide event can be called after focus_out(deactivate) by application. And Input Method(IME) should know the state of their own input_panel to manage their resource when the input_panel is hidden. */ - if (input_method && + if (input_method && ((!input_method->context) || (!input_method->context->resource))) _context_created = _e_text_input_method_create_context(client, input_method, text_input, EINA_FALSE); @@ -625,6 +625,26 @@ _e_text_input_method_context_cb_modifiers_map(struct wl_client *client EINA_UNUS } static void +_e_keyevent_free(void *data EINA_UNUSED, void *ev) +{ + Ecore_Event_Key *e = ev; + + if (e->keyname) + eina_stringshare_del(e->keyname); + + if (e->key) + eina_stringshare_del(e->key); + + if (e->compose) + eina_stringshare_del(e->compose); + + if (e->string) + eina_stringshare_del(e->string); + + E_FREE(e); +} + +static void _e_text_input_method_context_cb_keysym(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) { E_Input_Method_Context *context = wl_resource_get_user_data(resource); @@ -638,8 +658,46 @@ _e_text_input_method_context_cb_keysym(struct wl_client *client EINA_UNUSED, str } if ((context->input) && (context->input->resource)) - wl_text_input_send_keysym(context->input->resource, - serial, time, sym, state, modifiers); + { + wl_text_input_send_keysym(context->input->resource, + serial, time, sym, state, modifiers); + } + else + { + char string[32], key[32], keyname[32]; + Ecore_Event_Key *e = NULL; + + memset(key, 0, sizeof(key)); + xkb_keysym_get_name(sym, key, sizeof(key)); + + memset(keyname, 0, sizeof(keyname)); + xkb_keysym_get_name(sym, keyname, sizeof(keyname)); + if (keyname[0] == '\0') + snprintf(keyname, sizeof(keyname), "Keysym-%u", sym); + + if (strcmp(keyname, "BackSpace") == 0) + { + memset(string, 0, sizeof(string)); + xkb_keysym_to_utf8(sym, string, 32); + + e = E_NEW(Ecore_Event_Key, 1); + if (!e) return; + + e->keyname = (char *)eina_stringshare_add(keyname); + e->key = (char *)eina_stringshare_add(key); + e->string = (char *)eina_stringshare_add(string); + e->compose = (char *)eina_stringshare_add(e->string); + + e->timestamp = 0; /* For distinguishing S/W keyboard event */ + e->same_screen = 1; + e->keycode = 22; /* Backspace keycode */ + + if (state) + ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _e_keyevent_free, NULL); + else + ecore_event_add(ECORE_EVENT_KEY_UP, e, _e_keyevent_free, NULL); + } + } } #if ENABLE_GRAB_KEYBOARD -- 2.7.4 From 01c06db9449acdecaece62446b257052b494c0e6 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 8 Mar 2017 22:00:43 +0900 Subject: [PATCH 06/16] Update package version to 0.1.96 Change-Id: I8d733a9803e29d40038b22c77eb85f2f9a9eaef0 Signed-off-by: Jihoon Kim --- packaging/e-mod-tizen-wl-textinput.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-mod-tizen-wl-textinput.spec b/packaging/e-mod-tizen-wl-textinput.spec index 6f331ce..23e4393 100644 --- a/packaging/e-mod-tizen-wl-textinput.spec +++ b/packaging/e-mod-tizen-wl-textinput.spec @@ -1,7 +1,7 @@ %bcond_with wayland Name: e-mod-tizen-wl-textinput Summary: The Enlightenment WM Wayland Text Input Module for Tizen -Version: 0.1.95 +Version: 0.1.96 Release: 1 Group: Graphics & UI Framework/Other License: BSD-2-Clause and MIT -- 2.7.4 From 50f2850552b1e4718a04c7b37a70480dc1f7321f Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 10 Mar 2017 11:34:23 +0900 Subject: [PATCH 07/16] Allow focus input context to hide input panel Since there are cases an application that manually calls input_panel_show() / hide() without considering system's input panel policy, sometimes they are requesting to hide input panel on focus input context that did not explicitly requested to show in the past. Change-Id: Ic2b2d35461111faeacc2fd8a33568c3fc47c5cf8 Signed-off-by: Jihoon Kim --- src/e_mod_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index c34401b..2807167 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1384,8 +1384,12 @@ _e_text_input_cb_input_panel_hide(struct wl_client *client, struct wl_resource * if (!g_text_input || (text_input && g_show_text_input == text_input)) hide_allowed = EINA_TRUE; - if (g_old_text_input && text_input == g_old_text_input && g_client == client) - hide_allowed = EINA_TRUE; + if (g_client == client) + { + if ((g_old_text_input && (text_input == g_old_text_input)) || + (g_text_input && (text_input == g_text_input))) + hide_allowed = EINA_TRUE; + } if (hide_allowed) { -- 2.7.4 From 174bd597a4f02c3eea88904ec89f1defced7b8df Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Fri, 10 Mar 2017 14:05:23 +0900 Subject: [PATCH 08/16] Update package version to 0.1.97 Change-Id: I5c3f7bfee76340ee58932d4184e8fd39845861c0 Signed-off-by: Jihoon Kim --- packaging/e-mod-tizen-wl-textinput.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-mod-tizen-wl-textinput.spec b/packaging/e-mod-tizen-wl-textinput.spec index 23e4393..51541bf 100644 --- a/packaging/e-mod-tizen-wl-textinput.spec +++ b/packaging/e-mod-tizen-wl-textinput.spec @@ -1,7 +1,7 @@ %bcond_with wayland Name: e-mod-tizen-wl-textinput Summary: The Enlightenment WM Wayland Text Input Module for Tizen -Version: 0.1.96 +Version: 0.1.97 Release: 1 Group: Graphics & UI Framework/Other License: BSD-2-Clause and MIT -- 2.7.4 From 8f17f6bf9027808de48171d2c7ecc2a9668cb689 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 14 Mar 2017 20:30:28 +0900 Subject: [PATCH 09/16] Print the text input information in log Change-Id: If2a55039e5856d80e3a649c895623c32120e7bc2 Signed-off-by: Jihoon Kim --- src/e_mod_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 2807167..d5af153 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1090,6 +1090,8 @@ _e_mod_ecore_key_down_cb(void *data, int type, void *event) static void _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method, Eina_Bool need_focus_in) { + LOGD("text_input : %p\n", text_input); + if (text_input == g_text_input) { g_text_input = NULL; @@ -1158,6 +1160,8 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource input_method = wl_resource_get_user_data(g_input_method->resource); EINA_SAFETY_ON_NULL_GOTO(input_method, err); + LOGD("text_input : %p\n", text_input); + old = input_method->input; if (old == text_input) return; @@ -1165,7 +1169,8 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource if (old) { _e_text_input_deactivate(old, input_method, EINA_TRUE); - if (g_input_panel_state == E_INPUT_PANEL_STATE_DID_SHOW || g_input_panel_state == E_INPUT_PANEL_STATE_WILL_SHOW) + if (g_input_panel_state == E_INPUT_PANEL_STATE_DID_SHOW || + g_input_panel_state == E_INPUT_PANEL_STATE_WILL_SHOW) { g_old_text_input = old; } @@ -1309,10 +1314,11 @@ _e_text_input_method_create_context(struct wl_client *client, E_Input_Method *in static void _e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource *resource) { - LOGD(""); E_Text_Input *text_input = wl_resource_get_user_data(resource); E_Input_Method *input_method = NULL; + LOGD("text_input : %p\n", text_input); + if (!text_input) { WTI_WARNING(resource, @@ -1381,6 +1387,8 @@ _e_text_input_cb_input_panel_hide(struct wl_client *client, struct wl_resource * E_Text_Input *text_input = wl_resource_get_user_data(resource); Eina_Bool hide_allowed = EINA_FALSE; + LOGD("text_input : %p\n", text_input); + if (!g_text_input || (text_input && g_show_text_input == text_input)) hide_allowed = EINA_TRUE; -- 2.7.4 From d275c3671d2a3d8d3baa767ebbdc5164b4236bcd Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Wed, 15 Mar 2017 13:44:55 +0900 Subject: [PATCH 10/16] Memorize last activated ctx even after deactivate request Since previous "old" variable was retrieved from the "input" member variable of input_method, which is cleared on deactivate request, the case that application calls focus_out before problematic focus_in still had problem. This patch is also a temporary solution for dealing with inappropriately handling IME show / hide request, needs to be reverted after a proper solution patch is made. Change-Id: I7becf9518ecb9b35e2933cadf85f4f1b6be2773f --- src/e_mod_main.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index d5af153..13d63c2 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1118,6 +1118,7 @@ _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method, ecore_key_down_handler = NULL; } + LOGD("Resetting input_method->input : %p", input_method->input); input_method->input = NULL; if (input_method->context) input_method->context->input = NULL; input_method->context = NULL; @@ -1140,6 +1141,7 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource E_Input_Method *input_method = NULL; E_Text_Input *old = NULL; E_Input_Method_Context *context = NULL; + static E_Text_Input *last_input = NULL; EINA_SAFETY_ON_NULL_GOTO(resource, err); EINA_SAFETY_ON_NULL_GOTO(seat, err); @@ -1163,18 +1165,21 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource LOGD("text_input : %p\n", text_input); old = input_method->input; + + LOGD("old : %p, text_input : %p , %d", old, text_input, g_input_panel_state); if (old == text_input) return; if (old) + _e_text_input_deactivate(old, input_method, EINA_TRUE); + + if (last_input) { - _e_text_input_deactivate(old, input_method, EINA_TRUE); - if (g_input_panel_state == E_INPUT_PANEL_STATE_DID_SHOW || - g_input_panel_state == E_INPUT_PANEL_STATE_WILL_SHOW) - { - g_old_text_input = old; - } + if (g_old_text_input != last_input) + g_old_text_input = last_input; + LOGD("g_old_text_input : %p", g_old_text_input); } + last_input = text_input; input_method->input = text_input; text_input->input_methods = eina_list_append(text_input->input_methods, input_method); @@ -1235,6 +1240,7 @@ err: static void _e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat) { + LOGD(""); E_Text_Input *text_input = wl_resource_get_user_data(resource); E_Input_Method *input_method = NULL; @@ -1255,6 +1261,7 @@ _e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_reso if (text_input == g_old_text_input) { g_old_text_input = NULL; + LOGD("g_old_text_input : %p", g_old_text_input); } /* FIXME: should get input_method object from seat. */ -- 2.7.4 From d458b1e7a4800575bf8ab6a03dcc0ef3021853b5 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Fri, 17 Mar 2017 12:56:46 +0900 Subject: [PATCH 11/16] Update package version to 0.1.98 Change-Id: I0f7ad7e8e893bd6e2f82b5f08c14a26845ae66fd --- packaging/e-mod-tizen-wl-textinput.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-mod-tizen-wl-textinput.spec b/packaging/e-mod-tizen-wl-textinput.spec index 51541bf..1558af8 100644 --- a/packaging/e-mod-tizen-wl-textinput.spec +++ b/packaging/e-mod-tizen-wl-textinput.spec @@ -1,7 +1,7 @@ %bcond_with wayland Name: e-mod-tizen-wl-textinput Summary: The Enlightenment WM Wayland Text Input Module for Tizen -Version: 0.1.97 +Version: 0.1.98 Release: 1 Group: Graphics & UI Framework/Other License: BSD-2-Clause and MIT -- 2.7.4 From a08c1f5ecf49e5e73f33478e90e0ceba31dd2cef Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 20 Mar 2017 18:13:33 +0900 Subject: [PATCH 12/16] Fix backspace key repeat issue in multibutton entry backspace key down event was delivered after focus out event, but key up event was delivered after focus in event. key down event without key up event leads to repeat key event. To avoid this key repeat issue, key down and up event will be added sequently. Change-Id: I7342b36a6a6482b5e93b1d785f3bc4343243faed Signed-off-by: Jihoon Kim --- src/e_mod_main.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 13d63c2..2eb6573 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -645,6 +645,24 @@ _e_keyevent_free(void *data EINA_UNUSED, void *ev) } static void +feed_key_event(const char *keyname, const char *key, const char *string, int keycode, int state) +{ + Ecore_Event_Key *e = E_NEW(Ecore_Event_Key, 1); + if (!e) return; + + e->keyname = (char *)eina_stringshare_add(keyname); + e->key = (char *)eina_stringshare_add(key); + e->string = (char *)eina_stringshare_add(string); + e->compose = (char *)eina_stringshare_add(e->string); + + e->timestamp = 0; /* For distinguishing S/W keyboard event */ + e->same_screen = 1; + e->keycode = keycode; + + ecore_event_add(state ? ECORE_EVENT_KEY_DOWN : ECORE_EVENT_KEY_UP, e, _e_keyevent_free, NULL); +} + +static void _e_text_input_method_context_cb_keysym(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) { E_Input_Method_Context *context = wl_resource_get_user_data(resource); @@ -665,10 +683,6 @@ _e_text_input_method_context_cb_keysym(struct wl_client *client EINA_UNUSED, str else { char string[32], key[32], keyname[32]; - Ecore_Event_Key *e = NULL; - - memset(key, 0, sizeof(key)); - xkb_keysym_get_name(sym, key, sizeof(key)); memset(keyname, 0, sizeof(keyname)); xkb_keysym_get_name(sym, keyname, sizeof(keyname)); @@ -677,25 +691,20 @@ _e_text_input_method_context_cb_keysym(struct wl_client *client EINA_UNUSED, str if (strcmp(keyname, "BackSpace") == 0) { + /* backspace key should be supported in the multibutton entry of elementary + even though it losts focus */ + memset(key, 0, sizeof(key)); + xkb_keysym_get_name(sym, key, sizeof(key)); + memset(string, 0, sizeof(string)); xkb_keysym_to_utf8(sym, string, 32); - e = E_NEW(Ecore_Event_Key, 1); - if (!e) return; - - e->keyname = (char *)eina_stringshare_add(keyname); - e->key = (char *)eina_stringshare_add(key); - e->string = (char *)eina_stringshare_add(string); - e->compose = (char *)eina_stringshare_add(e->string); - - e->timestamp = 0; /* For distinguishing S/W keyboard event */ - e->same_screen = 1; - e->keycode = 22; /* Backspace keycode */ - if (state) - ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _e_keyevent_free, NULL); - else - ecore_event_add(ECORE_EVENT_KEY_UP, e, _e_keyevent_free, NULL); + { + /* Backspace keycode (22) */ + feed_key_event(keyname, key, string, 22, 1); /* key down */ + feed_key_event(keyname, key, string, 22, 0); /* key up */ + } } } } -- 2.7.4 From 46ebce71e8a5796d9756698e4c7fbadbb5a33504 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 21 Mar 2017 14:30:56 +0900 Subject: [PATCH 13/16] Update package version to 0.1.99 Change-Id: I7bdeea7cffded60c2dce072b5dcae4dad1e9118c Signed-off-by: Jihoon Kim --- packaging/e-mod-tizen-wl-textinput.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/e-mod-tizen-wl-textinput.spec b/packaging/e-mod-tizen-wl-textinput.spec index 1558af8..09343cb 100644 --- a/packaging/e-mod-tizen-wl-textinput.spec +++ b/packaging/e-mod-tizen-wl-textinput.spec @@ -1,7 +1,7 @@ %bcond_with wayland Name: e-mod-tizen-wl-textinput Summary: The Enlightenment WM Wayland Text Input Module for Tizen -Version: 0.1.98 +Version: 0.1.99 Release: 1 Group: Graphics & UI Framework/Other License: BSD-2-Clause and MIT -- 2.7.4 From d22ec4429c7f5db984f4dfd9a2540cd0a5180e2e Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 15 Mar 2017 09:49:20 +0900 Subject: [PATCH 14/16] Revert "Allow focus input context to hide input panel" This reverts commit 50f2850552b1e4718a04c7b37a70480dc1f7321f. Change-Id: I5a0a8ce63cc3f92b2f0c23960d41b54618ed3d10 --- src/e_mod_main.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 2eb6573..a1d0132 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1408,12 +1408,8 @@ _e_text_input_cb_input_panel_hide(struct wl_client *client, struct wl_resource * if (!g_text_input || (text_input && g_show_text_input == text_input)) hide_allowed = EINA_TRUE; - if (g_client == client) - { - if ((g_old_text_input && (text_input == g_old_text_input)) || - (g_text_input && (text_input == g_text_input))) - hide_allowed = EINA_TRUE; - } + if (g_old_text_input && text_input == g_old_text_input && g_client == client) + hide_allowed = EINA_TRUE; if (hide_allowed) { -- 2.7.4 From 0f33fd01ecf47986e16d3b6f8bb6b00ece62365e Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 27 Mar 2017 21:36:13 -0700 Subject: [PATCH 15/16] Revert "Memorize last activated ctx even after deactivate request" This reverts commit d275c3671d2a3d8d3baa767ebbdc5164b4236bcd. Change-Id: I1a66d18995439b9d1f6fd92d4acefba5bf8f62ef --- src/e_mod_main.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index a1d0132..766b11f 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -1127,7 +1127,6 @@ _e_text_input_deactivate(E_Text_Input *text_input, E_Input_Method *input_method, ecore_key_down_handler = NULL; } - LOGD("Resetting input_method->input : %p", input_method->input); input_method->input = NULL; if (input_method->context) input_method->context->input = NULL; input_method->context = NULL; @@ -1150,7 +1149,6 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource E_Input_Method *input_method = NULL; E_Text_Input *old = NULL; E_Input_Method_Context *context = NULL; - static E_Text_Input *last_input = NULL; EINA_SAFETY_ON_NULL_GOTO(resource, err); EINA_SAFETY_ON_NULL_GOTO(seat, err); @@ -1174,21 +1172,18 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource LOGD("text_input : %p\n", text_input); old = input_method->input; - - LOGD("old : %p, text_input : %p , %d", old, text_input, g_input_panel_state); if (old == text_input) return; if (old) - _e_text_input_deactivate(old, input_method, EINA_TRUE); - - if (last_input) { - if (g_old_text_input != last_input) - g_old_text_input = last_input; - LOGD("g_old_text_input : %p", g_old_text_input); + _e_text_input_deactivate(old, input_method, EINA_TRUE); + if (g_input_panel_state == E_INPUT_PANEL_STATE_DID_SHOW || + g_input_panel_state == E_INPUT_PANEL_STATE_WILL_SHOW) + { + g_old_text_input = old; + } } - last_input = text_input; input_method->input = text_input; text_input->input_methods = eina_list_append(text_input->input_methods, input_method); @@ -1249,7 +1244,6 @@ err: static void _e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat) { - LOGD(""); E_Text_Input *text_input = wl_resource_get_user_data(resource); E_Input_Method *input_method = NULL; @@ -1270,7 +1264,6 @@ _e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_reso if (text_input == g_old_text_input) { g_old_text_input = NULL; - LOGD("g_old_text_input : %p", g_old_text_input); } /* FIXME: should get input_method object from seat. */ -- 2.7.4 From c87b30e9c7801f474c8046998d616b31e0c2b312 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 15 Mar 2017 09:49:36 +0900 Subject: [PATCH 16/16] Revert "Allow previous input context to hide input panel" This reverts commit 1a6eb52a2c199b0092a2b5e586fd54eb50f4bce5. Change-Id: I027fc229e411b719f92efb50b15a4862749f67c3 --- src/e_mod_main.c | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/e_mod_main.c b/src/e_mod_main.c index 766b11f..c463ac7 100644 --- a/src/e_mod_main.c +++ b/src/e_mod_main.c @@ -104,7 +104,6 @@ static Ecore_Timer *g_timer_will_hide = NULL; static enum _E_Input_Panel_State g_input_panel_state = E_INPUT_PANEL_STATE_DID_HIDE; static E_Client *client_surface_ec = NULL; static E_Text_Input *g_show_text_input = NULL; -static E_Text_Input *g_old_text_input = NULL; static Eina_List *hooks_ec = NULL; @@ -1176,14 +1175,7 @@ _e_text_input_cb_activate(struct wl_client *client, struct wl_resource *resource return; if (old) - { - _e_text_input_deactivate(old, input_method, EINA_TRUE); - if (g_input_panel_state == E_INPUT_PANEL_STATE_DID_SHOW || - g_input_panel_state == E_INPUT_PANEL_STATE_WILL_SHOW) - { - g_old_text_input = old; - } - } + _e_text_input_deactivate(old, input_method, EINA_TRUE); input_method->input = text_input; text_input->input_methods = eina_list_append(text_input->input_methods, input_method); @@ -1261,11 +1253,6 @@ _e_text_input_cb_deactivate(struct wl_client *client EINA_UNUSED, struct wl_reso g_client = NULL; } - if (text_input == g_old_text_input) - { - g_old_text_input = NULL; - } - /* FIXME: should get input_method object from seat. */ if (g_input_method && g_input_method->resource) input_method = wl_resource_get_user_data(g_input_method->resource); @@ -1394,22 +1381,11 @@ static void _e_text_input_cb_input_panel_hide(struct wl_client *client, struct wl_resource *resource) { E_Text_Input *text_input = wl_resource_get_user_data(resource); - Eina_Bool hide_allowed = EINA_FALSE; - LOGD("text_input : %p\n", text_input); - - if (!g_text_input || (text_input && g_show_text_input == text_input)) - hide_allowed = EINA_TRUE; - - if (g_old_text_input && text_input == g_old_text_input && g_client == client) - hide_allowed = EINA_TRUE; - - if (hide_allowed) - { - _input_panel_hide(client, resource, EINA_FALSE); - g_show_text_input = NULL; - g_old_text_input = NULL; - } + if (!g_text_input || (text_input && g_show_text_input == text_input)) { + _input_panel_hide(client, resource, EINA_FALSE); + g_show_text_input = NULL; + } } static void -- 2.7.4