1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 09:27:59 +00:00
putty-source/unix/uxpterm.c
Simon Tatham 42ad454f4f 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.
2021-02-07 19:59:20 +00:00

51 lines
1.2 KiB
C

/*
* pterm main program.
*/
#include <stdio.h>
#include <stdlib.h>
#include "putty.h"
const char *const appname = "pterm";
const bool use_event_log = false; /* pterm doesn't need it */
const bool new_session = false, saved_sessions = false; /* or these */
const bool dup_check_launchable = false; /* no need to check host name
* in conf */
const bool use_pty_argv = true;
const unsigned cmdline_tooltype = TOOLTYPE_NONNETWORK;
/* gtkwin.c will call this, and in pterm it's not needed */
void noise_ultralight(NoiseSourceId id, unsigned long data) { }
const struct BackendVtable *select_backend(Conf *conf)
{
return &pty_backend;
}
void initial_config_box(Conf *conf, post_dialog_fn_t after, void *afterctx)
{
/*
* This is a no-op in pterm, except that we'll ensure the protocol
* is set to -1 to inhibit the useless Connection panel in the
* config box. So we do that and then just immediately call the
* post-dialog function with a positive result.
*/
conf_set_int(conf, CONF_protocol, -1);
after(afterctx, 1);
}
void cleanup_exit(int code)
{
exit(code);
}
void setup(bool single)
{
settings_set_default_protocol(-1);
if (single)
pty_pre_init();
}