X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwinboard.c;h=3515cb3376143090cf4d840c54839a14ca954584;hb=63dc09b62c3a6430c671b8fd5ebd4be691167173;hp=088badbace5e7777aae9d1fd9c041fb6783a0c05;hpb=c7c73acb1eafed45587dd140ef7fdf518415edd9;p=xboard.git diff --git a/winboard/winboard.c b/winboard/winboard.c index 088badb..3515cb3 100644 --- a/winboard/winboard.c +++ b/winboard/winboard.c @@ -786,12 +786,14 @@ void ThawUI() * \*---------------------------------------------------------------------------*/ +static void HandleMessage P((MSG *message)); +static HANDLE hAccelMain, hAccelNoAlt, hAccelNoICS; + int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; - HANDLE hAccelMain, hAccelNoAlt, hAccelNoICS; // INITCOMMONCONTROLSEX ex; debugFP = stderr; @@ -823,6 +825,17 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 0, /* lowest message to examine */ 0)) /* highest message to examine */ { + HandleMessage(msg); + } + + + return (msg.wParam); /* Returns the value from PostQuitMessage */ +} + +static void +HandleMessage (MSG *message) +{ + MSG msg = *message; if(msg.message == WM_CHAR && msg.wParam == '\t') { // [HGM] navigate: switch between all windows with tab @@ -890,7 +903,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, if(currentElement < 5 && IsIconic(hwndMain)) ShowWindow(hwndMain, SW_RESTORE); // all open together SetFocus(h); - continue; // this message now has been processed + return; // this message now has been processed } } @@ -909,14 +922,24 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, if(chatHandle[i] && IsDialogMessage(chatHandle[i], &msg)) { done = 1; break; } - if(done) continue; // [HGM] chat: end patch + if(done) return; // [HGM] chat: end patch TranslateMessage(&msg); /* Translates virtual key codes */ DispatchMessage(&msg); /* Dispatches message to window */ } - } - +} - return (msg.wParam); /* Returns the value from PostQuitMessage */ +void +DoEvents () +{ /* Dispatch pending messages */ + MSG msg; + while (PeekMessage(&msg, /* message structure */ + NULL, /* handle of window receiving the message */ + 0, /* lowest message to examine */ + 0, /* highest message to examine */ + PM_REMOVE)) + { + HandleMessage(msg); + } } /*---------------------------------------------------------------------------*\