X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=window.c;h=e2107ec3df87156f2f7206c87fb6dce06f607ac2;hb=9c5951ed35cf9019bf17685b4356212eae1a63b3;hp=42e4d6d00772dc7920fd504b7b0589e68a97c815;hpb=94d35cead5b7347a361aef985ca86bf535b50c10;p=PuTTY.git diff --git a/window.c b/window.c index 42e4d6d0..e2107ec3 100644 --- a/window.c +++ b/window.c @@ -128,7 +128,7 @@ static char *window_name, *icon_name; static int compose_state = 0; -static OSVERSIONINFOEX osVersion; +static OSVERSIONINFO osVersion; /* Dummy routine, only required in plink. */ void ldisc_update(int echo, int edit) @@ -170,15 +170,12 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { ZeroMemory(&osVersion, sizeof(osVersion)); - osVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - - if(!GetVersionEx ((OSVERSIONINFO *) &osVersion)) { - // If OSVERSIONINFOEX doesn't work, try OSVERSIONINFO. - osVersion.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - if (!GetVersionEx ( (OSVERSIONINFO *) &osVersion)) - return FALSE; - } + if (!GetVersionEx ( (OSVERSIONINFO *) &osVersion)) { + MessageBox(NULL, "Windows refuses to report a version", + "PuTTY Fatal Error", MB_OK | MB_ICONEXCLAMATION); + return 1; + } } /* @@ -709,7 +706,7 @@ char *do_select(SOCKET skt, int startup) int msg, events; if (startup) { msg = WM_NETEVENT; - events = FD_READ | FD_WRITE | FD_OOB | FD_CLOSE; + events = FD_READ | FD_WRITE | FD_OOB | FD_CLOSE | FD_ACCEPT; } else { msg = events = 0; } @@ -1866,6 +1863,14 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, len = TranslateKey(message, wParam, lParam, buf); if (len == -1) return DefWindowProc(hwnd, message, wParam, lParam); + + /* + * We need not bother about stdin backlogs here, + * because in GUI PuTTY we can't do anything about + * it anyway; there's no means of asking Windows to + * hold off on KEYDOWN messages. We _have_ to + * buffer everything we're sent. + */ ldisc_send(buf, len); if (len > 0) @@ -3001,6 +3006,15 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam, luni_send(&keybuf, 1); } else { ch = (char) alt_sum; + /* + * We need not bother about stdin + * backlogs here, because in GUI PuTTY + * we can't do anything about it + * anyway; there's no means of asking + * Windows to hold off on KEYDOWN + * messages. We _have_ to buffer + * everything we're sent. + */ ldisc_send(&ch, 1); } alt_sum = 0;