Update input panel state after receiving ready_set message 71/159871/3
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 13 Nov 2017 10:01:41 +0000 (19:01 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Mon, 13 Nov 2017 10:10:07 +0000 (10:10 +0000)
Change-Id: I7d2975b693def0d2f1447d09172d1df5e7e65f40

src/e_mod_input_panel.c
src/e_mod_main.c
src/e_mod_main.h

index 243dc6c..1eb308d 100644 (file)
@@ -176,6 +176,8 @@ _e_input_panel_surface_cb_ready_set(struct wl_client *client EINA_UNUSED, struct
                {
                   e_policy_conformant_part_update(ips->ec);
                   e_input_panel_visibility_change(EINA_TRUE);
+
+                  e_text_input_update_input_panel_state(EINA_TRUE);
                }
              else
                e_input_panel_visibility_change(EINA_FALSE);
index aefb690..0e7c071 100644 (file)
@@ -148,6 +148,7 @@ static enum _E_Input_Panel_State g_input_panel_state = E_INPUT_PANEL_STATE_DID_H
 static E_Client *client_surface_ec = NULL;
 static E_Text_Input *g_show_text_input = NULL;
 static struct wl_client *g_show_client = NULL;
+static Eina_Bool g_updated_geometry = EINA_FALSE;
 
 /* The candidate's show state that was requested by the application or IME */
 static Eina_Bool g_show_state_candidate = EINA_FALSE;
@@ -1132,7 +1133,10 @@ _e_text_input_method_context_cb_update_ise_geometry(struct wl_client *client EIN
       }
 
     if ((context->input) && (context->input->resource))
-      _e_text_input_send_input_panel_geometry(context->input->resource, x, y, width, height);
+      {
+         _e_text_input_send_input_panel_geometry(context->input->resource, x, y, width, height);
+         g_updated_geometry = EINA_TRUE;
+      }
 
 }
 static const struct wl_input_method_context_interface _e_text_input_method_context_implementation = {
@@ -1522,14 +1526,7 @@ _e_text_input_cb_input_panel_show(struct wl_client *client, struct wl_resource *
    g_input_panel_state = E_INPUT_PANEL_STATE_WILL_SHOW;
    g_show_text_input = text_input;
 
-   if (text_input->resource)
-     {
-        int x = 0, y = 0, w = 0, h = 0;
-        if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h))
-          _e_text_input_send_input_panel_geometry(text_input->resource, x, y, w, h);
-
-        wl_text_input_send_input_panel_state(text_input->resource, WL_TEXT_INPUT_INPUT_PANEL_STATE_SHOW);
-     }
+   g_updated_geometry = EINA_FALSE;
 
    e_input_panel_transient_for_set(client_surface_ec);
 }
@@ -2382,6 +2379,36 @@ _pol_cb_hook_client_del(void *d EINA_UNUSED, E_Client *ec)
      }
 }
 
+void
+e_text_input_update_input_panel_state(Eina_Bool state)
+{
+   if (!g_text_input || !g_text_input->resource) return;
+
+   E_Text_Input *text_input = wl_resource_get_user_data(g_text_input->resource);
+
+   if (!text_input)
+     {
+        WTI_WARNING(g_text_input->resource,
+                    WL_DISPLAY_ERROR_INVALID_OBJECT,
+                    "No Text Input For Resource");
+        return;
+     }
+
+   if (text_input->resource)
+     {
+        if (!g_updated_geometry)
+          {
+             int x = 0, y = 0, w = 0, h = 0;
+             if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h))
+               _e_text_input_send_input_panel_geometry(text_input->resource, x, y, w, h);
+             g_updated_geometry = EINA_TRUE;
+          }
+        uint32_t input_panel_state = WL_TEXT_INPUT_INPUT_PANEL_STATE_HIDE;
+        if (state) input_panel_state = WL_TEXT_INPUT_INPUT_PANEL_STATE_SHOW;
+        wl_text_input_send_input_panel_state(text_input->resource, input_panel_state);
+     }
+}
+
 E_API void *
 e_modapi_init(E_Module *m)
 {
index be2ecae..2b29fe2 100644 (file)
@@ -21,6 +21,8 @@ EINTERN void   e_input_panel_transient_for_set(E_Client *parent);
 void        e_input_panel_show_need_rerun_set(Eina_Bool need_rerun);
 void        e_input_panel_floating_position_set(E_Client *ec, int x, int y);
 
+void        e_text_input_update_input_panel_state(Eina_Bool state);
+
 typedef enum {
    TIZEN_PROFILE_UNKNOWN = 0,
    TIZEN_PROFILE_MOBILE = 0x1,