diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2020-06-02 18:03:36 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2020-06-03 19:36:34 +0300 |
commit | 33e6e5fac3c86805b1b4e744462645cac8c8a044 (patch) | |
tree | a30cf4e9757b9c32b15bc497537da2a09f4ea88b /src/corelib/kernel/qeventdispatcher_win.cpp | |
parent | b99ade85b0b11ce63be50b3a6c2eff8bcc04349d (diff) |
QEventDispatcherWin32: retrieve PM_REMOVE value as a bit flag
Windows unexpectedly passes PM_NOYIELD flag in wParam parameter to the
hook procedure, if ::PeekMessage(..., PM_REMOVE | PM_NOYIELD) is called
from the event loop. So, to ignore undocumented flag, we should
interpret wParam as a bit field.
Thanks to Robin Lobel for research.
Pick-to: 5.15
Fixes: QTBUG-84562
Change-Id: Ib16d7d747aebc9a3628e4ee67478c4d3edeb96f1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_win.cpp')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 6 |
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); |