summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2010-08-30 12:57:06 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2010-08-30 12:57:06 (GMT)
commiteb1015c7bbf135af3656110a4d112377c1209db8 (patch)
tree3d141b8f98941fd46ca7c02b1f59226c888f5916 /src
parent46194955b223b65b08c300325d6de0620817aa04 (diff)
downloadQt-eb1015c7bbf135af3656110a4d112377c1209db8.zip
Qt-eb1015c7bbf135af3656110a4d112377c1209db8.tar.gz
Qt-eb1015c7bbf135af3656110a4d112377c1209db8.tar.bz2
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
Diffstat (limited to 'src')
-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 8010a76..f63fa1d 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));