xcb: set QTabletEvent's timestamp from the window system event
authorShawn Rutledge <shawn.rutledge@digia.com>
Wed, 19 Aug 2015 11:39:23 +0000 (13:39 +0200)
committerShawn Rutledge <shawn.rutledge@theqtcompany.com>
Mon, 24 Aug 2015 07:28:44 +0000 (07:28 +0000)
The intention is for it not to include any delays that Qt's event
processing has introduced.  And we are already doing it this way
for touch and scroll events.

Task-number: QTBUG-39459
Change-Id: Ie01cc2f8c6290ab66ef1b9180471afaa3da2e9da
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp

index 5a2ea742581967a6c5c7ca91579fbfa017a8d299..6ca369326b78e48931c1469b660ee43c84b53f38 100644 (file)
@@ -1029,9 +1029,8 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q
                             tabletData->inProximity = true;
                             tabletData->tool = toolIdToTabletDevice(tool);
                             tabletData->serialId = qint64(ptr[_WACSER_USB_ID]) << 32 | qint64(ptr[_WACSER_TOOL_SERIAL]);
-                            QWindowSystemInterface::handleTabletEnterProximityEvent(tabletData->tool,
-                                                                                    tabletData->pointerType,
-                                                                                    tabletData->serialId);
+                            QWindowSystemInterface::handleTabletEnterProximityEvent(ev->time,
+                                tabletData->tool, tabletData->pointerType, tabletData->serialId);
                         } else {
                             tabletData->inProximity = false;
                             tabletData->tool = toolIdToTabletDevice(ptr[_WACSER_LAST_TOOL_ID]);
@@ -1040,9 +1039,8 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData, Q
                             if (!tabletData->tool)
                                 tabletData->tool = toolIdToTabletDevice(ptr[_WACSER_LAST_TOOL_SERIAL]);
                             tabletData->serialId = qint64(ptr[_WACSER_USB_ID]) << 32 | qint64(ptr[_WACSER_LAST_TOOL_SERIAL]);
-                            QWindowSystemInterface::handleTabletLeaveProximityEvent(tabletData->tool,
-                                                                                    tabletData->pointerType,
-                                                                                    tabletData->serialId);
+                            QWindowSystemInterface::handleTabletLeaveProximityEvent(ev->time,
+                                tabletData->tool, tabletData->pointerType, tabletData->serialId);
                         }
                         // TODO maybe have a hash of tabletData->deviceId to device data so we can
                         // look up the tablet name here, and distinguish multiple tablets
@@ -1110,13 +1108,14 @@ void QXcbConnection::xi2ReportTabletEvent(TabletData &tabletData, void *event)
     }
 
     if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
-        qCDebug(lcQpaXInput, "XI2 event on tablet %d with tool %d type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
-            tabletData.deviceId, tabletData.tool, ev->evtype, ev->sequenceNumber, ev->detail,
+        qCDebug(lcQpaXInput, "XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d "
+            "pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
+            tabletData.deviceId, tabletData.tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time,
             fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y),
             fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y),
             (int)tabletData.buttons, pressure, xTilt, yTilt, rotation);
 
-    QWindowSystemInterface::handleTabletEvent(window, local, global,
+    QWindowSystemInterface::handleTabletEvent(window, ev->time, local, global,
                                               tabletData.tool, tabletData.pointerType,
                                               tabletData.buttons, pressure,
                                               xTilt, yTilt, tangentialPressure,