mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
win_set_[icon_]title: send a codepage along with the string.
While fixing the previous commit I noticed that window titles don't actually _work_ properly if you change the terminal character set, because the text accumulated in the OSC string buffer is sent to the TermWin as raw bytes, with no indication of what character set it should interpret them as. You might get lucky if you happened to choose the right charset (in particular, UTF-8 is a common default), but if you change the charset half way through a run, then there's certainly no way the frontend will know to interpret two window titles sent before and after the change in two different charsets. So, now win_set_title() and win_set_icon_title() both include a codepage parameter along with the byte string, and it's up to them to translate the provided window title from that encoding to whatever the local window system expects to receive. On Windows, that's wide-string Unicode, so we can just use the existing dup_mb_to_wc utility function. But in GTK, it's UTF-8, so I had to write an extra utility function to encode a wide string as UTF-8.
This commit is contained in:
14
putty.h
14
putty.h
@ -1414,8 +1414,9 @@ struct TermWinVtable {
|
||||
|
||||
void (*request_resize)(TermWin *, int w, int h);
|
||||
|
||||
void (*set_title)(TermWin *, const char *title);
|
||||
void (*set_icon_title)(TermWin *, const char *icontitle);
|
||||
void (*set_title)(TermWin *, const char *title, int codepage);
|
||||
void (*set_icon_title)(TermWin *, const char *icontitle, int codepage);
|
||||
|
||||
/* set_minimised and set_maximised are assumed to set two
|
||||
* independent settings, rather than a single three-way
|
||||
* {min,normal,max} switch. The idea is that when you un-minimise
|
||||
@ -1480,10 +1481,11 @@ static inline void win_refresh(TermWin *win)
|
||||
{ win->vt->refresh(win); }
|
||||
static inline void win_request_resize(TermWin *win, int w, int h)
|
||||
{ win->vt->request_resize(win, w, h); }
|
||||
static inline void win_set_title(TermWin *win, const char *title)
|
||||
{ win->vt->set_title(win, title); }
|
||||
static inline void win_set_icon_title(TermWin *win, const char *icontitle)
|
||||
{ win->vt->set_icon_title(win, icontitle); }
|
||||
static inline void win_set_title(TermWin *win, const char *title, int codepage)
|
||||
{ win->vt->set_title(win, title, codepage); }
|
||||
static inline void win_set_icon_title(TermWin *win, const char *icontitle,
|
||||
int codepage)
|
||||
{ win->vt->set_icon_title(win, icontitle, codepage); }
|
||||
static inline void win_set_minimised(TermWin *win, bool minimised)
|
||||
{ win->vt->set_minimised(win, minimised); }
|
||||
static inline void win_set_maximised(TermWin *win, bool maximised)
|
||||
|
Reference in New Issue
Block a user