subsurface: don't add to parent list immediately

master
Kirill Primak 3 years ago committed by Simon Ser
parent 7964bdae76
commit 0fcc842291

@ -185,6 +185,7 @@ struct wlr_subsurface {
bool synchronized;
bool reordered;
bool mapped;
bool added;
struct wl_listener surface_destroy;
struct wl_listener parent_destroy;

@ -511,6 +511,12 @@ static void subsurface_parent_commit(struct wlr_subsurface *subsurface) {
wlr_surface_for_each_surface(surface,
collect_subsurface_damage_iter, subsurface);
}
if (!subsurface->added) {
subsurface->added = true;
wlr_signal_emit_safe(&subsurface->parent->events.new_subsurface,
subsurface);
}
}
static void subsurface_commit(struct wlr_subsurface *subsurface) {
@ -877,12 +883,12 @@ static struct wlr_subsurface *subsurface_find_sibling(
struct wlr_surface *parent = subsurface->parent;
struct wlr_subsurface *sibling;
wl_list_for_each(sibling, &parent->current.subsurfaces_below, current.link) {
wl_list_for_each(sibling, &parent->pending.subsurfaces_below, pending.link) {
if (sibling->surface == surface && sibling != subsurface) {
return sibling;
}
}
wl_list_for_each(sibling, &parent->current.subsurfaces_above, current.link) {
wl_list_for_each(sibling, &parent->pending.subsurfaces_above, pending.link) {
if (sibling->surface == surface && sibling != subsurface) {
return sibling;
}
@ -1134,14 +1140,13 @@ struct wlr_subsurface *subsurface_create(struct wlr_surface *surface,
subsurface->parent = parent;
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);
wl_list_init(&subsurface->current.link);
wl_list_insert(parent->pending.subsurfaces_above.prev,
&subsurface->pending.link);
surface->role_data = subsurface;
wlr_signal_emit_safe(&parent->events.new_subsurface, subsurface);
return subsurface;
}

Loading…
Cancel
Save