summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qeventdispatcher_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_win.cpp')
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index d9b9d84e41..43872fd027 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -277,9 +277,13 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
Q_ASSERT(q != 0);
QEventDispatcherWin32Private *d = q->d_func();
MSG *msg = reinterpret_cast<MSG *>(lp);
+ // Windows unexpectedly passes PM_NOYIELD flag to the hook procedure,
+ // if ::PeekMessage(..., PM_REMOVE | PM_NOYIELD) is called from the event loop.
+ // So, retrieve 'removed' tag as a bit field.
+ const bool messageRemoved = (wp & PM_REMOVE) != 0;
if (msg->hwnd == d->internalHwnd && msg->message == WM_QT_SENDPOSTEDEVENTS
- && wp == PM_REMOVE && d->sendPostedEventsTimerId == 0) {
+ && messageRemoved && d->sendPostedEventsTimerId == 0) {
// Start a timer to deliver posted events when the message queue is emptied.
d->sendPostedEventsTimerId = SetTimer(d->internalHwnd, SendPostedEventsTimerId,
USER_TIMER_MINIMUM, NULL);