mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
42ad454f4f
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.
93 lines
2.0 KiB
C
93 lines
2.0 KiB
C
/*
|
|
* Unix PuTTY main program.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
#include <stdlib.h>
|
|
#include <assert.h>
|
|
#include <unistd.h>
|
|
#include <gtk/gtk.h>
|
|
#include <gdk/gdk.h>
|
|
|
|
#define MAY_REFER_TO_GTK_IN_HEADERS
|
|
|
|
#include "putty.h"
|
|
#include "ssh.h"
|
|
#include "storage.h"
|
|
|
|
#include "gtkcompat.h"
|
|
|
|
/*
|
|
* Stubs to avoid uxpty.c needing to be linked in.
|
|
*/
|
|
const bool use_pty_argv = false;
|
|
char **pty_argv; /* never used */
|
|
char *pty_osx_envrestore_prefix;
|
|
|
|
/*
|
|
* Clean up and exit.
|
|
*/
|
|
void cleanup_exit(int code)
|
|
{
|
|
/*
|
|
* Clean up.
|
|
*/
|
|
sk_cleanup();
|
|
random_save_seed();
|
|
exit(code);
|
|
}
|
|
|
|
const struct BackendVtable *select_backend(Conf *conf)
|
|
{
|
|
const struct BackendVtable *vt =
|
|
backend_vt_from_proto(conf_get_int(conf, CONF_protocol));
|
|
assert(vt != NULL);
|
|
return vt;
|
|
}
|
|
|
|
void initial_config_box(Conf *conf, post_dialog_fn_t after, void *afterctx)
|
|
{
|
|
char *title = dupcat(appname, " Configuration");
|
|
create_config_box(title, conf, false, 0, after, afterctx);
|
|
sfree(title);
|
|
}
|
|
|
|
const bool use_event_log = true, new_session = true, saved_sessions = true;
|
|
const bool dup_check_launchable = true;
|
|
|
|
/*
|
|
* X11-forwarding-related things suitable for Gtk app.
|
|
*/
|
|
|
|
char *platform_get_x_display(void) {
|
|
const char *display;
|
|
/* Try to take account of --display and what have you. */
|
|
if (!(display = gdk_get_display()))
|
|
/* fall back to traditional method */
|
|
display = getenv("DISPLAY");
|
|
return dupstr(display);
|
|
}
|
|
|
|
const bool share_can_be_downstream = true;
|
|
const bool share_can_be_upstream = true;
|
|
|
|
const unsigned cmdline_tooltype =
|
|
TOOLTYPE_HOST_ARG |
|
|
TOOLTYPE_PORT_ARG |
|
|
TOOLTYPE_NO_VERBOSE_OPTION;
|
|
|
|
void setup(bool single)
|
|
{
|
|
sk_init();
|
|
settings_set_default_protocol(be_default_protocol);
|
|
/* Find the appropriate default port. */
|
|
{
|
|
const struct BackendVtable *vt =
|
|
backend_vt_from_proto(be_default_protocol);
|
|
settings_set_default_port(0); /* illegal */
|
|
if (vt)
|
|
settings_set_default_port(vt->default_port);
|
|
}
|
|
}
|