From d5d5eefa5fb33fbde5dbc9551787d744851b56e1 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 23 Nov 2024 11:17:07 +0000 Subject: [PATCH] Re-fix retention of window border on maximise. The fix in commit 31ab5b8e3083d66 was incomplete. It works when you maximise the window by pressing the maximise button in the title bar, but not when you drag the window to the very top of the screen. In the latter case, the resize at the instant of maximisation works right, but then we get a WM_EXITSIZEMOVE when the drag is released, triggering one final resize which ignored the window border again. That was because wm_size_resize_term() was being given a flag on purpose telling it to ignore the border: apparently at some point in the past, ignoring the border for even a normally maximised window (not even full-screen) was done on purpose. But for the reasons in the previous commit, I'm changing that. --- windows/window.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/windows/window.c b/windows/window.c index edb3322c..dbe565c7 100644 --- a/windows/window.c +++ b/windows/window.c @@ -2201,11 +2201,11 @@ static void free_hdc(WinGuiSeat *wgs, HDC hdc) ReleaseDC(wgs->term_hwnd, hdc); } -static void wm_size_resize_term(WinGuiSeat *wgs, LPARAM lParam, bool border) +static void wm_size_resize_term(WinGuiSeat *wgs, LPARAM lParam) { int width = LOWORD(lParam); int height = HIWORD(lParam); - int border_size = border ? conf_get_int(wgs->conf, CONF_window_border) : 0; + int border_size = conf_get_int(wgs->conf, CONF_window_border); int w = (width - border_size*2) / wgs->font_width; int h = (height - border_size*2) / wgs->font_height; @@ -3129,12 +3129,12 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, wgs->prev_rows = wgs->term->rows; wgs->prev_cols = wgs->term->cols; if (resize_action == RESIZE_TERM) - wm_size_resize_term(wgs, lParam, false); + wm_size_resize_term(wgs, lParam); reset_window(wgs, 0); } else if (wParam == SIZE_RESTORED && wgs->was_zoomed) { wgs->was_zoomed = false; if (resize_action == RESIZE_TERM) { - wm_size_resize_term(wgs, lParam, true); + wm_size_resize_term(wgs, lParam); reset_window(wgs, 2); } else if (resize_action != RESIZE_FONT) reset_window(wgs, 2); @@ -3145,7 +3145,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, } else if (resize_action == RESIZE_TERM || (resize_action == RESIZE_EITHER && !is_alt_pressed())) { - wm_size_resize_term(wgs, lParam, true); + wm_size_resize_term(wgs, lParam); /* * Sometimes, we can get a spontaneous resize event