Memorize last activated ctx even after deactivate request
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 15 Mar 2017 04:44:55 +0000 (13:44 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 21 Mar 2017 05:56:51 +0000 (14:56 +0900)
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

index e114153..f6cc48a 100644 (file)
@@ -1162,6 +1162,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;
@@ -1183,6 +1184,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);
@@ -1206,18 +1208,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);
@@ -1277,6 +1282,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;
 
@@ -1297,6 +1303,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. */