diff options
author | 2023-10-29 18:59:25 +0300 | |
---|---|---|
committer | 2023-10-29 17:21:18 +0100 | |
commit | f2425b4fd64314394aa962cee12b617fb7e5b10f (patch) | |
tree | 3c7196749c4baf874bdd5aacac548adfa84f64ae | |
parent | xdg_shell: don't update wlr_toplevel if the container has no size yet (diff) | |
download | sway-f2425b4fd64314394aa962cee12b617fb7e5b10f.tar.gz sway-f2425b4fd64314394aa962cee12b617fb7e5b10f.tar.zst sway-f2425b4fd64314394aa962cee12b617fb7e5b10f.zip |
xdg-shell: send maximized if tiled isn't supported
wlroots doesn't do it automatically anymore.
-rw-r--r-- | sway/desktop/xdg_shell.c | 17 |
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) { | |||
169 | if (xdg_shell_view_from_view(view) == NULL) { | 169 | if (xdg_shell_view_from_view(view) == NULL) { |
170 | return; | 170 | return; |
171 | } | 171 | } |
172 | enum wlr_edges edges = WLR_EDGE_NONE; | 172 | if (wl_resource_get_version(view->wlr_xdg_toplevel->resource) >= |
173 | if (tiled) { | 173 | XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) { |
174 | edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | | 174 | enum wlr_edges edges = WLR_EDGE_NONE; |
175 | WLR_EDGE_BOTTOM; | 175 | if (tiled) { |
176 | edges = WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | | ||
177 | WLR_EDGE_BOTTOM; | ||
178 | } | ||
179 | wlr_xdg_toplevel_set_tiled(view->wlr_xdg_toplevel, edges); | ||
180 | } else { | ||
181 | // The version is too low for the tiled state; configure as maximized instead | ||
182 | // to stop the client from drawing decorations outside of the toplevel geometry. | ||
183 | wlr_xdg_toplevel_set_maximized(view->wlr_xdg_toplevel, tiled); | ||
176 | } | 184 | } |
177 | wlr_xdg_toplevel_set_tiled(view->wlr_xdg_toplevel, edges); | ||
178 | } | 185 | } |
179 | 186 | ||
180 | static void set_fullscreen(struct sway_view *view, bool fullscreen) { | 187 | static void set_fullscreen(struct sway_view *view, bool fullscreen) { |