1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-10 15:48:06 -05:00

Gaaah, I might have known. Split combined app cursor / app keypad

disablement option into two options so the app cursor keys and app
keypad can be controlled separately. The Pedantic Software Award in
this case goes to the Midnight Commander for its egregious failure
to just use the terminal in Perfectly Normal mode.

[originally from svn r766]
This commit is contained in:
Simon Tatham 2000-10-25 14:20:47 +00:00
parent 4aafc6e5c3
commit fc63ad0046
4 changed files with 29 additions and 15 deletions

View File

@ -156,7 +156,8 @@ typedef struct {
int bksp_is_delete;
int rxvt_homeend;
int funky_type;
int no_applic; /* totally disable application modes */
int no_applic_c; /* totally disable app cursor keys */
int no_applic_k; /* totally disable app keypad */
int app_cursor;
int app_keypad;
int nethack_keypad;

View File

@ -79,7 +79,8 @@ void save_settings (char *section, int do_host, Config *cfg) {
write_setting_i (sesskey, "BackspaceIsDelete", cfg->bksp_is_delete);
write_setting_i (sesskey, "RXVTHomeEnd", cfg->rxvt_homeend);
write_setting_i (sesskey, "LinuxFunctionKeys", cfg->funky_type);
write_setting_i (sesskey, "NoApplicationKeys", cfg->no_applic);
write_setting_i (sesskey, "NoApplicationKeys", cfg->no_applic_k);
write_setting_i (sesskey, "NoApplicationCursors", cfg->no_applic_c);
write_setting_i (sesskey, "ApplicationCursorKeys", cfg->app_cursor);
write_setting_i (sesskey, "ApplicationKeypad", cfg->app_keypad);
write_setting_i (sesskey, "NetHackKeypad", cfg->nethack_keypad);
@ -206,7 +207,8 @@ void load_settings (char *section, int do_host, Config *cfg) {
gppi (sesskey, "BackspaceIsDelete", 1, &cfg->bksp_is_delete);
gppi (sesskey, "RXVTHomeEnd", 0, &cfg->rxvt_homeend);
gppi (sesskey, "LinuxFunctionKeys", 0, &cfg->funky_type);
gppi (sesskey, "NoApplicationKeys", 0, &cfg->no_applic);
gppi (sesskey, "NoApplicationKeys", 0, &cfg->no_applic_k);
gppi (sesskey, "NoApplicationCursors", 0, &cfg->no_applic_c);
gppi (sesskey, "ApplicationCursorKeys", 0, &cfg->app_cursor);
gppi (sesskey, "ApplicationKeypad", 0, &cfg->app_keypad);
gppi (sesskey, "NetHackKeypad", 0, &cfg->nethack_keypad);

View File

@ -219,7 +219,8 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_KPNORMAL,
IDC_KPAPPLIC,
IDC_KPNH,
IDC_NOAPPLIC,
IDC_NOAPPLICK,
IDC_NOAPPLICC,
IDC_CURSTATIC,
IDC_CURNORMAL,
IDC_CURAPPLIC,
@ -431,7 +432,8 @@ static void init_dlg_ctrls(HWND hwnd) {
cfg.funky_type == 2 ? IDC_FUNCXTERM :
cfg.funky_type == 3 ? IDC_FUNCVT400 :
IDC_FUNCTILDE );
CheckDlgButton (hwnd, IDC_NOAPPLIC, cfg.no_applic);
CheckDlgButton (hwnd, IDC_NOAPPLICC, cfg.no_applic_c);
CheckDlgButton (hwnd, IDC_NOAPPLICK, cfg.no_applic_k);
CheckRadioButton (hwnd, IDC_CURNORMAL, IDC_CURAPPLIC,
cfg.app_cursor ? IDC_CURAPPLIC : IDC_CURNORMAL);
CheckRadioButton (hwnd, IDC_KPNORMAL, IDC_KPNH,
@ -712,7 +714,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
treeview_insert(&tvfaff, 0, "Terminal");
}
/* The Keyboard panel. Accelerators used: [acgo] h?srvlxvnpmiet */
/* The Keyboard panel. Accelerators used: [acgo] h?srvlxvnpmietu */
{
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
@ -735,11 +737,14 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
beginbox(&cp, "Application keypad settings:",
IDC_BOX_KEYBOARD2, IDC_BOXT_KEYBOARD2);
checkbox(&cp,
"Application ke&ypad and cursor keys totally disabled",
IDC_NOAPPLIC);
"Application c&ursor keys totally disabled",
IDC_NOAPPLICC);
radioline(&cp, "Initial state of cursor keys:", IDC_CURSTATIC, 2,
"&Normal", IDC_CURNORMAL,
"A&pplication", IDC_CURAPPLIC, NULL);
checkbox(&cp,
"Application ke&ypad keys totally disabled",
IDC_NOAPPLICK);
radioline(&cp, "Initial state of numeric keypad:", IDC_KPSTATIC, 3,
"Nor&mal", IDC_KPNORMAL,
"Appl&ication", IDC_KPAPPLIC,
@ -1240,10 +1245,15 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.app_cursor = IsDlgButtonChecked (hwnd, IDC_CURAPPLIC);
break;
case IDC_NOAPPLIC:
case IDC_NOAPPLICC:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.no_applic = IsDlgButtonChecked (hwnd, IDC_NOAPPLIC);
cfg.no_applic_c = IsDlgButtonChecked (hwnd, IDC_NOAPPLICC);
break;
case IDC_NOAPPLICK:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.no_applic_k = IsDlgButtonChecked (hwnd, IDC_NOAPPLICK);
break;
case IDC_ALTF4:
if (HIWORD(wParam) == BN_CLICKED ||

View File

@ -1904,7 +1904,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
/* Nastyness with NUMLock - Shift-NUMLock is left alone though */
if ( (cfg.funky_type == 3 ||
(cfg.funky_type <= 1 && app_keypad_keys && !cfg.no_applic))
(cfg.funky_type <= 1 && app_keypad_keys && !cfg.no_applic_k))
&& wParam==VK_NUMLOCK && !(keystate[VK_SHIFT]&0x80)) {
wParam = VK_EXECUTE;
@ -1949,7 +1949,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
if (compose_state>1 && left_alt) compose_state = 0;
/* Sanitize the number pad if not using a PC NumPad */
if( left_alt || (app_keypad_keys && !cfg.no_applic && cfg.funky_type != 2)
if( left_alt || (app_keypad_keys && !cfg.no_applic_k
&& cfg.funky_type != 2)
|| cfg.funky_type == 3 || cfg.nethack_keypad || compose_state )
{
if ((HIWORD(lParam)&KF_EXTENDED) == 0)
@ -2032,13 +2033,13 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
if ( cfg.funky_type == 3 ||
( cfg.funky_type <= 1 &&
app_keypad_keys && !cfg.no_applic)) switch(wParam) {
app_keypad_keys && !cfg.no_applic_k)) switch(wParam) {
case VK_EXECUTE: xkey = 'P'; break;
case VK_DIVIDE: xkey = 'Q'; break;
case VK_MULTIPLY:xkey = 'R'; break;
case VK_SUBTRACT:xkey = 'S'; break;
}
if(app_keypad_keys && !cfg.no_applic) switch(wParam) {
if(app_keypad_keys && !cfg.no_applic_k) switch(wParam) {
case VK_NUMPAD0: xkey = 'p'; break;
case VK_NUMPAD1: xkey = 'q'; break;
case VK_NUMPAD2: xkey = 'r'; break;
@ -2200,7 +2201,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
{
if (vt52_mode)
p += sprintf((char *)p, "\x1B%c", xkey);
else if (app_cursor_keys && !cfg.no_applic)
else if (app_cursor_keys && !cfg.no_applic_c)
p += sprintf((char *)p, "\x1BO%c", xkey);
else
p += sprintf((char *)p, "\x1B[%c", xkey);