From baf35a89f1ba2d2e78ecb27c98f078479ce03d63 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 4 Dec 2023 15:39:08 +0100 Subject: [PATCH] surface: add WLR_SURFACE_STATE_SUBSURFACES This allows to figure out when the subsurface list has changed: subsurface added or re-ordered. In the case where the subsurface list hasn't changed, some book-keeping operations can be skipped. --- include/wlr/types/wlr_compositor.h | 1 + types/wlr_subcompositor.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index da12427e5..f10eeed9f 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -29,6 +29,7 @@ enum wlr_surface_state_field { WLR_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7, WLR_SURFACE_STATE_VIEWPORT = 1 << 8, WLR_SURFACE_STATE_OFFSET = 1 << 9, + WLR_SURFACE_STATE_SUBSURFACES = 1 << 10, // sub-surface added or re-ordered }; struct wlr_surface_state { diff --git a/types/wlr_subcompositor.c b/types/wlr_subcompositor.c index 07ff2b277..492f27ea3 100644 --- a/types/wlr_subcompositor.c +++ b/types/wlr_subcompositor.c @@ -116,6 +116,7 @@ static void subsurface_handle_place_above(struct wl_client *client, node = &sibling->pending.link; } + subsurface->parent->pending.committed |= WLR_SURFACE_STATE_SUBSURFACES; wl_list_remove(&subsurface->pending.link); wl_list_insert(node, &subsurface->pending.link); @@ -148,6 +149,7 @@ static void subsurface_handle_place_below(struct wl_client *client, node = &sibling->pending.link; } + subsurface->parent->pending.committed |= WLR_SURFACE_STATE_SUBSURFACES; wl_list_remove(&subsurface->pending.link); wl_list_insert(node->prev, &subsurface->pending.link); @@ -410,6 +412,7 @@ static void subcompositor_handle_get_subsurface(struct wl_client *client, wl_signal_add(&parent->events.destroy, &subsurface->parent_destroy); subsurface->parent_destroy.notify = subsurface_handle_parent_destroy; + subsurface->parent->pending.committed |= WLR_SURFACE_STATE_SUBSURFACES; wl_list_remove(&subsurface->pending.link); wl_list_insert(parent->pending.subsurfaces_above.prev, &subsurface->pending.link);