1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12: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:
Simon Tatham
2022-05-12 18:16:56 +01:00
parent de66b0313a
commit 4da67d8fa6
5 changed files with 58 additions and 57 deletions

12
putty.h
View File

@ -1636,6 +1636,17 @@ struct TermWinVtable {
void (*refresh)(TermWin *);
/* request_resize asks the front end if the terminal can please be
* resized to (w,h) in characters. The front end MAY call
* term_size() in response to tell the terminal its new size
* (which MAY be the requested size, or some other size if the
* requested one can't be achieved). The front end MAY also not
* call term_size() at all. But the front end MUST reply to this
* request by calling term_resize_request_completed(), after the
* responding resize event has taken place (if any).
*
* The calls to term_size and term_resize_request_completed may be
* synchronous callbacks from within the call to request_resize(). */
void (*request_resize)(TermWin *, int w, int h);
void (*set_title)(TermWin *, const char *title, int codepage);
@ -2133,6 +2144,7 @@ FontSpec *platform_default_fontspec(const char *name);
Terminal *term_init(Conf *, struct unicode_data *, TermWin *);
void term_free(Terminal *);
void term_size(Terminal *, int, int, int);
void term_resize_request_completed(Terminal *);
void term_paint(Terminal *, int, int, int, int, bool);
void term_scroll(Terminal *, int, int);
void term_scroll_to_selection(Terminal *, int);