diff options
author | Kenny Levinsen <kl@kl.wtf> | 2021-02-19 18:33:20 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-02-23 00:17:32 +0100 |
commit | 1a6471be172fc2da75bbc5b7e6e3b3c99dbafc51 (patch) | |
tree | e0df8a62fe2034f6e54fba645d897d94ef04b9e4 /sway/tree/view.c | |
parent | view: Mark subchildren as unmapped in view_child_destroy (diff) | |
download | sway-1a6471be172fc2da75bbc5b7e6e3b3c99dbafc51.tar.gz sway-1a6471be172fc2da75bbc5b7e6e3b3c99dbafc51.tar.zst sway-1a6471be172fc2da75bbc5b7e6e3b3c99dbafc51.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
Diffstat (limited to 'sway/tree/view.c')
-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 978271c2..8a2a8178 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -465,6 +465,9 @@ static void view_subsurface_create(struct sway_view *view, | |||
465 | static void view_init_subsurfaces(struct sway_view *view, | 465 | static void view_init_subsurfaces(struct sway_view *view, |
466 | struct wlr_surface *surface); | 466 | struct wlr_surface *surface); |
467 | 467 | ||
468 | static void view_child_init_subsurfaces(struct sway_view_child *view_child, | ||
469 | struct wlr_surface *surface); | ||
470 | |||
468 | static void view_handle_surface_new_subsurface(struct wl_listener *listener, | 471 | static void view_handle_surface_new_subsurface(struct wl_listener *listener, |
469 | void *data) { | 472 | void *data) { |
470 | struct sway_view *view = | 473 | struct sway_view *view = |
@@ -1033,6 +1036,14 @@ static void view_init_subsurfaces(struct sway_view *view, | |||
1033 | } | 1036 | } |
1034 | } | 1037 | } |
1035 | 1038 | ||
1039 | static void view_child_init_subsurfaces(struct sway_view_child *view_child, | ||
1040 | struct wlr_surface *surface) { | ||
1041 | struct wlr_subsurface *subsurface; | ||
1042 | wl_list_for_each(subsurface, &surface->subsurfaces, parent_link) { | ||
1043 | view_child_subsurface_create(view_child, subsurface); | ||
1044 | } | ||
1045 | } | ||
1046 | |||
1036 | static void view_child_handle_surface_map(struct wl_listener *listener, | 1047 | static void view_child_handle_surface_map(struct wl_listener *listener, |
1037 | void *data) { | 1048 | void *data) { |
1038 | struct sway_view_child *child = | 1049 | struct sway_view_child *child = |
@@ -1088,7 +1099,7 @@ void view_child_init(struct sway_view_child *child, | |||
1088 | wlr_surface_send_enter(child->surface, workspace->output->wlr_output); | 1099 | wlr_surface_send_enter(child->surface, workspace->output->wlr_output); |
1089 | } | 1100 | } |
1090 | 1101 | ||
1091 | view_init_subsurfaces(child->view, surface); | 1102 | view_child_init_subsurfaces(child, surface); |
1092 | } | 1103 | } |
1093 | 1104 | ||
1094 | void view_child_destroy(struct sway_view_child *child) { | 1105 | void view_child_destroy(struct sway_view_child *child) { |