diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 9331e8af6..31816f64e 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -30,6 +30,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/scene/subsurface_tree.c b/types/scene/subsurface_tree.c index 4e0a3f999..2e788d1cf 100644 --- a/types/scene/subsurface_tree.c +++ b/types/scene/subsurface_tree.c @@ -159,8 +159,10 @@ static void subsurface_tree_handle_surface_commit(struct wl_listener *listener, struct wlr_scene_subsurface_tree *subsurface_tree = wl_container_of(listener, subsurface_tree, surface_commit); - // TODO: only do this on subsurface order or position change - subsurface_tree_reconfigure(subsurface_tree); + // TODO: also need to do this on sub-surface position change + if (subsurface_tree->surface->current.committed & WLR_SURFACE_STATE_SUBSURFACES) { + subsurface_tree_reconfigure(subsurface_tree); + } } static void subsurface_tree_handle_subsurface_destroy(struct wl_listener *listener, diff --git a/types/wlr_subcompositor.c b/types/wlr_subcompositor.c index 062fa69b8..af48f8913 100644 --- a/types/wlr_subcompositor.c +++ b/types/wlr_subcompositor.c @@ -118,6 +118,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); } @@ -380,6 +382,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);