aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2023-10-29 18:59:25 +0300
committerSimon Ser <contact@emersion.fr>2023-10-29 17:21:18 +0100
commitf2425b4fd64314394aa962cee12b617fb7e5b10f (patch)
tree3c7196749c4baf874bdd5aacac548adfa84f64ae
parent647521244a99f7dbda8fa7c21d7eee781692dc22 (diff)
xdg-shell: send maximized if tiled isn't supported
wlroots doesn't do it automatically anymore.
-rw-r--r--sway/desktop/xdg_shell.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 7c01bf16..4c59b42a 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -169,12 +169,19 @@ static void set_tiled(struct sway_view *view, bool tiled) {
if (xdg_shell_view_from_view(view) == NULL) {
return;
}
- enum wlr_edges edges = WLR_EDGE_NONE;
- if (tiled) {
- edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP |
- WLR_EDGE_BOTTOM;
+ if (wl_resource_get_version(view->wlr_xdg_toplevel->resource) >=
+ XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) {
+ enum wlr_edges edges = WLR_EDGE_NONE;
+ if (tiled) {
+ edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP |
+ WLR_EDGE_BOTTOM;
+ }
+ wlr_xdg_toplevel_set_tiled(view->wlr_xdg_toplevel, edges);
+ } else {
+ // The version is too low for the tiled state; configure as maximized instead
+ // to stop the client from drawing decorations outside of the toplevel geometry.
+ wlr_xdg_toplevel_set_maximized(view->wlr_xdg_toplevel, tiled);
}
- wlr_xdg_toplevel_set_tiled(view->wlr_xdg_toplevel, edges);
}
static void set_fullscreen(struct sway_view *view, bool fullscreen) {