summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2010-08-30 14:57:06 +0200
committerSamuli Piippo <samuli.piippo@digia.com>2011-06-09 13:07:13 +0300
commit352bdb7a648c2e37612a9640df52ac9ad5429255 (patch)
tree03c2e5ed3f904c3d5c75ee44b5dcc725c44dab92
parentb97f0bdf4b699bb4b3fe0758f5b04b6d74340491 (diff)
Fix Qt applications freezing until mouse/keyboard events occur.
While the qt_GetMessageHook() is executing, GetQueueStatus() reports that there are timer messages in the queue, but these are never actually seen by the hook. Calling PeekMessage() will never return these messages (which is what we really want to know), so don't use GetQueueStatus() with QS_TIMER. Task-number: QTBUG-12721 Reviewed-by: denis Reviewed-by: joao
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 6559e51b7b..23eb319f1a 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -65,7 +65,11 @@ extern uint qGlobalPostedEventsCount();
#endif
#ifndef QS_RAWINPUT
+# ifdef Q_OS_WINCE
+# define QS_RAWINPUT 0x0000
+# else
# define QS_RAWINPUT 0x0400
+# endif
#endif
#ifndef WM_TOUCH
@@ -78,8 +82,7 @@ extern uint qGlobalPostedEventsCount();
enum {
WM_QT_SOCKETNOTIFIER = WM_USER,
- WM_QT_SENDPOSTEDEVENTS = WM_USER + 1,
- SendPostedEventsTimerId = ~1u
+ WM_QT_SENDPOSTEDEVENTS = WM_USER + 1
};
#if defined(Q_OS_WINCE)
@@ -503,7 +506,9 @@ LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
if (q) {
QEventDispatcherWin32Private *d = q->d_func();
int localSerialNumber = d->serialNumber;
- if (HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT | QS_TIMER)) == 0) {
+ MSG unused;
+ if ((HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT)) == 0
+ && PeekMessage(&unused, 0, WM_TIMER, WM_TIMER, PM_NOREMOVE) == 0)) {
// no more input or timer events in the message queue, we can allow posted events to be
// sent now
(void) d->wakeUps.fetchAndStoreRelease(0);
@@ -799,7 +804,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
pHandles[i] = d->winEventNotifierList.at(i)->handle();
emit aboutToBlock();
- waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE);
+ waitRet = MsgWaitForMultipleObjectsEx(nCount, pHandles, INFINITE, QS_ALLINPUT, MWMO_ALERTABLE | MWMO_INPUTAVAILABLE);
emit awake();
if (waitRet >= WAIT_OBJECT_0 && waitRet < WAIT_OBJECT_0 + nCount) {
d->activateEventNotifier(d->winEventNotifierList.at(waitRet - WAIT_OBJECT_0));