1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Windows: respect CONF_window_border when maximised.

The code in the 'if (IsZoomed)' statement in reset_window() was
failing to take account of the user-configured gap between the text
and the window edge, so that the requested border was lost. Now it
does take that into account.

In this commit, this change of behaviour applies to both a normally
maximised window (with the window frame still visible round the edge)
and to a full-screen window (nothing visible on the whole monitor
except PuTTY).

I'm not 100% sure whether that's the right behaviour: perhaps the
purpose of this configurable border is to space the text away from the
window furniture, so that there's no need for it if there isn't any
furniture? But on the other hand, one thing _I_ use this border for is
to make space round the edge of a terminal window for the green border
Zoom superimposes when sharing the window. And that's a use case that
would still make sense when the window is full-screened.
This commit is contained in:
Simon Tatham 2024-09-23 11:02:44 +01:00
parent 20a6274d24
commit 31ab5b8e30

View File

@ -1805,9 +1805,14 @@ static void reset_window(WinGuiSeat *wgs, int reinit)
if (resize_action != RESIZE_TERM) { if (resize_action != RESIZE_TERM) {
if (wgs->font_width != win_width/wgs->term->cols || if (wgs->font_width != win_width/wgs->term->cols ||
wgs->font_height != win_height/wgs->term->rows) { wgs->font_height != win_height/wgs->term->rows) {
int fw = (win_width - 2*window_border) / wgs->term->cols;
int fh = (win_height - 2*window_border) / wgs->term->rows;
/* In case that subtraction made the font size go
* negative in an edge case, bound it below by 1 */
if (fw < 1) fw = 1;
if (fh < 1) fh = 1;
deinit_fonts(wgs); deinit_fonts(wgs);
init_fonts(wgs, win_width/wgs->term->cols, init_fonts(wgs, fw, fh);
win_height/wgs->term->rows);
wgs->offset_width = wgs->offset_width =
(win_width - wgs->font_width*wgs->term->cols) / 2; (win_width - wgs->font_width*wgs->term->cols) / 2;
wgs->offset_height = wgs->offset_height =
@ -1824,13 +1829,14 @@ static void reset_window(WinGuiSeat *wgs, int reinit)
/* Our only choice at this point is to change the /* Our only choice at this point is to change the
* size of the terminal; Oh well. * size of the terminal; Oh well.
*/ */
term_size(wgs->term, win_height / wgs->font_height, term_size(wgs->term,
win_width / wgs->font_width, (win_height - 2*window_border) / wgs->font_height,
(win_width - 2*window_border) / wgs->font_width,
conf_get_int(wgs->conf, CONF_savelines)); conf_get_int(wgs->conf, CONF_savelines));
wgs->offset_width = wgs->offset_width =
(win_width - wgs->font_width*wgs->term->cols) / 2; (win_width - window_border - wgs->font_width*wgs->term->cols) / 2;
wgs->offset_height = wgs->offset_height =
(win_height - wgs->font_height*wgs->term->rows) / 2; (win_height - window_border - wgs->font_height*wgs->term->rows) / 2;
InvalidateRect(wgs->term_hwnd, NULL, true); InvalidateRect(wgs->term_hwnd, NULL, true);
#ifdef RDB_DEBUG_PATCH #ifdef RDB_DEBUG_PATCH
debug("reset_window() -> Zoomed term_size\n"); debug("reset_window() -> Zoomed term_size\n");