diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-19 18:33:20 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-05-19 11:48:08 +0200 |
commit | 0a70675d9c72b77ba7a5d7c76aa8b5c87627f99c (patch) | |
tree | a76cdac7dd2c93aa878fc859466064e4571a92fb /sway | |
parent | view: Mark subchildren as unmapped in view_child_destroy (diff) | |
download | sway-0a70675d9c72b77ba7a5d7c76aa8b5c87627f99c.tar.gz sway-0a70675d9c72b77ba7a5d7c76aa8b5c87627f99c.tar.zst sway-0a70675d9c72b77ba7a5d7c76aa8b5c87627f99c.zip |
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)
Diffstat (limited to 'sway')
-rw-r--r-- | sway/tree/view.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index e8e8580a..40fe7b57 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -464,6 +464,9 @@ static void view_subsurface_create(struct sway_view *view, | |||
464 | static void view_init_subsurfaces(struct sway_view *view, | 464 | static void view_init_subsurfaces(struct sway_view *view, |
465 | struct wlr_surface *surface); | 465 | struct wlr_surface *surface); |
466 | 466 | ||
467 | static void view_child_init_subsurfaces(struct sway_view_child *view_child, | ||
468 | struct wlr_surface *surface); | ||
469 | |||
467 | static void view_handle_surface_new_subsurface(struct wl_listener *listener, | 470 | static void view_handle_surface_new_subsurface(struct wl_listener *listener, |
468 | void *data) { | 471 | void *data) { |
469 | struct sway_view *view = | 472 | struct sway_view *view = |
@@ -957,6 +960,14 @@ static void view_init_subsurfaces(struct sway_view *view, | |||
957 | } | 960 | } |
958 | } | 961 | } |
959 | 962 | ||
963 | static void view_child_init_subsurfaces(struct sway_view_child *view_child, | ||
964 | struct wlr_surface *surface) { | ||
965 | struct wlr_subsurface *subsurface; | ||
966 | wl_list_for_each(subsurface, &surface->subsurfaces, parent_link) { | ||
967 | view_child_subsurface_create(view_child, subsurface); | ||
968 | } | ||
969 | } | ||
970 | |||
960 | static void view_child_handle_surface_map(struct wl_listener *listener, | 971 | static void view_child_handle_surface_map(struct wl_listener *listener, |
961 | void *data) { | 972 | void *data) { |
962 | struct sway_view_child *child = | 973 | struct sway_view_child *child = |
@@ -1012,7 +1023,7 @@ void view_child_init(struct sway_view_child *child, | |||
1012 | wlr_surface_send_enter(child->surface, workspace->output->wlr_output); | 1023 | wlr_surface_send_enter(child->surface, workspace->output->wlr_output); |
1013 | } | 1024 | } |
1014 | 1025 | ||
1015 | view_init_subsurfaces(child->view, surface); | 1026 | view_child_init_subsurfaces(child, surface); |
1016 | } | 1027 | } |
1017 | 1028 | ||
1018 | void view_child_destroy(struct sway_view_child *child) { | 1029 | void view_child_destroy(struct sway_view_child *child) { |