diff options
Diffstat (limited to 'src/corelib/kernel/qeventdispatcher_win.cpp')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 709e1494b9..a7663b2481 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -7,7 +7,6 @@ #include "qcoreapplication.h" #include <private/qsystemlibrary_p.h> #include "qoperatingsystemversion.h" -#include "qpair.h" #include "qset.h" #include "qsocketnotifier.h" #include "qvarlengtharray.h" @@ -56,6 +55,13 @@ class QEventDispatcherWin32Private; LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp); +static quint64 qt_msectime() +{ + using namespace std::chrono; + auto t = duration_cast<milliseconds>(steady_clock::now().time_since_epoch()); + return t.count(); +} + QEventDispatcherWin32Private::QEventDispatcherWin32Private() : interrupt(false), internalHwnd(0), sendPostedEventsTimerId(0), wakeUps(0), @@ -99,11 +105,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA if (dispatcher->filterNativeEvent(QByteArrayLiteral("windows_dispatcher_MSG"), &msg, &result)) return result; -#ifdef GWLP_USERDATA auto q = reinterpret_cast<QEventDispatcherWin32 *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); -#else - auto q = reinterpret_cast<QEventDispatcherWin32 *>(GetWindowLong(hwnd, GWL_USERDATA)); -#endif QEventDispatcherWin32Private *d = nullptr; if (q != nullptr) d = q->d_func(); @@ -133,7 +135,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA QSNDict *sn_vec[4] = { &d->sn_read, &d->sn_write, &d->sn_except, &d->sn_read }; QSNDict *dict = sn_vec[type]; - QSockNot *sn = dict ? dict->value(wp) : 0; + QSockNot *sn = dict ? dict->value(qintptr(wp)) : 0; if (sn == nullptr) { d->postActivateSocketNotifiers(); } else { @@ -289,11 +291,7 @@ static HWND qt_create_internal_window(const QEventDispatcherWin32 *eventDispatch return 0; } -#ifdef GWLP_USERDATA SetWindowLongPtr(wnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(eventDispatcher)); -#else - SetWindowLong(wnd, GWL_USERDATA, reinterpret_cast<LONG>(eventDispatcher)); -#endif return wnd; } @@ -410,7 +408,7 @@ void QEventDispatcherWin32Private::sendTimerEvent(int timerId) } } -void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event) +void QEventDispatcherWin32Private::doWsaAsyncSelect(qintptr socket, long event) { Q_ASSERT(internalHwnd); // BoundsChecker may emit a warning for WSAAsyncSelect when event == 0 @@ -559,7 +557,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags) void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); - int sockfd = notifier->socket(); + qintptr sockfd = notifier->socket(); int type = notifier->type(); #ifndef QT_NO_DEBUG if (sockfd < 0) { @@ -583,7 +581,7 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) const char *t[] = { "Read", "Write", "Exception" }; /* Variable "socket" below is a function pointer. */ qWarning("QSocketNotifier: Multiple socket notifiers for " - "same socket %d and type %s", sockfd, t[type]); + "same socket %" PRIdQINTPTR " and type %s", sockfd, t[type]); } QSockNot *sn = new QSockNot; @@ -627,7 +625,7 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier) { Q_ASSERT(notifier); #ifndef QT_NO_DEBUG - int sockfd = notifier->socket(); + qintptr sockfd = notifier->socket(); if (sockfd < 0) { qWarning("QEventDispatcherWin32::unregisterSocketNotifier: invalid socket identifier"); return; @@ -644,7 +642,7 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier { Q_D(QEventDispatcherWin32); int type = notifier->type(); - int sockfd = notifier->socket(); + qintptr sockfd = notifier->socket(); Q_ASSERT(sockfd >= 0); QSFDict::iterator it = d->active_fd.find(sockfd); @@ -772,7 +770,7 @@ QEventDispatcherWin32::registeredTimers(QObject *object) const Q_D(const QEventDispatcherWin32); QList<TimerInfo> list; - for (WinTimerInfo *t : qAsConst(d->timerDict)) { + for (WinTimerInfo *t : std::as_const(d->timerDict)) { Q_ASSERT(t); if (t->obj == object) list << TimerInfo(t->timerId, t->interval, t->timerType); @@ -840,7 +838,7 @@ void QEventDispatcherWin32::closingDown() Q_ASSERT(d->active_fd.isEmpty()); // clean up any timers - for (WinTimerInfo *t : qAsConst(d->timerDict)) + for (WinTimerInfo *t : std::as_const(d->timerDict)) d->unregisterTimer(t); d->timerDict.clear(); @@ -907,3 +905,5 @@ HWND QEventDispatcherWin32::internalHwnd() } QT_END_NAMESPACE + +#include "moc_qeventdispatcher_win_p.cpp" |