summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-12-14 17:46:49 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-12-14 17:46:49 (GMT)
commit36949134f109c72b8aba174ebf4d618f91a9f7ce (patch)
tree82242eeb9a5c4b822575cd358d2ae81e15bed53e /src/corelib/kernel
parent74bec871abb48baadf239fd12e77bb85924436a1 (diff)
parent463cd4f6563dc12d8b45bf2e293dc64d583e132c (diff)
downloadQt-36949134f109c72b8aba174ebf4d618f91a9f7ce.zip
Qt-36949134f109c72b8aba174ebf4d618f91a9f7ce.tar.gz
Qt-36949134f109c72b8aba174ebf4d618f91a9f7ce.tar.bz2
Merge commit 'origin/4.6' into 4.6
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcore_unix.cpp5
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp13
2 files changed, 16 insertions, 2 deletions
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 5885591..d0dc7be 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -129,7 +129,7 @@ static inline bool time_update(struct timeval *tv, const struct timeval &start,
// clock source is monotonic, so we can recalculate how much timeout is left
struct timeval now = qt_gettime();
*tv = timeout + start - now;
- return true;
+ return tv->tv_sec >= 0;
}
int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
@@ -154,7 +154,8 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
// recalculate the timeout
if (!time_update(&timeout, start, *orig_timeout)) {
- // clock reset, fake timeout error
+ // timeout during update
+ // or clock reset, fake timeout error
return 0;
}
}
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index c6eef5e..c305341 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -509,7 +509,11 @@ LRESULT CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
}
}
}
+#ifdef Q_OS_WINCE
+ return 0;
+#else
return CallNextHookEx(0, code, wp, lp);
+#endif
}
static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatcher)
@@ -636,11 +640,13 @@ void QEventDispatcherWin32::createInternalHwnd()
return;
d->internalHwnd = qt_create_internal_window(this);
+#ifndef Q_OS_WINCE
// setup GetMessage hook needed to drive our posted events
d->getMessageHook = SetWindowsHookEx(WH_GETMESSAGE, (HOOKPROC) qt_GetMessageHook, NULL, GetCurrentThreadId());
if (!d->getMessageHook) {
qFatal("Qt: INTERNALL ERROR: failed to install GetMessage hook");
}
+#endif
// register all socket notifiers
QList<int> sockets = (d->sn_read.keys().toSet()
@@ -731,6 +737,11 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
}
}
if (haveMessage) {
+#ifdef Q_OS_WINCE
+ // WinCE doesn't support hooks at all, so we have to call this by hand :(
+ (void) qt_GetMessageHook(0, PM_REMOVE, (LPARAM) &msg);
+#endif
+
if (d->internalHwnd == msg.hwnd && msg.message == WM_QT_SENDPOSTEDEVENTS) {
if (seenWM_QT_SENDPOSTEDEVENTS) {
needWM_QT_SENDPOSTEDEVENTS = true;
@@ -1065,9 +1076,11 @@ void QEventDispatcherWin32::closingDown()
d->timerVec.clear();
d->timerDict.clear();
+#ifndef Q_OS_WINCE
if (d->getMessageHook)
UnhookWindowsHookEx(d->getMessageHook);
d->getMessageHook = 0;
+#endif
}
bool QEventDispatcherWin32::event(QEvent *e)