X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/c44bf5bd7bf680c21356864ac5ae72ab29e55ce6..bf133a73a78d9ea39ff5cd50dfea926253ec021a:/window.c diff --git a/window.c b/window.c index 32ed507f..794efc20 100644 --- a/window.c +++ b/window.c @@ -636,7 +636,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) * Start up the telnet connection. */ { - char *error; + const char *error; char msg[1024], *title; char *realhost; @@ -930,13 +930,15 @@ void set_raw_mouse_mode(void *frontend, int activate) void connection_fatal(void *frontend, char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Fatal Error", appname); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); + sfree(stuff); + if (cfg.close_on_exit == FORCE_ON) PostQuitMessage(1); else { @@ -953,13 +955,14 @@ void connection_fatal(void *frontend, char *fmt, ...) void cmdline_error(char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Command Line Error", appname); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); + sfree(stuff); exit(1); } @@ -3534,6 +3537,10 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, *p++ = 0x1C; return p - output; } + if (shift_state == 3 && wParam == 0xDE) { + *p++ = 0x1E; /* Ctrl-~ == Ctrl-^ in xterm at least */ + return p - output; + } if (shift_state == 0 && wParam == VK_RETURN && term->cr_lf_return) { *p++ = '\r'; *p++ = '\n'; @@ -3869,9 +3876,10 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, ldisc_send(ldisc, &ch, 1, 1); } alt_sum = 0; - } else + } else { term_seen_key_event(term); lpage_send(ldisc, kbd_codepage, &ch, 1, 1); + } } else { if(capsOn && ch < 0x80) { WCHAR cbuf[2]; @@ -4302,13 +4310,14 @@ void optimised_move(void *frontend, int to, int from, int lines) void fatalbox(char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Fatal Error", appname); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); + sfree(stuff); cleanup_exit(1); } @@ -4318,14 +4327,15 @@ void fatalbox(char *fmt, ...) void modalfatalbox(char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Fatal Error", appname); MessageBox(hwnd, stuff, morestuff, MB_SYSTEMMODAL | MB_ICONERROR | MB_OK); + sfree(stuff); cleanup_exit(1); } @@ -4401,6 +4411,23 @@ void beep(void *frontend, int mode) MB_OK | MB_ICONEXCLAMATION); cfg.beep = BELL_DEFAULT; } + } else if (mode == BELL_PCSPEAKER) { + static long lastbeep = 0; + long beepdiff; + + beepdiff = GetTickCount() - lastbeep; + if (beepdiff >= 0 && beepdiff < 50) + return; + + /* + * We must beep in different ways depending on whether this + * is a 95-series or NT-series OS. + */ + if(osVersion.dwPlatformId == VER_PLATFORM_WIN32_NT) + Beep(800, 100); + else + MessageBeep(-1); + lastbeep = GetTickCount(); } /* Otherwise, either visual bell or disabled; do nothing here */ if (!term->has_focus) {