subsurface: add ds_subsurface_from_resource 15/280015/2 accepted/tizen/unified/20220823.131807 submit/tizen/20220823.002323
authorSooChan Lim <sc1.lim@samsung.com>
Fri, 19 Aug 2022 11:10:01 +0000 (20:10 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 22 Aug 2022 09:08:45 +0000 (09:08 +0000)
This make get the ds_subsurface from wl_subusrface resource.

Change-Id: I8290a812980773fbe82197eb2062470b2ed1c303

include/libds/subsurface.h
src/surface/subsurface.c

index 72ed088..5549f0a 100644 (file)
@@ -11,6 +11,9 @@ struct ds_subsurface;
 
 bool ds_surface_is_subsurface(struct ds_surface *surface);
 
+struct ds_subsurface *
+ds_subsurface_from_resource(struct wl_resource *resource);
+
 #ifdef __cplusplus
 }
 #endif
index 2ec0dae..080513f 100644 (file)
@@ -76,6 +76,14 @@ ds_surface_is_subsurface(struct ds_surface *surface)
     return ds_surface_get_role(surface) == &subsurface_role;
 }
 
+WL_EXPORT struct ds_subsurface *
+ds_subsurface_from_resource(struct wl_resource *resource)
+{
+    assert(wl_resource_instance_of(resource, &wl_subsurface_interface,
+                &subsurface_impl));
+    return wl_resource_get_user_data(resource);
+}
+
 struct ds_subsurface *
 ds_subsurface_from_ds_surface(struct ds_surface *surface)
 {