summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@posteo.net>2021-11-13 09:08:14 +0300
committerSimon Ser <contact@emersion.fr>2021-11-15 10:12:23 +0100
commitcbecc5cbaed6b30c995d2c245def458e383b4e38 (patch)
treeb630bf0dce0ea646989bbe0f6000cece30dbd961
parentbb7bb3676deead149c66fbf74b55d3bb4f9d69b5 (diff)
container: fix surface_is_popup()
-rw-r--r--sway/tree/container.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 6a01eab38..943d3d531 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -382,19 +382,17 @@ struct sway_container *tiling_container_at(struct sway_node *parent,
}
static bool surface_is_popup(struct wlr_surface *surface) {
- if (wlr_surface_is_xdg_surface(surface)) {
- struct wlr_xdg_surface *xdg_surface =
- wlr_xdg_surface_from_wlr_surface(surface);
- while (xdg_surface && xdg_surface->role != WLR_XDG_SURFACE_ROLE_NONE) {
- if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
- return true;
- }
- xdg_surface = xdg_surface->toplevel->parent;
+ while (!wlr_surface_is_xdg_surface(surface)) {
+ if (!wlr_surface_is_subsurface(surface)) {
+ return false;
}
- return false;
+ struct wlr_subsurface *subsurface =
+ wlr_subsurface_from_wlr_surface(surface);
+ surface = subsurface->parent;
}
-
- return false;
+ struct wlr_xdg_surface *xdg_surface =
+ wlr_xdg_surface_from_wlr_surface(surface);
+ return xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP;
}
struct sway_container *container_at(struct sway_workspace *workspace,