#define IDM_COPYALL 0x0170
#define IDM_FULLSCREEN 0x0180
#define IDM_PASTE 0x0190
+#define IDM_SPECIALSEP 0x0200
#define IDM_SPECIAL_MIN 0x0400
#define IDM_SPECIAL_MAX 0x0800
/* Maximum number of sessions on saved-session submenu */
#define MENU_SAVED_MAX ((IDM_SAVED_MAX-IDM_SAVED_MIN) / MENU_SAVED_STEP)
-#define WM_IGNORE_CLIP (WM_XUSER + 2)
-#define WM_FULLSCR_ON_MAX (WM_XUSER + 3)
-#define WM_AGENT_CALLBACK (WM_XUSER + 4)
+#define WM_IGNORE_CLIP (WM_APP + 2)
+#define WM_FULLSCR_ON_MAX (WM_APP + 3)
+#define WM_AGENT_CALLBACK (WM_APP + 4)
/* Needed for Chinese support and apparently not always defined. */
#ifndef VK_PROCESSKEY
static int session_closed;
static int reconfiguring = FALSE;
-static const struct telnet_special *specials;
-static int n_specials;
+static const struct telnet_special *specials = NULL;
+static HMENU specials_menu = NULL;
+static int n_specials = 0;
#define TIMING_TIMER_ID 1234
static long timing_next_time;
static struct {
HMENU menu;
- int specials_submenu_pos;
} popup_menus[2];
enum { SYSMENU, CTXMENU };
static HMENU savedsess_menu;
m = popup_menus[j].menu;
AppendMenu(m, MF_SEPARATOR, 0, 0);
- popup_menus[j].specials_submenu_pos = GetMenuItemCount(m);
AppendMenu(m, MF_ENABLED, IDM_SHOWLOG, "&Event Log");
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session...");
set_input_locale(GetKeyboardLayout(0));
/*
- * Open the initial log file if there is one.
- */
- logfopen(logctx);
-
- /*
* Finally show the window!
*/
ShowWindow(hwnd, show);
*/
void update_specials_menu(void *frontend)
{
- HMENU p;
- int menu_already_exists = (specials != NULL);
+ HMENU new_menu;
int i, j;
if (back)
* here's a lame "stack" that will do for now. */
HMENU saved_menu = NULL;
int nesting = 1;
- p = CreatePopupMenu();
+ new_menu = CreatePopupMenu();
for (i = 0; nesting > 0; i++) {
assert(IDM_SPECIAL_MIN + 0x10 * i < IDM_SPECIAL_MAX);
switch (specials[i].code) {
case TS_SEP:
- AppendMenu(p, MF_SEPARATOR, 0, 0);
+ AppendMenu(new_menu, MF_SEPARATOR, 0, 0);
break;
case TS_SUBMENU:
assert(nesting < 2);
nesting++;
- saved_menu = p; /* XXX lame stacking */
- p = CreatePopupMenu();
+ saved_menu = new_menu; /* XXX lame stacking */
+ new_menu = CreatePopupMenu();
AppendMenu(saved_menu, MF_POPUP | MF_ENABLED,
- (UINT) p, specials[i].name);
+ (UINT) new_menu, specials[i].name);
break;
case TS_EXITMENU:
nesting--;
if (nesting) {
- p = saved_menu; /* XXX lame stacking */
+ new_menu = saved_menu; /* XXX lame stacking */
saved_menu = NULL;
}
break;
default:
- AppendMenu(p, MF_ENABLED, IDM_SPECIAL_MIN + 0x10 * i,
+ AppendMenu(new_menu, MF_ENABLED, IDM_SPECIAL_MIN + 0x10 * i,
specials[i].name);
break;
}
/* Squirrel the highest special. */
n_specials = i - 1;
} else {
- p = NULL;
+ new_menu = NULL;
n_specials = 0;
}
for (j = 0; j < lenof(popup_menus); j++) {
- if (menu_already_exists) {
+ if (specials_menu) {
/* XXX does this free up all submenus? */
- DeleteMenu(popup_menus[j].menu,
- popup_menus[j].specials_submenu_pos,
- MF_BYPOSITION);
- DeleteMenu(popup_menus[j].menu,
- popup_menus[j].specials_submenu_pos,
- MF_BYPOSITION);
+ DeleteMenu(popup_menus[j].menu, specials_menu, MF_BYCOMMAND);
+ DeleteMenu(popup_menus[j].menu, IDM_SPECIALSEP, MF_BYCOMMAND);
}
if (specials) {
- InsertMenu(popup_menus[j].menu,
- popup_menus[j].specials_submenu_pos,
- MF_BYPOSITION | MF_SEPARATOR, 0, 0);
- InsertMenu(popup_menus[j].menu,
- popup_menus[j].specials_submenu_pos,
- MF_BYPOSITION | MF_POPUP | MF_ENABLED,
- (UINT) p, "S&pecial Command");
+ InsertMenu(popup_menus[j].menu, IDM_SHOWLOG,
+ MF_BYCOMMAND | MF_POPUP | MF_ENABLED,
+ (UINT) new_menu, "S&pecial Command");
+ InsertMenu(popup_menus[j].menu, IDM_SHOWLOG,
+ MF_BYCOMMAND | MF_SEPARATOR, IDM_SPECIALSEP, 0);
}
+ specials_menu = new_menu;
}
}
}
{
HCURSOR cursor = LoadCursor(NULL, curstype);
- SetClassLong(hwnd, GCL_HCURSOR, (LONG)cursor);
+ SetClassLongPtr(hwnd, GCLP_HCURSOR, (LONG_PTR)cursor);
SetCursor(cursor); /* force redraw of cursor at current posn */
}
if (force_visible != forced_visible) {
for (i = 0; i < NEXTCOLOURS; i++) {
if (i < 216) {
int r = i / 36, g = (i / 6) % 6, b = i % 6;
- defpal[i+16].rgbtRed = r * 0x33;
- defpal[i+16].rgbtGreen = g * 0x33;
- defpal[i+16].rgbtBlue = b * 0x33;
+ defpal[i+16].rgbtRed = r ? r * 40 + 55 : 0;
+ defpal[i+16].rgbtGreen = g ? g * 40 + 55 : 0;
+ defpal[i+16].rgbtBlue = b ? b * 40 + 55 : 0;
} else {
int shade = i - 216;
- shade = (shade + 1) * 0xFF / (NEXTCOLOURS - 216 + 1);
+ shade = shade * 10 + 8;
defpal[i+16].rgbtRed = defpal[i+16].rgbtGreen =
defpal[i+16].rgbtBlue = shade;
}
#define f(i,c,w,u) \
fonts[i] = CreateFont (font_height, font_width, 0, 0, w, FALSE, u, FALSE, \
c, OUT_DEFAULT_PRECIS, \
- CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, \
+ CLIP_DEFAULT_PRECIS, FONT_QUALITY(cfg.font_quality), \
FIXED_PITCH | FF_DONTCARE, cfg.font.name)
f(FONT_NORMAL, cfg.font.charset, fw_dontcare, FALSE);
fonts[fontno] =
CreateFont(font_height * (1 + !!(fontno & FONT_HIGH)), x, 0, 0, w,
FALSE, u, FALSE, c, OUT_DEFAULT_PRECIS,
- CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
+ CLIP_DEFAULT_PRECIS, FONT_QUALITY(cfg.font_quality),
FIXED_PITCH | FF_DONTCARE, s);
fontflag[fontno] = 1;
cfg.font.isbold != prev_cfg.font.isbold ||
cfg.font.height != prev_cfg.font.height ||
cfg.font.charset != prev_cfg.font.charset ||
+ cfg.font_quality != prev_cfg.font_quality ||
cfg.vtmode != prev_cfg.vtmode ||
cfg.bold_colour != prev_cfg.bold_colour ||
cfg.resize_action == RESIZE_DISABLED ||
rtfsize = 100 + strlen(cfg.font.name);
rtf = snewn(rtfsize, char);
- sprintf(rtf, "{\\rtf1\\ansi%d{\\fonttbl\\f0\\fmodern %s;}\\f0",
+ sprintf(rtf, "{\\rtf1\\ansi%d{\\fonttbl\\f0\\fmodern %s;}\\f0 ",
GetACP(), cfg.font.name);
rtflen = strlen(rtf);
/*
* Beep.
*/
-void beep(void *frontend, int mode)
+void do_beep(void *frontend, int mode)
{
if (mode == BELL_DEFAULT) {
/*
return term_data(term, is_stderr, data, len);
}
+int from_backend_untrusted(void *frontend, const char *data, int len)
+{
+ return term_data_untrusted(term, data, len);
+}
+
+int get_userpass_input(prompts_t *p, unsigned char *in, int inlen)
+{
+ int ret;
+ ret = cmdline_get_passwd_input(p, in, inlen);
+ if (ret == -1)
+ ret = term_get_userpass_input(term, p, in, inlen);
+ return ret;
+}
+
void agent_schedule_callback(void (*callback)(void *, void *, int),
void *callback_ctx, void *data, int len)
{