Don't rely on getting WM_NULL messages in wxIdleWakeUpModule

Since the switch to using an event object for idle handling wakeup,
WM_NULLs are not being sent any longer, so wxIdleWakeUpModule didn't do
anything, resulting in pending event dispatching being paused while our
event loop was not running, as it happened, for example, while the
window was resized.

See #17579.
This commit is contained in:
Vadim Zeitlin
2018-01-13 17:33:09 +01:00
parent 91aed00288
commit 9b4759d7b6
5 changed files with 31 additions and 13 deletions

View File

@@ -7511,10 +7511,9 @@ bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam)
#endif // wxUSE_HOTKEY
// this class installs a message hook which really wakes up our idle processing
// each time a WM_NULL is received (wxWakeUpIdle does this), even if we're
// sitting inside a local modal loop (e.g. a menu is opened or scrollbar is
// being dragged or even inside ::MessageBox()) and so don't control message
// dispatching otherwise
// each time a message is handled, even if we're sitting inside a local modal
// loop (e.g. a menu is opened or scrollbar is being dragged or even inside
// ::MessageBox()) and so don't control message dispatching otherwise
class wxIdleWakeUpModule : public wxModule
{
public:
@@ -7545,15 +7544,11 @@ public:
static LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
MSG *msg = (MSG*)lParam;
// only process the message if it is actually going to be removed from
// the message queue, this prevents that the same event from being
// processed multiple times if now someone just called PeekMessage()
if ( msg->message == WM_NULL && wParam == PM_REMOVE )
{
wxTheApp->ProcessPendingEvents();
}
// Don't process idle events unless the message is going to be really
// handled, i.e. removed from the queue, as it seems wrong to do it
// just because someone called PeekMessage(PM_NOREMOVE).
if ( wParam == PM_REMOVE )
wxTheApp->MSWProcessPendingEventsIfNeeded();
return CallNextHookEx(ms_hMsgHookProc, nCode, wParam, lParam);
}