2003-03-29 19:52:50 +00:00
|
|
|
/*
|
|
|
|
* pterm main program.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2003-04-01 18:10:25 +00:00
|
|
|
#include <stdlib.h>
|
2003-03-29 19:52:50 +00:00
|
|
|
|
|
|
|
#include "putty.h"
|
|
|
|
|
2003-04-05 16:05:00 +00:00
|
|
|
const char *const appname = "pterm";
|
2003-04-09 18:46:45 +00:00
|
|
|
const int use_event_log = 0; /* pterm doesn't need it */
|
2003-04-12 17:37:15 +00:00
|
|
|
const int new_session = 0, saved_sessions = 0; /* or these */
|
2016-03-27 13:10:06 +00:00
|
|
|
const int dup_check_launchable = 0; /* no need to check host name in conf */
|
2005-02-06 15:52:00 +00:00
|
|
|
const int use_pty_argv = TRUE;
|
2003-04-05 16:05:00 +00:00
|
|
|
|
2018-10-05 06:03:46 +00:00
|
|
|
const struct BackendVtable *select_backend(Conf *conf)
|
2003-03-29 19:52:50 +00:00
|
|
|
{
|
|
|
|
return &pty_backend;
|
|
|
|
}
|
|
|
|
|
Make the configuration dialog non-modal.
Now every call to do_config_box is replaced with a call to
create_config_box, which returns immediately having constructed the
new GTK window object, and is passed a callback function which it will
arrange to be called when the dialog terminates (whether by OK or by
Cancel). That callback is now what triggers the construction of a
session window after 'Open' is pressed in the initial config box, or
the actual mid-session reconfiguration action after 'Apply' is pressed
in a Change Settings box.
We were already prepared to ignore the re-selection of 'Change
Settings' from the context menu of a window that already had a Change
Settings box open (and not accidentally create a second config box for
the same window); but now we do slightly better, by finding the
existing config box and un-minimising and raising it, in case the user
had forgotten it was there.
That's a useful featurelet, but not the main purpose of this change.
The mani point, of course, is that now the multi-window GtkApplication
based front ends now don't do anything confusing to the nesting of
gtk_main() when config boxes are involved. Whether you're changing the
settings of one (or more than one) of your already-running sessions,
preparing to start up a new PuTTY connection, or both at once, we stay
in the same top-level instance of gtk_main() and all sessions' top-
level callbacks continue to run sensibly.
2017-11-26 11:58:02 +00:00
|
|
|
void initial_config_box(Conf *conf, post_dialog_fn_t after, void *afterctx)
|
2003-03-29 19:52:50 +00:00
|
|
|
{
|
2003-04-26 14:35:34 +00:00
|
|
|
/*
|
Make the configuration dialog non-modal.
Now every call to do_config_box is replaced with a call to
create_config_box, which returns immediately having constructed the
new GTK window object, and is passed a callback function which it will
arrange to be called when the dialog terminates (whether by OK or by
Cancel). That callback is now what triggers the construction of a
session window after 'Open' is pressed in the initial config box, or
the actual mid-session reconfiguration action after 'Apply' is pressed
in a Change Settings box.
We were already prepared to ignore the re-selection of 'Change
Settings' from the context menu of a window that already had a Change
Settings box open (and not accidentally create a second config box for
the same window); but now we do slightly better, by finding the
existing config box and un-minimising and raising it, in case the user
had forgotten it was there.
That's a useful featurelet, but not the main purpose of this change.
The mani point, of course, is that now the multi-window GtkApplication
based front ends now don't do anything confusing to the nesting of
gtk_main() when config boxes are involved. Whether you're changing the
settings of one (or more than one) of your already-running sessions,
preparing to start up a new PuTTY connection, or both at once, we stay
in the same top-level instance of gtk_main() and all sessions' top-
level callbacks continue to run sensibly.
2017-11-26 11:58:02 +00:00
|
|
|
* 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.
|
2003-04-26 14:35:34 +00:00
|
|
|
*/
|
Post-release destabilisation! Completely remove the struct type
'Config' in putty.h, which stores all PuTTY's settings and includes an
arbitrary length limit on every single one of those settings which is
stored in string form. In place of it is 'Conf', an opaque data type
everywhere outside the new file conf.c, which stores a list of (key,
value) pairs in which every key contains an integer identifying a
configuration setting, and for some of those integers the key also
contains extra parts (so that, for instance, CONF_environmt is a
string-to-string mapping). Everywhere that a Config was previously
used, a Conf is now; everywhere there was a Config structure copy,
conf_copy() is called; every lookup, adjustment, load and save
operation on a Config has been rewritten; and there's a mechanism for
serialising a Conf into a binary blob and back for use with Duplicate
Session.
User-visible effects of this change _should_ be minimal, though I
don't doubt I've introduced one or two bugs here and there which will
eventually be found. The _intended_ visible effects of this change are
that all arbitrary limits on configuration strings and lists (e.g.
limit on number of port forwardings) should now disappear; that list
boxes in the configuration will now be displayed in a sorted order
rather than the arbitrary order in which they were added to the list
(since the underlying data structure is now a sorted tree234 rather
than an ad-hoc comma-separated string); and one more specific change,
which is that local and dynamic port forwardings on the same port
number are now mutually exclusive in the configuration (putting 'D' in
the key rather than the value was a mistake in the first place).
One other reorganisation as a result of this is that I've moved all
the dialog.c standard handlers (dlg_stdeditbox_handler and friends)
out into config.c, because I can't really justify calling them generic
any more. When they took a pointer to an arbitrary structure type and
the offset of a field within that structure, they were independent of
whether that structure was a Config or something completely different,
but now they really do expect to talk to a Conf, which can _only_ be
used for PuTTY configuration, so I've renamed them all things like
conf_editbox_handler and moved them out of the nominally independent
dialog-box management module into the PuTTY-specific config.c.
[originally from svn r9214]
2011-07-14 18:52:21 +00:00
|
|
|
conf_set_int(conf, CONF_protocol, -1);
|
Make the configuration dialog non-modal.
Now every call to do_config_box is replaced with a call to
create_config_box, which returns immediately having constructed the
new GTK window object, and is passed a callback function which it will
arrange to be called when the dialog terminates (whether by OK or by
Cancel). That callback is now what triggers the construction of a
session window after 'Open' is pressed in the initial config box, or
the actual mid-session reconfiguration action after 'Apply' is pressed
in a Change Settings box.
We were already prepared to ignore the re-selection of 'Change
Settings' from the context menu of a window that already had a Change
Settings box open (and not accidentally create a second config box for
the same window); but now we do slightly better, by finding the
existing config box and un-minimising and raising it, in case the user
had forgotten it was there.
That's a useful featurelet, but not the main purpose of this change.
The mani point, of course, is that now the multi-window GtkApplication
based front ends now don't do anything confusing to the nesting of
gtk_main() when config boxes are involved. Whether you're changing the
settings of one (or more than one) of your already-running sessions,
preparing to start up a new PuTTY connection, or both at once, we stay
in the same top-level instance of gtk_main() and all sessions' top-
level callbacks continue to run sensibly.
2017-11-26 11:58:02 +00:00
|
|
|
after(afterctx, 1);
|
2003-03-29 19:52:50 +00:00
|
|
|
}
|
|
|
|
|
2003-04-01 18:10:25 +00:00
|
|
|
void cleanup_exit(int code)
|
|
|
|
{
|
|
|
|
exit(code);
|
|
|
|
}
|
|
|
|
|
2003-03-31 11:42:45 +00:00
|
|
|
char *make_default_wintitle(char *hostname)
|
|
|
|
{
|
|
|
|
return dupstr("pterm");
|
|
|
|
}
|
|
|
|
|
2016-03-23 21:58:40 +00:00
|
|
|
void setup(int single)
|
2003-03-29 19:52:50 +00:00
|
|
|
{
|
|
|
|
extern void pty_pre_init(void); /* declared in pty.c */
|
|
|
|
|
2003-03-31 12:10:53 +00:00
|
|
|
cmdline_tooltype = TOOLTYPE_NONNETWORK;
|
2003-04-26 14:35:34 +00:00
|
|
|
default_protocol = -1;
|
2003-03-31 12:10:53 +00:00
|
|
|
|
2016-03-23 21:58:40 +00:00
|
|
|
if (single)
|
|
|
|
pty_pre_init();
|
2003-03-29 19:52:50 +00:00
|
|
|
}
|