Migrate QWindowSystemInterface to use QElapsedTimer
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Fri, 9 Mar 2012 12:26:43 +0000 (14:26 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 12 Mar 2012 12:14:05 +0000 (13:14 +0100)
Change-Id: I7dfb0590dce79678d49f5d6ef8f60758719bcf72
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/kernel/qguiapplication.cpp
src/gui/kernel/qwindowsysteminterface_qpa.cpp
src/gui/kernel/qwindowsysteminterface_qpa_p.h

index bfc52a8..26690c7 100644 (file)
@@ -696,6 +696,8 @@ void QGuiApplicationPrivate::init()
     // trigger registering of QVariant's GUI types
     qRegisterGuiVariant();
 
+    QWindowSystemInterfacePrivate::eventTime.start();
+
     is_app_running = true;
     init_plugins(pluginList);
     QWindowSystemInterface::sendWindowSystemEvents(QCoreApplicationPrivate::eventDispatcher, QEventLoop::AllEvents);
index 6f0abbd..be9ac8e 100644 (file)
@@ -49,7 +49,7 @@
 QT_BEGIN_NAMESPACE
 
 
-QTime QWindowSystemInterfacePrivate::eventTime;
+QElapsedTimer QWindowSystemInterfacePrivate::eventTime;
 
 //------------------------------------------------------------
 //
@@ -266,10 +266,6 @@ void QWindowSystemInterfacePrivate::queueWindowSystemEvent(QWindowSystemInterfac
     windowSystemEventQueue.append(ev);
     queueMutex.unlock();
 
-    // Make sure the event timer is started.
-    if (!QWindowSystemInterfacePrivate::eventTime.isValid())
-      QWindowSystemInterfacePrivate::eventTime.start();
-
     QAbstractEventDispatcher *dispatcher = QGuiApplicationPrivate::qt_qpa_core_dispatcher();
     if (dispatcher)
         dispatcher->wakeUp();
index f5c141b..fe97b48 100644 (file)
@@ -42,6 +42,7 @@
 #define QWINDOWSYSTEMINTERFACE_QPA_P_H
 
 #include "qwindowsysteminterface_qpa.h"
+#include <QElapsedTimer>
 
 QT_BEGIN_HEADER
 
@@ -272,7 +273,7 @@ public:
     static WindowSystemEvent * getWindowSystemEvent();
     static void queueWindowSystemEvent(WindowSystemEvent *ev);
 
-    static QTime eventTime;
+    static QElapsedTimer eventTime;
 
     static QList<QTouchEvent::TouchPoint> convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type);
 };