subsurface: Add cached signal 68/294268/3
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 27 Apr 2023 04:47:42 +0000 (13:47 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Mon, 19 Jun 2023 00:37:37 +0000 (00:37 +0000)
The cached signal can be used for wl_surface add-on objects such as
wl_viewport, wp_presnetaiton to get a chance to cahce its interesting
pending states.

Change-Id: I7e0d66e833686853b66d8ff8251edc97bdfe7aa2

include/libds/types/ds_subsurface.h
src/compositor/subsurface.c

index b50b962..5fd8346 100644 (file)
@@ -22,6 +22,7 @@ struct ds_subsurface
 
     struct {
         struct wl_signal destroy;
+        struct wl_signal cached;
     } events;
 
     struct {
index 3845066..1e1a672 100644 (file)
@@ -54,6 +54,7 @@ create_subsurface(struct wl_resource *subcomp_resource,
     subsurface->synchronized = true;
 
     wl_signal_init(&subsurface->events.destroy);
+    wl_signal_init(&subsurface->events.cached);
 
     subsurface_link_surface(subsurface, surface);
     subsurface_link_parent(subsurface, parent);
@@ -81,6 +82,8 @@ subsurface_commit(struct ds_subsurface *subsurface)
     if (subsurface_is_synchronized(subsurface)) {
         surface_state_move(&subsurface->cached, &surface->pending);
         subsurface->has_cache = true;
+
+        wl_signal_emit(&subsurface->events.cached, subsurface);
     }
     else {
         if (subsurface->has_cache) {