mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-31 22:25:21 -04:00
surface: add WLR_SURFACE_STATE_SUBSURFACES
This allows to figure out when the subsurface list has changed: subsurface added, removed, or re-ordered. In the case where the subsurface list hasn't changed, some book-keeping operations can be skipped.
This commit is contained in:
parent
610f0c0805
commit
0da7eb18ea
2 changed files with 5 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ enum wlr_surface_state_field {
|
|||
WLR_SURFACE_STATE_SCALE = 1 << 6,
|
||||
WLR_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7,
|
||||
WLR_SURFACE_STATE_VIEWPORT = 1 << 8,
|
||||
WLR_SURFACE_STATE_SUBSURFACES = 1 << 9,
|
||||
};
|
||||
|
||||
struct wlr_surface_state {
|
||||
|
|
|
|||
|
|
@ -698,6 +698,7 @@ static void subsurface_destroy(struct wlr_subsurface *subsurface) {
|
|||
wl_list_remove(&subsurface->surface_destroy.link);
|
||||
|
||||
if (subsurface->parent) {
|
||||
subsurface->parent->pending.committed |= WLR_SURFACE_STATE_SUBSURFACES;
|
||||
wl_list_remove(&subsurface->current.link);
|
||||
wl_list_remove(&subsurface->pending.link);
|
||||
wl_list_remove(&subsurface->parent_destroy.link);
|
||||
|
|
@ -947,6 +948,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);
|
||||
|
||||
|
|
@ -979,6 +981,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);
|
||||
|
||||
|
|
@ -1190,6 +1193,7 @@ struct wlr_subsurface *subsurface_create(struct wlr_surface *surface,
|
|||
|
||||
// link parent
|
||||
subsurface->parent = parent;
|
||||
subsurface->parent->pending.committed |= WLR_SURFACE_STATE_SUBSURFACES;
|
||||
wl_signal_add(&parent->events.destroy, &subsurface->parent_destroy);
|
||||
subsurface->parent_destroy.notify = subsurface_handle_parent_destroy;
|
||||
wl_list_insert(parent->current.subsurfaces_above.prev, &subsurface->current.link);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue