Mercurial > hg > xemacs-beta
diff src/event-msw.c @ 923:3b122a8e1d51
[xemacs-hg @ 2002-07-14 23:20:35 by mta]
event-msw.c (mswindows_need_event): Don't wait for a new message if the
queue is not empty. Suggested by Paul Moore.
author | mta |
---|---|
date | Sun, 14 Jul 2002 23:20:36 +0000 |
parents | 4a27df428c73 |
children | 8d610ea37af8 |
line wrap: on
line diff
--- a/src/event-msw.c Sun Jul 14 23:09:40 2002 +0000 +++ b/src/event-msw.c Sun Jul 14 23:20:36 2002 +0000 @@ -1622,10 +1622,24 @@ __try { - active = MsgWaitForMultipleObjects (mswindows_waitable_count, - mswindows_waitable_handles, - FALSE, badly_p ? INFINITE : 0, - what_events); + /* This fixes a long outstanding bug, where XEmacs would occasionally + * not redraw its window (or process other events) until "something + * happened" - usually the mouse moving over a frame. + * + * The problem is that MsgWaitForMultipleObjects only checks to see + * if NEW messages have been placed into the thread queue. So we + * specifically check to see if the queue is empty (using PeekMessage + * with the PM_NOREMOVE flag) before we wait. + */ + MSG msg; + if (what_events == QS_ALLINPUT && badly_p && + qxePeekMessage (&msg, 0, 0, 0, PM_NOREMOVE)) + active = WAIT_OBJECT_0 + mswindows_waitable_count; + else + active = MsgWaitForMultipleObjects (mswindows_waitable_count, + mswindows_waitable_handles, + FALSE, badly_p ? INFINITE : 0, + what_events); } __except (GetExceptionCode () == EXCEPTION_BREAKPOINT ? EXCEPTION_CONTINUE_EXECUTION :