mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Move all window-title management into Terminal.
Previously, window title management happened in a bipartisan sort of way: front ends would choose their initial window title once they knew what host name they were connecting to, but then Terminal would override that later if the server set the window title by escape sequences. Now it's all done the same way round: the Terminal object is always where titles are invented, and they only propagate in one direction, from the Terminal to the TermWin. This allows us to avoid duplicating in multiple front ends the logic for what the initial window title should be. The frontend just has to make one initial call to term_setup_window_titles, to tell the terminal what hostname should go in the default title (if the Conf doesn't override even that). Thereafter, all it has to do is respond to the TermWin title-setting methods. Similarly, the logic that handles window-title changes as a result of the Change Settings dialog is also centralised into terminal.c. This involved introducing an extra term_pre_reconfig() call that each frontend can call to modify the Conf that will be used for the GUI configurer; that's where the code now lives that copies the current window title into there. (This also means that GTK PuTTY now behaves consistently with Windows PuTTY on that point; GTK's previous behaviour was less well thought out.) It also means there's no longer any need for Terminal to talk to the front end when a remote query wants to _find out_ the window title: the Terminal knows the answer already. So TermWin's get_title method can go.
This commit is contained in:
5
putty.h
5
putty.h
@ -1149,7 +1149,6 @@ struct TermWinVtable {
|
||||
|
||||
void (*get_pos)(TermWin *, int *x, int *y);
|
||||
void (*get_pixels)(TermWin *, int *x, int *y);
|
||||
const char *(*get_title)(TermWin *, bool icon);
|
||||
};
|
||||
|
||||
static inline bool win_setup_draw_ctx(TermWin *win)
|
||||
@ -1210,8 +1209,6 @@ static inline void win_get_pos(TermWin *win, int *x, int *y)
|
||||
{ win->vt->get_pos(win, x, y); }
|
||||
static inline void win_get_pixels(TermWin *win, int *x, int *y)
|
||||
{ win->vt->get_pixels(win, x, y); }
|
||||
static inline const char *win_get_title(TermWin *win, bool icon)
|
||||
{ return win->vt->get_title(win, icon); }
|
||||
|
||||
/*
|
||||
* Global functions not specific to a connection instance.
|
||||
@ -1625,6 +1622,7 @@ void term_blink(Terminal *, bool set_cursor);
|
||||
void term_do_paste(Terminal *, const wchar_t *, int);
|
||||
void term_nopaste(Terminal *);
|
||||
void term_copyall(Terminal *, const int *, int);
|
||||
void term_pre_reconfig(Terminal *, Conf *);
|
||||
void term_reconfig(Terminal *, Conf *);
|
||||
void term_request_copy(Terminal *, const int *clipboards, int n_clipboards);
|
||||
void term_request_paste(Terminal *, int clipboard);
|
||||
@ -1639,6 +1637,7 @@ void term_set_trust_status(Terminal *term, bool trusted);
|
||||
void term_keyinput(Terminal *, int codepage, const void *buf, int len);
|
||||
void term_keyinputw(Terminal *, const wchar_t * widebuf, int len);
|
||||
void term_get_cursor_position(Terminal *term, int *x, int *y);
|
||||
void term_setup_window_titles(Terminal *term, const char *title_hostname);
|
||||
|
||||
typedef enum SmallKeypadKey {
|
||||
SKK_HOME, SKK_END, SKK_INSERT, SKK_DELETE, SKK_PGUP, SKK_PGDN,
|
||||
|
Reference in New Issue
Block a user