e_policy_wl: Use e_subsurface_create 83/315983/1
authorSeunghun Lee <shiin@samsung.com>
Wed, 27 Nov 2024 07:12:43 +0000 (16:12 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 9 Dec 2024 02:31:01 +0000 (11:31 +0900)
The e_comp_wl_subsurface_add is now deprecated because it's duplicated
with e_subsurface_create().
And this patch makes _tzpol_iface_cb_subsurface_get() using E_Surface
instead of E_Client.

Change-Id: Ib3d27ac53cbb9566aa7137a34f7b398ecae710f9

src/bin/server/e_policy_wl.c

index dd53ae49e17cc2fb4427bd5541fb6201adc1bfb1..5d2a5b8b1c7d3a0403105fdaec2f8d39eb7b16e5 100644 (file)
@@ -37,6 +37,7 @@
 #include "e_view_client_intern.h"
 #include "e_policy_softkey_intern.h"
 #include "e_policy_stack_intern.h"
+#include "e_compositor_intern.h"
 
 #include <device/display.h>
 #include <wayland-server.h>
@@ -2307,25 +2308,23 @@ _tzpol_subsurface_add_with_fake_impl(struct wl_client *client, uint32_t id)
 }
 
 static void
-_tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface, uint32_t parent_id)
+_tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource, uint32_t parent_id)
 {
-   E_Client *ec, *epc;
-   Eina_Bool res;
+   E_Surface *surface = e_surface_from_resource(surface_resource);
+   E_Surface *parent_surface;
+   E_Client *epc;
 
-   ELOGF("TZPOL",
-         "SUBSURF   |wl_surface@%d|parent_id:%d",
-         NULL, wl_resource_get_id(surface), parent_id);
-
-   ec = e_client_from_surface_resource(surface);
+   ELOGF("TZPOL","Create Subsurface: surface(%p) parent id(%d)",
+         e_surface_ec_get(surface), surface, parent_id);
 
    epc = e_pixmap_find_client_by_res_id(parent_id);
    if ((!epc) ||
        (e_object_is_del(E_OBJECT(epc))))
      {
         ELOGF("TZPOL", "SUBSURF   | Invalid parent(%p). "
-              "Create with fake implementation", ec, epc);
+              "Create with fake implementation", e_surface_ec_get(surface), epc);
 
-        e_subsurface_watcher_invalid_parent_notify(surface);
+        e_subsurface_watcher_invalid_parent_notify(surface_resource);
 
         /* We have to create a subsurface resource here even though it's error case
          * because server will send the fatal error when a client destroy a subsurface object.
@@ -2339,13 +2338,13 @@ _tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *res
 
    /* This check code is for detecting an error case which tries to create
     * sub-surface relationship with invalid parent. */
-   if ((!epc->comp_data) ||
-       (!epc->comp_data->wl_surface))
+   parent_surface = e_surface_try_from_ec(epc);
+   if (!parent_surface)
      {
         ELOGF("TZPOL", "Parent(%p internal? %s) doesn't have comp_data. "
               "Possibly it's not the surface created by client. "
               "Cannot be the parent of sub-surface.",
-              ec, epc, epc->internal ? "TRUE" : "FALSE");
+              e_surface_ec_get(surface), epc, epc->internal ? "TRUE" : "FALSE");
         wl_resource_post_error(resource,
                                WL_SUBSURFACE_ERROR_BAD_SURFACE,
                                "Invalid parent_id@%d. Possibly it's not the "
@@ -2355,13 +2354,9 @@ _tzpol_iface_cb_subsurface_get(struct wl_client *client, struct wl_resource *res
         return;
      }
 
-   res = e_comp_wl_subsurface_add(resource, id, surface,
-                                  epc->comp_data->wl_surface);
-   if (!res)
-     {
-        ERR("Failed to add subsurface for surface@%d", wl_resource_get_id(surface));
-        return;
-     }
+
+   if (!e_subsurface_create(resource, id, surface, parent_surface))
+     ERR("Failed to add subsurface for surface(%p)", surface);
 }
 
 static E_Alpha_Opaque