summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2021-02-19 18:33:20 +0100
committerSimon Ser <contact@emersion.fr>2021-05-19 11:48:08 +0200
commit0a70675d9c72b77ba7a5d7c76aa8b5c87627f99c (patch)
treea76cdac7dd2c93aa878fc859466064e4571a92fb
parentec1c8143b067772f2bdc2592ad28ef6da37af36b (diff)
view: Set parent for view_child subsurfaces on init
view_child_init was calling view_init_subsurfaces, which did not set the parent attribute for the subchildren. This lead to the subchildren acting as standalone children. If the parent was an xdg_popup, this would make the subchild unaware of the popup position. Introduce view_child_init_subsurfaces for view_child_init to use instead. Closes: https://github.com/swaywm/sway/issues/6038 (cherry picked from commit 1a6471be172fc2da75bbc5b7e6e3b3c99dbafc51)
-rw-r--r--sway/tree/view.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index e8e8580af..40fe7b576 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -464,6 +464,9 @@ static void view_subsurface_create(struct sway_view *view,
static void view_init_subsurfaces(struct sway_view *view,
struct wlr_surface *surface);
+static void view_child_init_subsurfaces(struct sway_view_child *view_child,
+ struct wlr_surface *surface);
+
static void view_handle_surface_new_subsurface(struct wl_listener *listener,
void *data) {
struct sway_view *view =
@@ -957,6 +960,14 @@ static void view_init_subsurfaces(struct sway_view *view,
}
}
+static void view_child_init_subsurfaces(struct sway_view_child *view_child,
+ struct wlr_surface *surface) {
+ struct wlr_subsurface *subsurface;
+ wl_list_for_each(subsurface, &surface->subsurfaces, parent_link) {
+ view_child_subsurface_create(view_child, subsurface);
+ }
+}
+
static void view_child_handle_surface_map(struct wl_listener *listener,
void *data) {
struct sway_view_child *child =
@@ -1012,7 +1023,7 @@ void view_child_init(struct sway_view_child *child,
wlr_surface_send_enter(child->surface, workspace->output->wlr_output);
}
- view_init_subsurfaces(child->view, surface);
+ view_child_init_subsurfaces(child, surface);
}
void view_child_destroy(struct sway_view_child *child) {