From 9a096cba223936c81c2c3392265681c78e63617e Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 28 Jul 2014 15:17:48 +0200 Subject: OS X: add buttons to tablet events Task-number: QTBUG-39458 Change-Id: I112107e392bf3b55771039b72271fdf887e2e5db Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/cocoa/qnsview.mm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 66ef16d2b3..2b437240df 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -66,6 +66,8 @@ #include #endif +Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.tabletsupport") + static QTouchDevice *touchDevice = 0; // ### HACK Remove once 10.8 is unsupported @@ -994,6 +996,7 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) NSPoint tilt = [theEvent tilt]; int xTilt = qRound(tilt.x * 60.0); int yTilt = qRound(tilt.y * -60.0); + Qt::MouseButtons buttons = static_cast(static_cast([theEvent buttonMask])); qreal tangentialPressure = 0; qreal rotation = 0; int z = 0; @@ -1007,8 +1010,13 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) Qt::KeyboardModifiers keyboardModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]]; - QWindowSystemInterface::handleTabletEvent(m_window, timestamp, down, windowPoint, screenPoint, - deviceData.device, deviceData.pointerType, pressure, xTilt, yTilt, + qCDebug(lcQpaTablet, "event on tablet %d with tool %d type %d unique ID %lld pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf", + deviceId, deviceData.device, deviceData.pointerType, deviceData.uid, + windowPoint.x(), windowPoint.y(), screenPoint.x(), screenPoint.y(), + static_cast(buttons), pressure, xTilt, yTilt, rotation); + + QWindowSystemInterface::handleTabletEvent(m_window, timestamp, windowPoint, screenPoint, + deviceData.device, deviceData.pointerType, buttons, pressure, xTilt, yTilt, tangentialPressure, rotation, z, deviceData.uid, keyboardModifiers); } @@ -1100,6 +1108,9 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent) tabletDeviceDataHash->remove(deviceId); } + qCDebug(lcQpaTablet, "proximity change on tablet %d: current tool %d type %d unique ID %lld", + deviceId, deviceData.device, deviceData.pointerType, deviceData.uid); + if (entering) { QWindowSystemInterface::handleTabletEnterProximityEvent(timestamp, deviceData.device, deviceData.pointerType, deviceData.uid); } else { -- cgit v1.2.3