Add code to handle visibility event of the keyboard 41/307341/1
authorDoyoun Kang <doyoun.kang@samsung.com>
Thu, 7 Mar 2024 05:59:49 +0000 (14:59 +0900)
committerDoyoun Kang <doyoun.kang@samsung.com>
Thu, 7 Mar 2024 08:24:34 +0000 (17:24 +0900)
There was a bug that the keyboard window was shown even though the user
requested to hide the keyboard in some case.

To resolve this, we change the keyboard's visible state to FALSE when
the visibility of keyboard is chagned to fully obscured.

Change-Id: I7d8bad9957005bb8fd0fcc19ae16a9fc04cd3fb0

src/e_mod_input_panel.c

index 1c39cf269a7fcabebdb25f98a317738b9b6defa5..7b30b4bf0d6a77f41dea6b11ca3af13efa2231fd 100644 (file)
@@ -58,6 +58,7 @@ struct _E_Input_Panel_Surface
         Ecore_Event_Handler *rot_change_end;
         Ecore_Event_Handler *buf_change;
         Ecore_Event_Handler *rot_geometry_set;
+        Ecore_Event_Handler *visibility_change;
      } eh;
 
    Eina_Bool panel;
@@ -380,6 +381,8 @@ _e_input_panel_surface_resource_destroy(struct wl_resource *resource)
 
    LOGI("Removing ips %p from input panel %p", ips, input_panel);
    input_panel->surfaces = eina_list_remove(input_panel->surfaces, ips);
+
+   E_FREE_FUNC(ips->eh.visibility_change, ecore_event_handler_del);
    E_FREE_FUNC(ips->eh.rot_geometry_set, ecore_event_handler_del);
    E_FREE_FUNC(ips->eh.rot_change_end, ecore_event_handler_del);
    E_FREE_FUNC(ips->eh.buf_change, ecore_event_handler_del);
@@ -802,6 +805,33 @@ end:
    return ECORE_CALLBACK_PASS_ON;
 }
 
+static Eina_Bool
+_e_input_panel_client_cb_visibility_change(void *data, int type, void *event)
+{
+   E_Client *ec;
+   E_Input_Panel_Surface *ips = data;
+   E_Event_Client *ev = event;
+
+   if (!ips || !ev->ec)
+     goto end;
+
+   ec = ev->ec;
+   if (ec != ips->ec)
+     goto end;
+
+   if (!ips->showing)
+     goto end;
+
+   if (ips->resizing)
+     goto end;
+
+   if (ec->visibility.obscured == E_VISIBILITY_FULLY_OBSCURED)
+     e_input_panel_visibility_change(EINA_FALSE);
+
+end:
+   return ECORE_CALLBACK_PASS_ON;
+}
+
 static void
 _e_input_panel_client_cb_remove(void *data, E_Client *ec)
 {
@@ -1081,6 +1111,10 @@ _e_input_panel_cb_surface_get(struct wl_client *client, struct wl_resource *reso
       ecore_event_handler_add(E_EVENT_CLIENT_ROTATION_GEOMETRY_SET,
                               _e_input_panel_client_cb_rotation_geometry_set, ips);
 
+   ips->eh.visibility_change =
+      ecore_event_handler_add(E_EVENT_CLIENT_VISIBILITY_CHANGE,
+                              _e_input_panel_client_cb_visibility_change, ips);
+
    ips->hook_del = e_client_hook_add(E_CLIENT_HOOK_DEL, _e_input_panel_client_cb_remove, ips);
    ips->hook_rotation_geometry_set = e_policy_hook_add(E_POLICY_HOOK_CLIENT_ROTATION_GEOMETRY_SET, _e_input_panel_rotation_geometry_set, ips);