mirror of
https://github.com/fltk/fltk.git
synced 2026-05-22 07:01:34 +08:00
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
This commit is contained in:
+14
-18
@@ -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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
TranslateMessage(&fl_msg);
|
||||
DispatchMessageW(&fl_msg);
|
||||
have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE);
|
||||
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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user