Send input panel geometry in finishing moving floating IME 46/241046/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Wed, 12 Aug 2020 11:11:27 +0000 (20:11 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 14 Aug 2020 08:21:17 +0000 (17:21 +0900)
Change-Id: Id354c84b7029129ed13982c2a1c72a3d68c76c06
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/e_mod_input_panel.c
src/e_mod_main.c
src/e_mod_main.h

index 95a78c3262a8f7bfced9e313394f8bebbf435fcb..cac13b0a7705f399d834859c45a9b1bff17bf5ca 100644 (file)
@@ -910,6 +910,9 @@ _e_ips_cb_mouse_up(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED
 
    g_floating_info->mouse_pressed = EINA_FALSE;
    g_floating_info->moving_req = EINA_FALSE;
+
+   LOGD("[Mouse up] Send input panel geometry");
+   e_text_input_update_input_panel_geometry(ec);
 }
 
 static void
index c545e0a19022628399027dd5634ef8a437936f25..56f1de4dcce5e5fbfe51d61e3dd1c094a977be14 100644 (file)
@@ -2305,13 +2305,23 @@ _e_mod_eeze_udev_watch_cb(const char *text, Eeze_Udev_Event event, void *data, E
      set_soft_keyboard_mode();
 }
 
+static Eina_Bool
+e_client_rotation_is_progress(E_Client *ec)
+{
+   if (!ec) return EINA_TRUE;
+
+   if (ec->e.state.rot.ang.next == -1)
+     return EINA_FALSE;
+   else
+     return EINA_TRUE;
+}
+
 static Eina_Bool
 _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
 {
    E_Event_Client *ev;
    E_Client *ec;
    Eina_Bool found;
-   int x = 0, y = 0, w = 0, h = 0;
 
    ev = (E_Event_Client *)event;
    EINA_SAFETY_ON_NULL_RETURN_VAL(ev, ECORE_CALLBACK_PASS_ON);
@@ -2323,11 +2333,7 @@ _e_text_input_method_context_cb_client_resize(void *data EINA_UNUSED, int type E
    if (!found) return ECORE_CALLBACK_PASS_ON;
    if ((ec->w < 1) && (ec->h < 1)) return ECORE_CALLBACK_PASS_ON;
 
-   if (g_text_input && g_text_input->resource && g_input_panel_state != E_INPUT_PANEL_STATE_WILL_HIDE && g_input_panel_state != E_INPUT_PANEL_STATE_DID_HIDE)
-     {
-        if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h) && !(w <= 1 || h <= 1))
-          _e_text_input_send_input_panel_geometry(g_text_input->resource, x, y, w, h);
-     }
+   e_text_input_update_input_panel_geometry(ec);
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -2388,6 +2394,31 @@ e_text_input_update_input_panel_state(Eina_Bool state)
      }
 }
 
+void
+e_text_input_update_input_panel_geometry(E_Client *ec)
+{
+   if (g_text_input && g_text_input->resource &&
+       g_input_panel_state != E_INPUT_PANEL_STATE_WILL_HIDE && g_input_panel_state != E_INPUT_PANEL_STATE_DID_HIDE &&
+       g_updated_geometry)
+     {
+        if (e_client_rotation_is_progress(ec))
+          {
+             LOGD("Rotation is not finished");
+             return;
+          }
+
+        /* The geometry of E_Client may not be valid when IME is shown.
+           Assume E_Client has a valid geometry when this callback is called after IME has set the size.
+         */
+        int x = 0, y = 0, w = 0, h = 0;
+        if (e_input_panel_client_geometry_get(NULL, &x, &y, &w, &h) && !(w <= 1 || h <= 1))
+          {
+             LOGD("x : %d, y : %d, w : %d, h : %d", x, y, w, h);
+             _e_text_input_send_input_panel_geometry(g_text_input->resource, x, y, w, h);
+          }
+     }
+}
+
 E_API void *
 e_modapi_init(E_Module *m)
 {
index 1ad4a2a1b4c1e94b7a625c964e1a4e72546269a3..6d540b45907a50f3ac678db42e7f3382823aada4 100644 (file)
@@ -22,6 +22,7 @@ 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(int x, int y);
 void        e_text_input_update_input_panel_state(Eina_Bool state);
+void        e_text_input_update_input_panel_geometry(E_Client *ec);
 Eina_Bool   e_input_panel_surface_destroy(E_Client *ec);
 int         e_input_panel_is_effect_running(void);