surface: Add cache event
authorSeunghun Lee <shiin.lee@samsung.com>
Wed, 6 Dec 2023 08:35:23 +0000 (17:35 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Thu, 28 Dec 2023 02:06:01 +0000 (11:06 +0900)
include/libds/types/ds_surface.h
src/compositor/subsurface.c
src/compositor/surface.c

index 1447a2e..c1bb45a 100644 (file)
@@ -81,6 +81,7 @@ struct ds_surface
 
     struct {
         struct wl_signal commit;
+        struct wl_signal cache;
         struct wl_signal new_subsurface;
         struct wl_signal destroy;
     } events;
index 07f35e7..aabdb39 100644 (file)
@@ -120,6 +120,7 @@ subsurface_commit(struct ds_subsurface *subsurface)
         subsurface->has_cache = true;
 
         wl_signal_emit_mutable(&subsurface->events.cached, subsurface);
+        wl_signal_emit_mutable(&surface->events.cache, surface);
     }
     else {
         if (subsurface->has_cache) {
index 8b8a135..3a3f771 100644 (file)
@@ -31,6 +31,13 @@ ds_surface_add_commit_listener(struct ds_surface *surface,
 }
 
 WL_EXPORT void
+ds_surface_add_cache_listener(struct ds_surface *surface,
+        struct wl_listener *listener)
+{
+    wl_signal_add(&surface->events.cache, listener);
+}
+
+WL_EXPORT void
 ds_surface_add_new_subsurface_listener(struct ds_surface *surface,
         struct wl_listener *listener)
 {
@@ -236,6 +243,7 @@ create_surface(struct wl_client *client, uint32_t version, uint32_t id)
     surface_state_init(&surface->pending);
 
     wl_signal_init(&surface->events.commit);
+    wl_signal_init(&surface->events.cache);
     wl_signal_init(&surface->events.destroy);
     wl_signal_init(&surface->events.new_subsurface);