From 773b61eb79fec9966d5ccd01dccf35b02ff7a7b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 10 Jan 2021 15:41:01 +0100 Subject: [PATCH] wayland: force a resize on the final configure event after an interactive resize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is needed to apply content centering after an interactive resize, as otherwise we’d just ignore the last configure event since the only difference between that event and the next to last event is that the is-resizing bit has been cleared. I.e. the window size is identical to what we already have, and our resize code would thus ignore the event. --- wayland.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wayland.c b/wayland.c index cc648244..4e8a8ca8 100644 --- a/wayland.c +++ b/wayland.c @@ -644,6 +644,8 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, struct terminal *term = win->term; bool wasnt_configured = !win->is_configured; + bool was_resizing = win->is_resizing; + win->is_configured = true; win->is_maximized = win->configure.is_maximized; win->is_resizing = win->configure.is_resizing; @@ -675,8 +677,9 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, term->window->frame_callback = NULL; } - bool resized = render_resize( - term, win->configure.width, win->configure.height); + bool resized = was_resizing && !win->is_resizing + ? render_resize_force(term, win->configure.width, win->configure.height) + : render_resize(term, win->configure.width, win->configure.height); if (win->configure.is_activated) term_visual_focus_in(term);