1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Three new configurable options:

- Robert de Bath's Compose key is now off by default and configurable on
 - The ages-old controversy over whether ALT by itself should bring the
   System menu up is now controllable by a config option
 - You can now independently configure whether scrollback resets on a
   keypress _and_ whether it resets on screen activity.

[originally from svn r741]
This commit is contained in:
Simon Tatham 2000-10-21 16:30:58 +00:00
parent 77c8e3c17c
commit 6eb613e3c4
5 changed files with 69 additions and 24 deletions

View File

@ -160,8 +160,11 @@ typedef struct {
int nethack_keypad;
int alt_f4; /* is it special? */
int alt_space; /* is it special? */
int alt_only; /* is it special? */
int ldisc_term;
int scroll_on_key;
int scroll_on_disp;
int compose_key;
char wintitle[256]; /* initial window title */
/* Terminal options */
int savelines;

View File

@ -90,6 +90,8 @@ void save_settings (char *section, int do_host, Config *cfg) {
write_setting_i (sesskey, "NetHackKeypad", cfg->nethack_keypad);
write_setting_i (sesskey, "AltF4", cfg->alt_f4);
write_setting_i (sesskey, "AltSpace", cfg->alt_space);
write_setting_i (sesskey, "AltOnly", cfg->alt_only);
write_setting_i (sesskey, "ComposeKey", cfg->compose_key);
write_setting_i (sesskey, "LdiscTerm", cfg->ldisc_term);
write_setting_i (sesskey, "BlinkCur", cfg->blink_cur);
write_setting_i (sesskey, "Beep", cfg->beep);
@ -133,6 +135,7 @@ void save_settings (char *section, int do_host, Config *cfg) {
write_setting_i (sesskey, "CapsLockCyr", cfg->xlat_capslockcyr);
write_setting_i (sesskey, "ScrollBar", cfg->scrollbar);
write_setting_i (sesskey, "ScrollOnKey", cfg->scroll_on_key);
write_setting_i (sesskey, "ScrollOnDisp", cfg->scroll_on_disp);
write_setting_i (sesskey, "LockSize", cfg->locksize);
write_setting_i (sesskey, "BCE", cfg->bce);
write_setting_i (sesskey, "BlinkText", cfg->blinktext);
@ -213,6 +216,8 @@ void load_settings (char *section, int do_host, Config *cfg) {
gppi (sesskey, "NetHackKeypad", 0, &cfg->nethack_keypad);
gppi (sesskey, "AltF4", 1, &cfg->alt_f4);
gppi (sesskey, "AltSpace", 0, &cfg->alt_space);
gppi (sesskey, "AltOnly", 0, &cfg->alt_only);
gppi (sesskey, "ComposeKey", 0, &cfg->compose_key);
gppi (sesskey, "LdiscTerm", 0, &cfg->ldisc_term);
gppi (sesskey, "BlinkCur", 0, &cfg->blink_cur);
gppi (sesskey, "Beep", 1, &cfg->beep);
@ -279,6 +284,7 @@ void load_settings (char *section, int do_host, Config *cfg) {
gppi (sesskey, "CapsLockCyr", 0, &cfg->xlat_capslockcyr);
gppi (sesskey, "ScrollBar", 1, &cfg->scrollbar);
gppi (sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);
gppi (sesskey, "ScrollOnDisp", 1, &cfg->scroll_on_disp);
gppi (sesskey, "LockSize", 0, &cfg->locksize);
gppi (sesskey, "BCE", 0, &cfg->bce);
gppi (sesskey, "BlinkText", 0, &cfg->blinktext);

View File

@ -212,7 +212,7 @@ void term_update(void) {
ctx = get_ctx();
if (ctx) {
if ( (seen_key_event && (cfg.scroll_on_key)) ||
(seen_disp_event && (!cfg.scroll_on_key)) ) {
(seen_disp_event && (cfg.scroll_on_disp)) ) {
disptop = scrtop;
seen_disp_event = seen_key_event = 0;
update_sbar();

View File

@ -210,6 +210,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_TITLE_KEYBOARD,
IDC_BOX_KEYBOARD1, IDC_BOXT_KEYBOARD1,
IDC_BOX_KEYBOARD2, IDC_BOXT_KEYBOARD2,
IDC_BOX_KEYBOARD3, IDC_BOXT_KEYBOARD3,
IDC_DELSTATIC,
IDC_DEL008,
IDC_DEL127,
@ -228,6 +229,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_CURSTATIC,
IDC_CURNORMAL,
IDC_CURAPPLIC,
IDC_COMPOSEKEY,
keyboardpanelend,
terminalpanelstart,
@ -268,7 +270,9 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_SAVEEDIT,
IDC_ALTF4,
IDC_ALTSPACE,
IDC_ALTONLY,
IDC_SCROLLKEY,
IDC_SCROLLDISP,
windowpanelend,
connectionpanelstart,
@ -437,8 +441,11 @@ static void init_dlg_ctrls(HWND hwnd) {
cfg.app_keypad ? IDC_KPAPPLIC : IDC_KPNORMAL);
CheckDlgButton (hwnd, IDC_ALTF4, cfg.alt_f4);
CheckDlgButton (hwnd, IDC_ALTSPACE, cfg.alt_space);
CheckDlgButton (hwnd, IDC_ALTONLY, cfg.alt_only);
CheckDlgButton (hwnd, IDC_COMPOSEKEY, cfg.compose_key);
CheckDlgButton (hwnd, IDC_LDISCTERM, cfg.ldisc_term);
CheckDlgButton (hwnd, IDC_SCROLLKEY, cfg.scroll_on_key);
CheckDlgButton (hwnd, IDC_SCROLLDISP, cfg.scroll_on_disp);
CheckDlgButton (hwnd, IDC_WRAPMODE, cfg.wrap_mode);
CheckDlgButton (hwnd, IDC_DECOM, cfg.dec_om);
@ -587,6 +594,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
switch (msg) {
case WM_INITDIALOG:
readytogo = 0;
SetWindowLong(hwnd, GWL_USERDATA, 0);
/*
* Centre the window.
@ -718,7 +726,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
treeview_insert(&tvfaff, 0, "Terminal");
}
/* The Keyboard panel. Accelerators used: [acgo] h?srvlxvnpmie */
/* The Keyboard panel. Accelerators used: [acgo] h?srvlxvnpmiet */
{
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
@ -748,11 +756,16 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
"Appl&ication", IDC_KPAPPLIC,
"N&etHack", IDC_KPNH, NULL);
endbox(&cp);
beginbox(&cp, "Enable extra keyboard features:",
IDC_BOX_KEYBOARD3, IDC_BOXT_KEYBOARD3);
checkbox(&cp, "Application and AltGr ac&t as Compose key",
IDC_COMPOSEKEY);
endbox(&cp);
treeview_insert(&tvfaff, 1, "Keyboard");
}
/* The Window panel. Accelerators used: [acgo] tibsdkw4y */
/* The Window panel. Accelerators used: [acgo] tibsdkw4ylp */
{
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
@ -776,11 +789,14 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
IDC_SAVESTATIC, IDC_SAVEEDIT, 50);
checkbox(&cp, "&Display scrollbar", IDC_SCROLLBAR);
checkbox(&cp, "Reset scrollback on &keypress", IDC_SCROLLKEY);
checkbox(&cp, "Reset scrollback on dis&play activity",
IDC_SCROLLDISP);
endbox(&cp);
beginbox(&cp, NULL, IDC_BOX_WINDOW4, 0);
checkbox(&cp, "&Warn before closing window", IDC_CLOSEWARN);
checkbox(&cp, "Window closes on ALT-F&4", IDC_ALTF4);
checkbox(&cp, "S&ystem menu appears on ALT-Space)", IDC_ALTSPACE);
checkbox(&cp, "S&ystem menu appears on ALT-Space", IDC_ALTSPACE);
checkbox(&cp, "System menu appears on A&LT alone", IDC_ALTONLY);
endbox(&cp);
treeview_insert(&tvfaff, 0, "Window");
@ -1221,6 +1237,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.alt_space = IsDlgButtonChecked (hwnd, IDC_ALTSPACE);
break;
case IDC_ALTONLY:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.alt_only = IsDlgButtonChecked (hwnd, IDC_ALTONLY);
break;
case IDC_LDISCTERM:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
@ -1231,6 +1252,16 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.scroll_on_key = IsDlgButtonChecked (hwnd, IDC_SCROLLKEY);
break;
case IDC_SCROLLDISP:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.scroll_on_disp = IsDlgButtonChecked (hwnd, IDC_SCROLLDISP);
break;
case IDC_COMPOSEKEY:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.compose_key = IsDlgButtonChecked (hwnd, IDC_COMPOSEKEY);
break;
case IDC_WRAPMODE:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)

View File

@ -1870,25 +1870,28 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
#endif
/* Note if AltGr was pressed and if it was used as a compose key */
if (wParam == VK_MENU && (HIWORD(lParam)&KF_EXTENDED))
{
keystate[VK_RMENU] = keystate[VK_MENU];
if (!compose_state) compose_key = wParam;
}
if (wParam == VK_APPS && !compose_state)
compose_key = wParam;
if (cfg.compose_key) {
if (wParam == VK_MENU && (HIWORD(lParam)&KF_EXTENDED))
{
keystate[VK_RMENU] = keystate[VK_MENU];
if (!compose_state) compose_key = wParam;
}
if (wParam == VK_APPS && !compose_state)
compose_key = wParam;
if (wParam == compose_key)
{
if (compose_state == 0 && (HIWORD(lParam)&(KF_UP|KF_REPEAT))==0)
compose_state = 1;
else if (compose_state == 1 && (HIWORD(lParam)&KF_UP))
compose_state = 2;
else
compose_state = 0;
}
else if (compose_state==1 && wParam != VK_CONTROL)
compose_state = 0;
if (wParam == compose_key)
{
if (compose_state == 0 && (HIWORD(lParam)&(KF_UP|KF_REPEAT))==0)
compose_state = 1;
else if (compose_state == 1 && (HIWORD(lParam)&KF_UP))
compose_state = 2;
else
compose_state = 0;
}
else if (compose_state==1 && wParam != VK_CONTROL)
compose_state = 0;
} else
compose_state = 0;
/* Nastyness with NUMLock - Shift-NUMLock is left alone though */
if ( (cfg.funky_type == 3 || (cfg.funky_type <= 1 && app_keypad_keys))
@ -2261,8 +2264,10 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
}
/* This stops ALT press-release doing a 'COMMAND MENU' function */
if (message == WM_SYSKEYUP && wParam == VK_MENU)
return 0;
if (!cfg.alt_only) {
if (message == WM_SYSKEYUP && wParam == VK_MENU)
return 0;
}
return -1;
}