Reduce the duplicate code to append input panel surface 17/276817/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 27 Jun 2022 02:47:18 +0000 (11:47 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 27 Jun 2022 02:47:18 +0000 (11:47 +0900)
Change-Id: I408290a28d21ee19885892570011c190f78d7e9e
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/e_mod_input_panel.c

index e6c5401..2a3b8fb 100644 (file)
@@ -206,7 +206,7 @@ _e_input_panel_surface_append(E_Input_Panel *input_panel, E_Input_Panel_Surface
 }
 
 static void
-_e_input_panel_surface_cb_toplevel_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *output_resource EINA_UNUSED, uint32_t position EINA_UNUSED)
+append_input_panel_surface(struct wl_resource *resource)
 {
    E_Input_Panel_Surface *ips = wl_resource_get_user_data(resource);
    E_Input_Panel *input_panel = NULL;
@@ -225,22 +225,15 @@ _e_input_panel_surface_cb_toplevel_set(struct wl_client *client EINA_UNUSED, str
 }
 
 static void
-_e_input_panel_surface_cb_overlay_panel_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
+_e_input_panel_surface_cb_toplevel_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *output_resource EINA_UNUSED, uint32_t position EINA_UNUSED)
 {
-   E_Input_Panel_Surface *ips = wl_resource_get_user_data(resource);
-   E_Input_Panel *input_panel = NULL;
-
-   CHECK_INPUT_PANEL_SURFACE(ips);
-
-   if (!(input_panel = ips->input_panel)) return;
+   append_input_panel_surface(resource);
+}
 
-   /* Do not append duplicated surface - And need to check if the surface really needs to be appended here,
-   * since the newly created surface is already being appended at function _e_input_panel_cb_surface_get() */
-   if (eina_list_data_find(input_panel->surfaces, ips) != ips)
-     {
-        _e_input_panel_surface_append(input_panel, ips, resource);
-     }
-   ips->panel = EINA_TRUE;
+static void
+_e_input_panel_surface_cb_overlay_panel_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
+{
+   append_input_panel_surface(resource);
 }
 
 static void