From ebd4a32768ba1e587fb884b58819605f4ef87c18 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 20 Oct 2020 20:58:03 +0200 Subject: wayland: properly restore window size when being un-tiled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bind to xdg-shell version 2 if available, as this enables us to track our window’s ‘tiled’ state in the ‘configure’ events. This in turn allows us to stash the ‘old’ window size when being tiled, to be used again when restoring the window size when un-tiled. --- render.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index a5df70f7..819a249b 100644 --- a/render.c +++ b/render.c @@ -2038,9 +2038,9 @@ maybe_resize(struct terminal *term, int width, int height, bool force) * If we have a "last" used size - use that. Otherwise, use * the size from the user configuration. */ - if (term->unmaximized_width != 0 && term->unmaximized_height != 0) { - width = term->unmaximized_width; - height = term->unmaximized_height; + if (term->stashed_width != 0 && term->stashed_height != 0) { + width = term->stashed_width; + height = term->stashed_height; } else { switch (term->conf->size.type) { case CONF_SIZE_PX: @@ -2193,9 +2193,14 @@ maybe_resize(struct terminal *term, int width, int height, bool force) term->render.last_cursor.row = NULL; damage_view: - if (!term->window->is_maximized && !term->window->is_fullscreen) { - term->unmaximized_width = term->width; - term->unmaximized_height = term->height; + if (!term->window->is_maximized && + !term->window->is_fullscreen && + !term->window->is_tiled) + { + /* Stash current size, to enable us to restore it when we're + * being un-maximized/fullscreened/tiled */ + term->stashed_width = term->width; + term->stashed_height = term->height; } #if 0 -- cgit v1.3