diff options
| author | Pierre Ossman <ossman@cendio.se> | 2014-09-15 09:14:07 +0000 |
|---|---|---|
| committer | Pierre Ossman <ossman@cendio.se> | 2014-09-15 09:14:07 +0000 |
| commit | 321fb4ed7aa9e36e3b2fc5c95c3c2c3652179366 (patch) | |
| tree | a067068935c899a05c9f1a428b65dbcfd9599b2b /src | |
| parent | 0356bd257c9fe072be9dff143e6907e8056b320a (diff) | |
Clean up Win32 message pump. The logic was a bit overly complex
with the double calls to PeekMessage() and the extra if clause.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10309 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_win32.cxx | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 79b300fb4..0dfde6297 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -401,26 +401,22 @@ int fl_wait(double time_to_wait) { // Execute the message we got, and all other pending messages: // have_message = PeekMessage(&fl_msg, NULL, 0, 0, PM_REMOVE); - have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE); - if (have_message > 0) { - while (have_message != 0 && have_message != -1) { - // Let applications treat WM_QUIT identical to SIGTERM on *nix - if (fl_msg.message == WM_QUIT) - raise(SIGTERM); - if (fl_msg.message == fl_wake_msg) { - // Used for awaking wait() from another thread - thread_message_ = (void*)fl_msg.wParam; - Fl_Awake_Handler func; - void *data; - while (Fl::get_awake_handler_(func, data)==0) { - func(data); - } - } - - TranslateMessage(&fl_msg); - DispatchMessageW(&fl_msg); - have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE); + while ((have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE)) > 0) { + // Let applications treat WM_QUIT identical to SIGTERM on *nix + if (fl_msg.message == WM_QUIT) + raise(SIGTERM); + + if (fl_msg.message == fl_wake_msg) { + // Used for awaking wait() from another thread + thread_message_ = (void*)fl_msg.wParam; + Fl_Awake_Handler func; + void *data; + while (Fl::get_awake_handler_(func, data)==0) + func(data); } + + TranslateMessage(&fl_msg); + DispatchMessageW(&fl_msg); } Fl::flush(); |
