mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Move window resize timeouts into the GTK frontend.
In the changes around commit 420fe75552
, I made the terminal
suspend output processing while it waited for a term_size() callback
in response to a resize request. Because on X11 there are unusual
circumstances in which you never receive that callback, I also added a
last-ditch 5-second timeout, so that eventually we'll resume terminal
output processing regardless.
But the timeout lives in terminal.c, in the cross-platform code. This
is pointless on Windows (where resize processing is synchronous, so we
always finish it before the timer code next gets called anyway), but I
decided it was easier to keep the whole mechanism in terminal.c in the
absence of a good reason not to.
Now I've found that reason. We _also_ generate window resizes locally
to the GTK front end, in response to the key combinations that change
the font size, and _those_ still have an asynchrony problem.
So, to begin with, I'm refactoring the request_resize system so that
now there's an explicit callback from the frontend to the terminal to
say 'Your resize request has now been processed, whether or not you've
received a term_size() call'. On Windows, this simplifies matters
greatly because we always know exactly when to call that, and don't
have to keep a 'have we called term_size() already?' flag. On GTK, the
timing complexity previously in terminal.c has moved into window.c.
No functional change (I hope). The payoff will be in the next commit.
This commit is contained in:
@ -1667,8 +1667,6 @@ static void deinit_fonts(void)
|
||||
trust_icon = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
static bool sent_term_size; /* only live during wintw_request_resize() */
|
||||
|
||||
static void wintw_request_resize(TermWin *tw, int w, int h)
|
||||
{
|
||||
const struct BackendVtable *vt;
|
||||
@ -1716,28 +1714,12 @@ static void wintw_request_resize(TermWin *tw, int w, int h)
|
||||
|
||||
if (conf_get_int(conf, CONF_resize_action) != RESIZE_FONT &&
|
||||
!IsZoomed(wgs.term_hwnd)) {
|
||||
/*
|
||||
* We want to send exactly one term_size() to the terminal,
|
||||
* telling it what size it ended up after this operation.
|
||||
*
|
||||
* If we don't get the size we asked for in SetWindowPos, then
|
||||
* we'll be sent a WM_SIZE message, whose handler will make
|
||||
* that call, all before SetWindowPos even returns to here.
|
||||
*
|
||||
* But if that _didn't_ happen, we'll need to call term_size
|
||||
* ourselves afterwards.
|
||||
*/
|
||||
sent_term_size = false;
|
||||
|
||||
width = extra_width + font_width * w;
|
||||
height = extra_height + font_height * h;
|
||||
|
||||
SetWindowPos(wgs.term_hwnd, NULL, 0, 0, width, height,
|
||||
SWP_NOACTIVATE | SWP_NOCOPYBITS |
|
||||
SWP_NOMOVE | SWP_NOZORDER);
|
||||
|
||||
if (!sent_term_size)
|
||||
term_size(term, h, w, conf_get_int(conf, CONF_savelines));
|
||||
} else {
|
||||
/*
|
||||
* If we're resizing by changing the font, we must tell the
|
||||
@ -1748,6 +1730,7 @@ static void wintw_request_resize(TermWin *tw, int w, int h)
|
||||
reset_window(0);
|
||||
}
|
||||
|
||||
term_resize_request_completed(term);
|
||||
InvalidateRect(wgs.term_hwnd, NULL, true);
|
||||
}
|
||||
|
||||
@ -2188,11 +2171,6 @@ static void wm_size_resize_term(LPARAM lParam, bool border)
|
||||
} else {
|
||||
term_size(term, h, w,
|
||||
conf_get_int(conf, CONF_savelines));
|
||||
/* If this is happening re-entrantly during the call to
|
||||
* SetWindowPos in wintw_request_resize, let it know that
|
||||
* we've already done a term_size() so that it doesn't have
|
||||
* to. */
|
||||
sent_term_size = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user