mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 06:38:37 -05:00
Reintroduce Cyrillic Caps Lock mode, which was in 0.51 but got
kicked out by the Unicode patch. It's not very good - only works sanely on US keyboards - but it's no worse than it was in 0.51. After 0.52 maybe I should fix it properly. [originally from svn r1273]
This commit is contained in:
parent
f3b95b60b4
commit
f3a17c0715
2
putty.h
2
putty.h
@ -341,6 +341,7 @@ typedef struct {
|
|||||||
/* translations */
|
/* translations */
|
||||||
VT_Mode vtmode;
|
VT_Mode vtmode;
|
||||||
char line_codepage[32];
|
char line_codepage[32];
|
||||||
|
int xlat_capslockcyr;
|
||||||
/* X11 forwarding */
|
/* X11 forwarding */
|
||||||
int x11_forward;
|
int x11_forward;
|
||||||
char x11_display[128];
|
char x11_display[128];
|
||||||
@ -541,6 +542,7 @@ void EnableSizeTip(int bEnable);
|
|||||||
void init_ucs_tables(void);
|
void init_ucs_tables(void);
|
||||||
void lpage_send(int codepage, char *buf, int len);
|
void lpage_send(int codepage, char *buf, int len);
|
||||||
void luni_send(wchar_t * widebuf, int len);
|
void luni_send(wchar_t * widebuf, int len);
|
||||||
|
wchar_t xlat_uskbd2cyrllic(int ch);
|
||||||
int check_compose(int first, int second);
|
int check_compose(int first, int second);
|
||||||
int decode_codepage(char *cp_name);
|
int decode_codepage(char *cp_name);
|
||||||
char *cp_enumerate (int index);
|
char *cp_enumerate (int index);
|
||||||
|
@ -248,6 +248,7 @@ void save_settings(char *section, int do_host, Config * cfg)
|
|||||||
write_setting_s(sesskey, buf, buf2);
|
write_setting_s(sesskey, buf, buf2);
|
||||||
}
|
}
|
||||||
write_setting_s(sesskey, "LineCodePage", cfg->line_codepage);
|
write_setting_s(sesskey, "LineCodePage", cfg->line_codepage);
|
||||||
|
write_setting_i(sesskey, "CapsLockCyr", cfg->xlat_capslockcyr);
|
||||||
write_setting_i(sesskey, "ScrollBar", cfg->scrollbar);
|
write_setting_i(sesskey, "ScrollBar", cfg->scrollbar);
|
||||||
write_setting_i(sesskey, "ScrollOnKey", cfg->scroll_on_key);
|
write_setting_i(sesskey, "ScrollOnKey", cfg->scroll_on_key);
|
||||||
write_setting_i(sesskey, "ScrollOnDisp", cfg->scroll_on_disp);
|
write_setting_i(sesskey, "ScrollOnDisp", cfg->scroll_on_disp);
|
||||||
@ -471,6 +472,7 @@ void load_settings(char *section, int do_host, Config * cfg)
|
|||||||
*/
|
*/
|
||||||
gpps(sesskey, "LineCodePage", "", cfg->line_codepage,
|
gpps(sesskey, "LineCodePage", "", cfg->line_codepage,
|
||||||
sizeof(cfg->line_codepage));
|
sizeof(cfg->line_codepage));
|
||||||
|
gppi (sesskey, "CapsLockCyr", 0, &cfg->xlat_capslockcyr);
|
||||||
gppi(sesskey, "ScrollBar", 1, &cfg->scrollbar);
|
gppi(sesskey, "ScrollBar", 1, &cfg->scrollbar);
|
||||||
gppi(sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);
|
gppi(sesskey, "ScrollOnKey", 0, &cfg->scroll_on_key);
|
||||||
gppi(sesskey, "ScrollOnDisp", 1, &cfg->scroll_on_disp);
|
gppi(sesskey, "ScrollOnDisp", 1, &cfg->scroll_on_disp);
|
||||||
|
23
unicode.c
23
unicode.c
@ -524,6 +524,29 @@ void luni_send(wchar_t * widebuf, int len)
|
|||||||
ldisc_send(linebuffer, p - linebuffer);
|
ldisc_send(linebuffer, p - linebuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wchar_t xlat_uskbd2cyrllic(int ch)
|
||||||
|
{
|
||||||
|
static wchar_t cyrtab[] = {
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7,
|
||||||
|
8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
|
16, 17, 18, 19, 20, 21, 22, 23,
|
||||||
|
24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
|
32, 33, 0x042d, 35, 36, 37, 38, 0x044d,
|
||||||
|
40, 41, 42, 0x0406, 0x0431, 0x0454, 0x044e, 0x002e,
|
||||||
|
48, 49, 50, 51, 52, 53, 54, 55,
|
||||||
|
56, 57, 0x0416, 0x0436, 0x0411, 0x0456, 0x042e, 0x002c,
|
||||||
|
64, 0x0424, 0x0418, 0x0421, 0x0412, 0x0423, 0x0410, 0x041f,
|
||||||
|
0x0420, 0x0428, 0x041e, 0x041b, 0x0414, 0x042c, 0x0422, 0x0429,
|
||||||
|
0x0417, 0x0419, 0x041a, 0x042b, 0x0415, 0x0413, 0x041c, 0x0426,
|
||||||
|
0x0427, 0x041d, 0x042f, 0x0445, 0x0457, 0x044a, 94, 0x0404,
|
||||||
|
96, 0x0444, 0x0438, 0x0441, 0x0432, 0x0443, 0x0430, 0x043f,
|
||||||
|
0x0440, 0x0448, 0x043e, 0x043b, 0x0434, 0x044c, 0x0442, 0x0449,
|
||||||
|
0x0437, 0x0439, 0x043a, 0x044b, 0x0435, 0x0433, 0x043c, 0x0446,
|
||||||
|
0x0447, 0x043d, 0x044f, 0x0425, 0x0407, 0x042a, 126, 127
|
||||||
|
};
|
||||||
|
return cyrtab[ch&0x7F];
|
||||||
|
}
|
||||||
|
|
||||||
int check_compose(int first, int second)
|
int check_compose(int first, int second)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
21
windlg.c
21
windlg.c
@ -505,8 +505,10 @@ enum { IDCX_ABOUT =
|
|||||||
IDC_TITLE_TRANSLATION,
|
IDC_TITLE_TRANSLATION,
|
||||||
IDC_BOX_TRANSLATION1,
|
IDC_BOX_TRANSLATION1,
|
||||||
IDC_BOX_TRANSLATION2,
|
IDC_BOX_TRANSLATION2,
|
||||||
|
IDC_BOX_TRANSLATION3,
|
||||||
IDC_CODEPAGESTATIC,
|
IDC_CODEPAGESTATIC,
|
||||||
IDC_CODEPAGE,
|
IDC_CODEPAGE,
|
||||||
|
IDC_CAPSLOCKCYR,
|
||||||
IDC_VTSTATIC,
|
IDC_VTSTATIC,
|
||||||
IDC_VTXWINDOWS,
|
IDC_VTXWINDOWS,
|
||||||
IDC_VTOEMANSI,
|
IDC_VTOEMANSI,
|
||||||
@ -796,6 +798,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess)
|
|||||||
char *cp;
|
char *cp;
|
||||||
strcpy(cfg.line_codepage, cp_name(decode_codepage(cfg.line_codepage)));
|
strcpy(cfg.line_codepage, cp_name(decode_codepage(cfg.line_codepage)));
|
||||||
SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_RESETCONTENT, 0, 0);
|
SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_RESETCONTENT, 0, 0);
|
||||||
|
CheckDlgButton (hwnd, IDC_CAPSLOCKCYR, cfg.xlat_capslockcyr);
|
||||||
for (i = 0; (cp = cp_enumerate(i)) != NULL; i++) {
|
for (i = 0; (cp = cp_enumerate(i)) != NULL; i++) {
|
||||||
SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_ADDSTRING,
|
SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_ADDSTRING,
|
||||||
0, (LPARAM) cp);
|
0, (LPARAM) cp);
|
||||||
@ -1101,18 +1104,23 @@ static void create_controls(HWND hwnd, int dlgtype, int panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panel == translationpanelstart) {
|
if (panel == translationpanelstart) {
|
||||||
/* The Translation panel. Accelerators used: [acgo] rxbepu */
|
/* The Translation panel. Accelerators used: [acgo] rxbepus */
|
||||||
struct ctlpos cp;
|
struct ctlpos cp;
|
||||||
ctlposinit(&cp, hwnd, 80, 3, 13);
|
ctlposinit(&cp, hwnd, 80, 3, 13);
|
||||||
bartitle(&cp, "Options controlling character set translation",
|
bartitle(&cp, "Options controlling character set translation",
|
||||||
IDC_TITLE_TRANSLATION);
|
IDC_TITLE_TRANSLATION);
|
||||||
beginbox(&cp, "Character set translation on received data",
|
beginbox(&cp, "Character set translation on received data",
|
||||||
IDC_BOX_TRANSLATION2);
|
IDC_BOX_TRANSLATION1);
|
||||||
combobox(&cp, "&Received data assumed to be in which character set:",
|
combobox(&cp, "&Received data assumed to be in which character set:",
|
||||||
IDC_CODEPAGESTATIC, IDC_CODEPAGE);
|
IDC_CODEPAGESTATIC, IDC_CODEPAGE);
|
||||||
endbox(&cp);
|
endbox(&cp);
|
||||||
|
beginbox(&cp, "Enable character set translation on input data",
|
||||||
|
IDC_BOX_TRANSLATION2);
|
||||||
|
checkbox(&cp, "CAP&S LOCK acts as cyrillic switch",
|
||||||
|
IDC_CAPSLOCKCYR);
|
||||||
|
endbox(&cp);
|
||||||
beginbox(&cp, "Adjust how PuTTY displays line drawing characters",
|
beginbox(&cp, "Adjust how PuTTY displays line drawing characters",
|
||||||
IDC_BOX_TRANSLATION1);
|
IDC_BOX_TRANSLATION3);
|
||||||
radiobig(&cp,
|
radiobig(&cp,
|
||||||
"Handling of line drawing characters:", IDC_VTSTATIC,
|
"Handling of line drawing characters:", IDC_VTSTATIC,
|
||||||
"Font has &XWindows encoding", IDC_VTXWINDOWS,
|
"Font has &XWindows encoding", IDC_VTXWINDOWS,
|
||||||
@ -2512,6 +2520,13 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg,
|
|||||||
SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage);
|
SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDC_CAPSLOCKCYR:
|
||||||
|
if (HIWORD(wParam) == BN_CLICKED ||
|
||||||
|
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
||||||
|
cfg.xlat_capslockcyr =
|
||||||
|
IsDlgButtonChecked (hwnd, IDC_CAPSLOCKCYR);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case IDC_VTXWINDOWS:
|
case IDC_VTXWINDOWS:
|
||||||
case IDC_VTOEMANSI:
|
case IDC_VTOEMANSI:
|
||||||
case IDC_VTOEMONLY:
|
case IDC_VTOEMONLY:
|
||||||
|
21
window.c
21
window.c
@ -3334,6 +3334,14 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
|||||||
/* Okay we've done everything interesting; let windows deal with
|
/* Okay we've done everything interesting; let windows deal with
|
||||||
* the boring stuff */
|
* the boring stuff */
|
||||||
{
|
{
|
||||||
|
BOOL capsOn=0;
|
||||||
|
|
||||||
|
/* helg: clear CAPS LOCK state if caps lock switches to cyrillic */
|
||||||
|
if(cfg.xlat_capslockcyr && keystate[VK_CAPITAL] != 0) {
|
||||||
|
capsOn= !left_alt;
|
||||||
|
keystate[VK_CAPITAL] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
r = ToAsciiEx(wParam, scan, keystate, keys, 0, kbd_layout);
|
r = ToAsciiEx(wParam, scan, keystate, keys, 0, kbd_layout);
|
||||||
#ifdef SHOW_TOASCII_RESULT
|
#ifdef SHOW_TOASCII_RESULT
|
||||||
if (r == 1 && !key_down) {
|
if (r == 1 && !key_down) {
|
||||||
@ -3402,10 +3410,17 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
|
|||||||
} else
|
} else
|
||||||
lpage_send(kbd_codepage, &ch, 1);
|
lpage_send(kbd_codepage, &ch, 1);
|
||||||
} else {
|
} else {
|
||||||
static char cbuf[] = "\033 ";
|
if(capsOn && ch < 0x80) {
|
||||||
|
WCHAR cbuf[2];
|
||||||
|
cbuf[0] = 27;
|
||||||
|
cbuf[1] = xlat_uskbd2cyrllic(ch);
|
||||||
|
luni_send(cbuf+!left_alt, 1+!!left_alt);
|
||||||
|
} else {
|
||||||
|
char cbuf[2];
|
||||||
|
cbuf[0] = '\033';
|
||||||
cbuf[1] = ch;
|
cbuf[1] = ch;
|
||||||
lpage_send(kbd_codepage, cbuf + !left_alt,
|
lpage_send(kbd_codepage, cbuf+!left_alt, 1+!!left_alt);
|
||||||
1 + !!left_alt);
|
}
|
||||||
}
|
}
|
||||||
show_mouseptr(0);
|
show_mouseptr(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user