e_comp_wl_shell: Emit E_COMP_WL_HOOK_SHELL_SURFACE_READY hook 63/323263/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 24 Apr 2025 08:07:54 +0000 (17:07 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 25 Apr 2025 01:07:09 +0000 (10:07 +0900)
This patch moves the implementation of emitting the
E_COMP_WL_HOOK_SHELL_SURFACE_READY hook from e_comp_wl to
e_comp_wl_shell. The hook is emitted when new_toplevel signal is emitted
by E_Desktop_Shell.
The hook cannot be removed at this time, as it is still used by the e
modules.

Change-Id: I189210e0902fa8d00d7e480e84567fa69a2f1b91

src/bin/server/e_comp_wl.c
src/bin/server/e_comp_wl_intern.h
src/bin/server/e_comp_wl_shell.c
src/bin/server/e_comp_wl_shell_intern.h
src/bin/server/e_desktop_shell.c

index e1673556169fc3444ba5b56b3386395f6e912635..5eb963fd0722816765f22cc4828a775bb48768cc 100644 (file)
@@ -4788,14 +4788,6 @@ e_comp_wl_intercept_hook_del(E_Comp_Wl_Intercept_Hook *ch)
      _e_comp_wl_intercept_hooks_delete++;
 }
 
-EINTERN void
-e_comp_wl_shell_surface_ready(E_Client *ec)
-{
-   if (!ec) return;
-
-   _e_comp_wl_hook_call(E_COMP_WL_HOOK_SHELL_SURFACE_READY, ec);
-}
-
 E_API void
 e_comp_wl_input_cursor_timer_enable_set(Eina_Bool enabled)
 {
index d7d94b82ade15b20ca9e47fd8567295b865ad771..37740a9ad23d6d9f0b64e4572e36dab944b54057 100644 (file)
@@ -53,8 +53,6 @@ EINTERN void e_comp_wl_send_event_e_device(struct wl_client *wc, uint32_t timest
 
 EINTERN Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Comp_Wl_Data *comp_wl, E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state);
 
-EINTERN void e_comp_wl_shell_surface_ready(E_Client *ec);
-
 EINTERN void e_comp_wl_map_inv_coord_get(E_Client *ec, int x, int y, int *mx, int *my);
 
 EINTERN Eina_Bool e_comp_wl_cursor_hide(E_Client *ec);
index aced0cb2f927b1d8ad1bf289aa8cb574adeb1831..27219a6e5869581430d4543ace839824794c62dc 100644 (file)
 #include "e_config_intern.h"
 #include "e_view_intern.h"
 #include "e_view_client_intern.h"
-#include "e_desktop_shell_intern.h"
 
 #include <tizen-extension-server-protocol.h>
 
+struct _E_Comp_Wl_Shell
+{
+   struct wl_listener new_toplevel;
+};
+
 EINTERN Eina_Bool
 e_shell_e_client_shell_assignable_check(E_Client *ec)
 {
@@ -514,3 +518,39 @@ e_shell_e_client_unmap(E_Client *ec)
      }
 }
 
+static void
+_shell_cb_new_toplevel(struct wl_listener *listener, void *data)
+{
+   E_Desktop_Toplevel *toplevel = data;
+
+   e_comp_wl_shell_surface_ready(e_desktop_toplevel_ec_get(toplevel));
+}
+
+EINTERN E_Comp_Wl_Shell *
+e_comp_wl_shell_create(E_Desktop_Shell *desktop_shell)
+{
+   E_Comp_Wl_Shell *shell;
+
+   shell = calloc(1, sizeof(*shell));
+   if (!shell)
+     return NULL;
+
+   shell->new_toplevel.notify = _shell_cb_new_toplevel;
+   e_desktop_shell_new_toplevel_listener_add(desktop_shell, &shell->new_toplevel);
+
+   return shell;
+}
+
+EINTERN void
+e_comp_wl_shell_destroy(E_Comp_Wl_Shell *shell)
+{
+   wl_list_remove(&shell->new_toplevel.link);
+   free(shell);
+}
+
+EINTERN void
+e_comp_wl_shell_surface_ready(E_Client *ec)
+{
+   e_comp_wl_hook_call(E_COMP_WL_HOOK_SHELL_SURFACE_READY, ec);
+}
+
index d9672a73c627a62b42ddf61a9ed262adf2013edf..ef2b51e8d6b7f47843f2c40068c7f048a9ffabee 100644 (file)
@@ -2,9 +2,15 @@
 #define E_COMP_WL_SHELL_INTERN_H
 
 #include "e_comp_wl.h"
+#include "e_desktop_shell_intern.h"
 
+typedef struct _E_Comp_Wl_Shell E_Comp_Wl_Shell;
 typedef struct _E_Comp_Wl_Shell_Surface_Api E_Shell_Surface_Api;
 
+E_Comp_Wl_Shell *e_comp_wl_shell_create(E_Desktop_Shell *desktop_shell);
+void e_comp_wl_shell_destroy(E_Comp_Wl_Shell *shell);
+void e_comp_wl_shell_surface_ready(E_Client *ec);
+
 EINTERN Eina_Bool e_shell_e_client_shell_assignable_check(E_Client *ec);
 EINTERN void      e_shell_e_client_shsurface_assign(E_Client *ec, struct wl_resource *shsurface, E_Shell_Surface_Api *api);
 EINTERN void      e_shell_e_client_shsurface_api_set(E_Client *ec, E_Shell_Surface_Api *api);
index b1dda86d39297c28b66570f8653831b6782af41a..35d58ad3ebe633685c01de58ae29564457be9820 100644 (file)
@@ -16,6 +16,7 @@ struct _E_Desktop_Shell
 {
    struct wl_global *wl_shell;
    struct wl_global *xdg_shell_v5;
+   E_Comp_Wl_Shell *e_comp_wl_shell;
 
    struct wl_listener display_destroy;
 
@@ -33,6 +34,7 @@ _shell_cb_display_destroy(struct wl_listener *listener, void *data)
 
    wl_signal_emit(&shell->events.destroy, shell);
 
+   e_comp_wl_shell_destroy(shell->e_comp_wl_shell);
    wl_global_destroy(shell->wl_shell);
    wl_global_destroy(shell->xdg_shell_v5);
    wl_list_remove(&shell->display_destroy.link);
@@ -48,6 +50,9 @@ e_desktop_shell_create(struct wl_display *display)
    if (!shell)
      return NULL;
 
+   wl_signal_init(&shell->events.destroy);
+   wl_signal_init(&shell->events.new_toplevel);
+
    shell->wl_shell = e_desktop_wl_shell_create(display);
    if (!shell->wl_shell)
      goto err_wl_shell;
@@ -59,8 +64,9 @@ e_desktop_shell_create(struct wl_display *display)
    if (!e_desktop_xdg_shell_v6_init(display, shell))
      goto err_xdg_shell_v6;
 
-   wl_signal_init(&shell->events.destroy);
-   wl_signal_init(&shell->events.new_toplevel);
+   shell->e_comp_wl_shell = e_comp_wl_shell_create(shell);
+   if (!shell->e_comp_wl_shell)
+     goto err_xdg_shell_v6;
 
    shell->display_destroy.notify = _shell_cb_display_destroy;
    wl_display_add_destroy_listener(display, &shell->display_destroy);
@@ -80,8 +86,6 @@ err_wl_shell:
 EINTERN void
 e_desktop_shell_toplevel_add(E_Desktop_Shell *shell, E_Desktop_Toplevel *toplevel)
 {
-   e_comp_wl_shell_surface_ready(e_surface_ec_get(toplevel->surface.surface));
-
    wl_signal_emit(&shell->events.new_toplevel, toplevel);
 }