aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-11-29 17:35:22 +0100
committerSimon Ser <contact@emersion.fr>2022-12-05 10:51:46 +0100
commit512deebd82ce200305869a706a3cb046d7077eb3 (patch)
tree0b2146dcc91f18af47e86b44262a6e1278507802
parentbb0fd29252a9b4eb91358c30e8fd393a27d52d4d (diff)
compositor: add wlr_surface.events.precommit
-rw-r--r--include/wlr/types/wlr_compositor.h1
-rw-r--r--types/wlr_compositor.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index 55d83fe8..75d6605f 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -140,6 +140,7 @@ struct wlr_surface {
struct {
struct wl_signal client_commit;
+ struct wl_signal precommit; // const struct wlr_surface_state *
struct wl_signal commit;
struct wl_signal new_subsurface;
struct wl_signal destroy;
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index 996a046d..83c98ffc 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -438,6 +438,8 @@ static void surface_commit_state(struct wlr_surface *surface,
surface->role->precommit(surface, next);
}
+ wl_signal_emit_mutable(&surface->events.precommit, next);
+
bool invalid_buffer = next->committed & WLR_SURFACE_STATE_BUFFER;
surface_update_damage(&surface->buffer_damage, &surface->current, next);
@@ -692,6 +694,7 @@ static struct wlr_surface *surface_create(struct wl_client *client,
surface->pending.seq = 1;
wl_signal_init(&surface->events.client_commit);
+ wl_signal_init(&surface->events.precommit);
wl_signal_init(&surface->events.commit);
wl_signal_init(&surface->events.destroy);
wl_signal_init(&surface->events.new_subsurface);