static void another_font(int);
static void deinit_fonts(void);
static void set_input_locale(HKL);
-static int do_mouse_wheel_msg(UINT message, WPARAM wParam, LPARAM lParam);
static int is_full_screen(void);
static void make_full_screen(void);
static int caret_x = -1, caret_y = -1;
+static int kbd_codepage;
+
static void *ldisc;
static Backend *back;
static void *backhandle;
+static int session_closed;
+
+extern struct sesslist sesslist; /* imported from windlg.c */
+
#define FONT_NORMAL 0
#define FONT_BOLD 1
#define FONT_UNDERLINE 2
char *p = argv[i];
int ret;
- ret = cmdline_process_param(p, i+1<argc?argv[i+1]:NULL, 1);
+ ret = cmdline_process_param(p, i+1<argc?argv[i+1]:NULL,
+ 1, &cfg);
if (ret == -2) {
cmdline_error("option \"%s\" requires an argument", p);
} else if (ret == 2) {
* argument, so that it will be deferred
* until it's a good moment to run it.
*/
- int ret = cmdline_process_param("-P", p, 1);
+ int ret = cmdline_process_param("-P", p, 1, &cfg);
assert(ret == 2);
} else if (!strncmp(q, "telnet:", 7)) {
/*
cfg.host[sizeof(cfg.host) - 1] = '\0';
got_host = 1;
}
+ } else {
+ cmdline_error("unknown option \"%s\"", p);
}
}
}
- cmdline_run_saved();
+ cmdline_run_saved(&cfg);
if (!*cfg.host && !do_config()) {
WSACleanup();
hwnd = NULL;
- term = term_init(NULL);
+ term = term_init(&cfg, NULL);
logctx = log_init(NULL);
term_provide_logctx(term, logctx);
char msg[1024], *title;
char *realhost;
- error = back->init((void *)term, &backhandle,
+ error = back->init((void *)term, &backhandle, &cfg,
cfg.host, cfg.port, &realhost, cfg.tcp_nodelay);
back->provide_logctx(backhandle, logctx);
if (error) {
/*
* Set up a line discipline.
*/
- ldisc = ldisc_create(term, back, backhandle, NULL);
+ ldisc = ldisc_create(&cfg, term, back, backhandle, NULL);
session_closed = FALSE;
AppendMenu(m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session...");
AppendMenu(m, MF_ENABLED, IDM_DUPSESS, "&Duplicate Session");
s = CreateMenu();
- get_sesslist(TRUE);
- for (i = 1; i < ((nsessions < 256) ? nsessions : 256); i++)
+ get_sesslist(&sesslist, TRUE);
+ for (i = 1;
+ i < ((sesslist.nsessions < 256) ? sesslist.nsessions : 256);
+ i++)
AppendMenu(s, MF_ENABLED, IDM_SAVED_MIN + (16 * i),
- sessions[i]);
+ sesslist.sessions[i]);
AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT) s, "Sa&ved Sessions");
AppendMenu(m, MF_ENABLED, IDM_RECONF, "Chan&ge Settings...");
AppendMenu(m, MF_SEPARATOR, 0, 0);
sprintf(c, "putty &%p", filemap);
cl = c;
} else if (wParam == IDM_SAVEDSESS) {
- if ((lParam - IDM_SAVED_MIN) / 16 < nsessions) {
+ if ((lParam - IDM_SAVED_MIN) / 16 < sesslist.nsessions) {
char *session =
- sessions[(lParam - IDM_SAVED_MIN) / 16];
+ sesslist.sessions[(lParam - IDM_SAVED_MIN) / 16];
cl = smalloc(16 + strlen(session));
/* 8, but play safe */
if (!cl)
cfgtopalette();
init_palette();
- /* Give terminal a heads-up on miscellaneous stuff */
- term_reconfig(term);
+ /* Pass new config data to the terminal */
+ term_reconfig(term, &cfg);
+
+ /* Pass new config data to the back end */
+ back->reconfig(back, &cfg);
/* Screen size changed ? */
if (cfg.height != prev_cfg.height ||
(p.rcPaint.left-offset_width)/font_width,
(p.rcPaint.top-offset_height)/font_height,
(p.rcPaint.right-offset_width-1)/font_width,
- (p.rcPaint.bottom-offset_height-1)/font_height);
+ (p.rcPaint.bottom-offset_height-1)/font_height,
+ is_alt_pressed());
if (p.fErase ||
p.rcPaint.left < offset_width ||
* 1) Keep the sizetip uptodate
* 2) Make sure the window size is _stepped_ in units of the font size.
*/
- if (cfg.resize_action != RESIZE_FONT && !alt_pressed) {
+ if (cfg.resize_action != RESIZE_FONT && !is_alt_pressed()) {
int width, height, w, h, ew, eh;
LPRECT r = (LPRECT) lParam;
* down the connection during an NT opaque drag.)
*/
if (resizing) {
- if (cfg.resize_action != RESIZE_FONT && !alt_pressed) {
+ if (cfg.resize_action != RESIZE_FONT && !is_alt_pressed()) {
need_backend_resize = TRUE;
w = (width-cfg.window_border*2) / font_width;
if (w < 1) w = 1;
}
default:
if (message == wm_mousewheel || message == WM_MOUSEWHEEL) {
- int shift_pressed=0, control_pressed=0, alt_pressed=0;
+ int shift_pressed=0, control_pressed=0;
if (message == WM_MOUSEWHEEL) {
wheel_accumulator += (short)HIWORD(wParam);
/* This function gets the actual width of a character in the normal font.
*/
-int CharWidth(Context ctx, int uc) {
+int char_width(Context ctx, int uc) {
HDC hdc = ctx;
int ibuf = 0;
}
}
- alt_pressed = (left_alt && key_down);
-
scan = (HIWORD(lParam) & (KF_UP | KF_EXTENDED | 0xFF));
shift_state = ((keystate[VK_SHIFT] & 0x80) != 0)
+ ((keystate[VK_CONTROL] & 0x80) != 0) * 2;