aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@posteo.net>2021-12-06 14:59:00 +0300
committerSimon Ser <contact@emersion.fr>2021-12-09 18:26:56 +0000
commit0fcc842291d9d714e9c210839ae72429c5c3eae4 (patch)
tree97642cedc61822c08a5e912bd898da994972edbe
parent7964bdae760a5417fe18cd893f91bd85c7123173 (diff)
subsurface: don't add to parent list immediately
-rw-r--r--include/wlr/types/wlr_surface.h1
-rw-r--r--types/wlr_surface.c15
2 files changed, 11 insertions, 5 deletions
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index 4255a1f2..59168eaa 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -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;
diff --git a/types/wlr_surface.c b/types/wlr_surface.c
index 42b75f96..d5d49571 100644
--- a/types/wlr_surface.c
+++ b/types/wlr_surface.c
@@ -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;
}