e_client: Use E_Desktop_Surface for shell surface abstraction 80/323180/1
authorSeunghun Lee <shiin.lee@samsung.com>
Mon, 24 Mar 2025 08:00:53 +0000 (17:00 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 24 Apr 2025 02:15:34 +0000 (11:15 +0900)
This commit updates e_client to use E_Desktop_Surface for abstracting
shell surfaces. This change improves modularity and consistency with
other desktop shell components.

Change-Id: Ibec8ac0edafba1229f94accf47427c3048473aec

src/bin/core/e_client.c
src/bin/server/e_comp_wl.c
src/bin/server/e_comp_wl_rsm.c
src/bin/windowmgr/e_policy_desk_area.c

index 131197fe3ea1da0e185f1fb9845d691189c2438b..f7f06d14570d33f09b540065cf1d24aadcd596cc 100644 (file)
@@ -25,6 +25,9 @@
 #include "e_hwc_window_intern.h"
 #include "e_canvas_intern.h"
 #include "e_policy_visibility_intern.h"
+#include "e_policy_stack_intern.h"
+#include "e_policy_wl_intern.h"
+#include "e_desktop_shell_intern.h"
 
 #define PRI(ec) ((E_Client_Private *)e_object_data_get(E_OBJECT(ec)))
 
@@ -6452,41 +6455,87 @@ e_client_unmap_listener_add(E_Client *ec, struct wl_listener *listener)
 EINTERN Eina_Bool
 e_client_shell_configure_send(E_Client *ec, uint32_t edges, int32_t width, int32_t height)
 {
+   E_Surface *surface;
+   E_Desktop_Surface *desktop_surface = NULL;
+
    EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
-   EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
 
-   if ((!ec->comp_data->shell.surface) ||
-       (!ec->comp_data->shell.configure_send))
-     return EINA_FALSE;
+   surface = e_surface_try_from_ec(ec);
+   if (surface)
+     desktop_surface = e_desktop_surface_try_from_surface(surface);
+
+   if (desktop_surface)
+     {
+        e_desktop_surface_configure_send(desktop_surface, edges, width, height);
+     }
+   else
+     {
+        EINA_SAFETY_ON_NULL_RETURN_VAL(ec->comp_data, EINA_FALSE);
+
+        if ((!ec->comp_data->shell.surface) ||
+            (!ec->comp_data->shell.configure_send))
+             return EINA_FALSE;
+
+        ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, edges, width, height);
+     }
 
-   ec->comp_data->shell.configure_send(ec->comp_data->shell.surface, edges, width, height);
    return EINA_TRUE;
 }
 
 EINTERN void
 e_client_shell_configure(E_Client *ec, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height)
 {
+   E_Surface *surface;
+   E_Desktop_Surface *desktop_surface = NULL;
+
    EINA_SAFETY_ON_NULL_RETURN(ec);
-   EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
 
-   if ((!ec->comp_data->shell.surface) ||
-       (!ec->comp_data->shell.configure))
-     return;
+   surface = e_surface_try_from_ec(ec);
+   if (surface)
+     desktop_surface = e_desktop_surface_try_from_surface(surface);
 
-   ec->comp_data->shell.configure(ec->comp_data->shell.surface, x, y, width, height);
+   if (desktop_surface)
+     {
+        e_desktop_surface_configure(desktop_surface, x, y, width, height);
+     }
+   else
+     {
+        EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
+
+        if ((!ec->comp_data->shell.surface) ||
+            (!ec->comp_data->shell.configure))
+          return;
+
+        ec->comp_data->shell.configure(ec->comp_data->shell.surface, x, y, width, height);
+     }
 }
 
 EINTERN void
 e_client_shell_ping(E_Client *ec)
 {
+   E_Surface *surface;
+   E_Desktop_Surface *desktop_surface = NULL;
+
    EINA_SAFETY_ON_NULL_RETURN(ec);
-   EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
 
-   if ((!ec->comp_data->shell.surface) ||
-       (!ec->comp_data->shell.ping))
-     return;
+   surface = e_surface_try_from_ec(ec);
+   if (surface)
+     desktop_surface = e_desktop_surface_try_from_surface(surface);
 
-   ec->comp_data->shell.ping(ec->comp_data->shell.surface);
+   if (desktop_surface)
+     {
+        e_desktop_surface_ping(desktop_surface);
+     }
+   else
+     {
+        EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
+
+        if ((!ec->comp_data->shell.surface) ||
+            (!ec->comp_data->shell.ping))
+          return;
+
+        ec->comp_data->shell.ping(ec->comp_data->shell.surface);
+     }
 }
 
 static void
@@ -6631,27 +6680,57 @@ e_client_icccm_title_get(E_Client *ec)
 static void
 _e_client_shell_map(E_Client *ec)
 {
+   E_Surface *surface;
+   E_Desktop_Surface *desktop_surface = NULL;
+
    EINA_SAFETY_ON_NULL_RETURN(ec);
-   EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
 
-   if ((!ec->comp_data->shell.surface) ||
-       (!ec->comp_data->shell.map))
-     return;
+   surface = e_surface_try_from_ec(ec);
+   if (surface)
+     desktop_surface = e_desktop_surface_try_from_surface(surface);
 
-   ec->comp_data->shell.map(ec->comp_data->shell.surface);
+   if (desktop_surface)
+     {
+        e_desktop_surface_map(desktop_surface);
+     }
+   else
+     {
+        EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
+
+        if ((!ec->comp_data->shell.surface) ||
+            (!ec->comp_data->shell.map))
+          return;
+
+        ec->comp_data->shell.map(ec->comp_data->shell.surface);
+     }
 }
 
 EINTERN void
 e_client_shell_unmap(E_Client *ec)
 {
+   E_Surface *surface;
+   E_Desktop_Surface *desktop_surface = NULL;
+
    EINA_SAFETY_ON_NULL_RETURN(ec);
-   EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
 
-   if ((!ec->comp_data->shell.surface) ||
-       (!ec->comp_data->shell.unmap))
-     return;
+   surface = e_surface_try_from_ec(ec);
+   if (surface)
+     desktop_surface = e_desktop_surface_try_from_surface(surface);
 
-   ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
+   if (desktop_surface)
+     {
+        e_desktop_surface_unmap(desktop_surface);
+     }
+   else
+     {
+        EINA_SAFETY_ON_NULL_RETURN(ec->comp_data);
+
+        if ((!ec->comp_data->shell.surface) ||
+            (!ec->comp_data->shell.unmap))
+          return;
+
+        ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
+     }
 }
 
 EINTERN void
@@ -6696,7 +6775,7 @@ e_client_hide(E_Client *ec)
      return;
 
    comp_wl = e_comp_wl_get();
-   if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.unmap))
+   if (ec->comp_data->shell.surface)
      {
         ELOGF("E_CLIENT", "Unmap", ec);
 
index b3c067d0b75f280066fc2754fbc5a0637ea7ab27..ee574c81130328b531f83ff237f6a05c51788671 100644 (file)
@@ -3451,11 +3451,7 @@ _e_comp_wl_client_cb_focus_set(void *data EINA_UNUSED, E_Client *ec)
    if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
 
    /* send configure */
-   if (ec->comp_data->shell.configure_send)
-     {
-        if (ec->comp_data->shell.surface)
-          _e_comp_wl_configure_send(ec, 0, 0);
-     }
+   _e_comp_wl_configure_send(ec, 0, 0);
 }
 
 static void
@@ -3464,11 +3460,7 @@ _e_comp_wl_client_cb_focus_unset(void *data EINA_UNUSED, E_Client *ec)
    if (e_pixmap_type_get(ec->pixmap) != E_PIXMAP_TYPE_WL) return;
 
    /* send configure */
-   if (ec->comp_data->shell.configure_send)
-     {
-        if (ec->comp_data->shell.surface)
-          _e_comp_wl_configure_send(ec, 0, 0);
-     }
+   _e_comp_wl_configure_send(ec, 0, 0);
 
    _e_comp_wl_focus_check();
 }
index 46a1def2492837a874931424a3d487649199b7ba..a72b257e639e373c3cd8206391d2aaf8b2d3fec4 100644 (file)
@@ -377,7 +377,7 @@ _remote_provider_offscreen_set(E_Comp_Wl_Remote_Provider* provider, Eina_Bool se
 
         //TODO: consider what happens if it's not normal client such as subsurface client
         //TODO: save original values
-        if ((ec->comp_data->shell.surface) && (ec->comp_data->shell.unmap))
+        if (ec->comp_data->shell.surface)
           {
              ELOGF("COMP", "Call shell.unmap by rsm", ec);
              e_client_shell_unmap(ec);
index e8cec46e697b0f12f820eb0eae457fcbbb15792b..8bd228815dd1aff5c49347fd3aa654bf8eda8cc1 100644 (file)
@@ -943,8 +943,7 @@ _desk_area_cb_client_fullscreen(struct wl_listener *listener, void *data)
    if (fullscreen_policy == E_FULLSCREEN_RESIZE)
      e_client_frame_geometry_set(ec, eda->x, eda->y, eda->w, eda->h);
 
-   if (ec->comp_data->shell.configure_send)
-     _e_policy_desk_area_configure_send(ec, 0, 1);
+   _e_policy_desk_area_configure_send(ec, 0, 1);
 
    e_client_maximize_pre_set(ec, EINA_FALSE);
 }
@@ -966,8 +965,7 @@ _desk_area_cb_client_unfullscreen(struct wl_listener *listener, void *data)
    ec->pre_res_change.valid = 0;
    eda->fullscreen_clients = eina_list_remove(eda->fullscreen_clients, ec);
 
-   if (ec->comp_data->shell.configure_send)
-     _e_policy_desk_area_configure_send(ec, 0, 0);
+   _e_policy_desk_area_configure_send(ec, 0, 0);
 
    e_client_maximize_pre_set(ec, EINA_FALSE);
 
@@ -1465,8 +1463,7 @@ _desk_area_cb_client_unmaximize(struct wl_listener *listener, void *data)
 
              // re-set maximized state for unmaximize smart callback.
              ec->maximized = tmp_max;
-             if (ec->comp_data && ec->comp_data->shell.configure_send)
-               _e_policy_desk_area_configure_send(ec, 0, 0);
+             _e_policy_desk_area_configure_send(ec, 0, 0);
              e_client_maximize_pre_set(ec, EINA_FALSE);
 
              // un-set maximized state.
@@ -1555,8 +1552,7 @@ _desk_area_cb_client_unmaximize_done(struct wl_listener *listener, void *data)
    eda_client = wl_container_of(listener, eda_client, client_unmaximize_done);
    ec = eda_client->ec;
 
-   if (ec->comp_data && ec->comp_data->shell.configure_send)
-     _e_policy_desk_area_configure_send(ec, 0, 0);
+   _e_policy_desk_area_configure_send(ec, 0, 0);
 
    e_client_maximize_pre_set(ec, EINA_FALSE);
 }
@@ -2684,7 +2680,6 @@ _desk_area_cb_comp_object_resize(struct wl_listener *listener, void *data)
 
    // "override = 1" means that ec is not controlled by wm policy
    if (ec->override) return;
-   if (!ec->comp_data->shell.configure_send) return;
 
    /* TODO: calculate x, y with transfrom object */
    if ((e_client_util_resizing_get(ec)) && (e_client_resize_edges_get(ec)))