From 0f9ecac3cb479135fc1649c23e94e3dd2fc624b5 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 18 Jun 2021 18:25:27 +0200 Subject: [PATCH] surface: add cache event --- include/wlr/types/wlr_surface.h | 6 ++++++ types/wlr_surface.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 72dc4b30a..09090e629 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -135,6 +135,12 @@ struct wlr_surface { struct { struct wl_signal commit; + /** + * Emitted when the pending state is cached. + * + * Can be used by surface extensions to tie their own state to commits. + */ + struct wl_signal cache; // struct wlr_surface_state * struct wl_signal new_subsurface; struct wl_signal destroy; } events; diff --git a/types/wlr_surface.c b/types/wlr_surface.c index abfcbf73b..b52d60c46 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -417,6 +417,8 @@ static void surface_cache_pending(struct wlr_surface *surface) { wl_list_insert(surface->cached.prev, &cached->cached_state_link); surface->pending.seq++; + + wlr_signal_emit_safe(&surface->events.cache, cached); } static void surface_commit_state(struct wlr_surface *surface, @@ -746,6 +748,7 @@ struct wlr_surface *surface_create(struct wl_client *client, surface->pending.seq = 1; 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); wl_list_init(&surface->subsurfaces_above);