X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/156686ef42c3f6940045f33fc350b806bcbc7f52..f37caa117ec771aa41b0f03ab351fc4eb97daafd:/window.c diff --git a/window.c b/window.c index 8a9c6c71..ec27dc88 100644 --- a/window.c +++ b/window.c @@ -42,6 +42,9 @@ #define IDM_SAVEDSESS 0x0150 #define IDM_COPYALL 0x0160 +#define IDM_SESSLGP 0x0250 /* log type printable */ +#define IDM_SESSLGA 0x0260 /* log type all chars */ +#define IDM_SESSLGE 0x0270 /* log end */ #define IDM_SAVED_MIN 0x1000 #define IDM_SAVED_MAX 0x2000 @@ -2063,7 +2066,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, /* Note if AltGr was pressed and if it was used as a compose key */ if (!compose_state) { - compose_key = -1; + compose_key = 0x100; if (cfg.compose_key) { if (wParam == VK_MENU && (HIWORD(lParam)&KF_EXTENDED)) compose_key = wParam; @@ -2318,6 +2321,24 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, /* Reorder edit keys to physical order */ if (cfg.funky_type == 3 && code <= 6 ) code = "\0\2\1\4\5\3\6"[code]; + if (vt52_mode && code > 0 && code <= 6) { + p += sprintf((char *)p, "\x1B%c", " HLMEIG"[code]); + return p - output; + } + + if (cfg.funky_type == 5 && code >= 11 && code <= 24) { + p += sprintf((char *)p, "\x1B[%c", code + 'M' - 11); + return p - output; + } + if ((vt52_mode || cfg.funky_type == 4) && code >= 11 && code <= 24) { + int offt = 0; + if (code>15) offt++; if (code>21) offt++; + if (vt52_mode) + p += sprintf((char *)p, "\x1B%c", code + 'P' - 11 - offt); + else + p += sprintf((char *)p, "\x1BO%c", code + 'P' - 11 - offt); + return p - output; + } if (cfg.funky_type == 1 && code >= 11 && code <= 15) { p += sprintf((char *)p, "\x1B[[%c", code + 'A' - 11); return p - output; @@ -2427,6 +2448,8 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, return p-output; } + /* If we're definitly not building up an ALT-54321 then clear it */ + if (!left_alt) keys[0] = 0; } /* ALT alone may or may not want to bring up the System menu */ @@ -2637,6 +2660,15 @@ void fatalbox(char *fmt, ...) { * Beep. */ void beep(int mode) { - if (mode == 1) + if (mode == BELL_DEFAULT) { MessageBeep(MB_OK); + } else if (mode == BELL_WAVEFILE) { + if (!PlaySound(cfg.bell_wavefile, NULL, SND_ASYNC | SND_FILENAME)) { + char buf[sizeof(cfg.bell_wavefile)+80]; + sprintf(buf, "Unable to play sound file\n%s\n" + "Using default sound instead", cfg.bell_wavefile); + MessageBox(hwnd, buf, "PuTTY Sound Error", MB_OK | MB_ICONEXCLAMATION); + cfg.beep = BELL_DEFAULT; + } + } }