diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index a18ee7ff71..011a9ba71a 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -57,13 +57,17 @@ #include <QtCore/QDebug> #include <private/qguiapplication_p.h> #include "qcocoabackingstore.h" +#ifndef QT_NO_OPENGL #include "qcocoaglcontext.h" +#endif #include "qcocoaintegration.h" #ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR #include <accessibilityinspector.h> #endif +Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.tabletsupport") + static QTouchDevice *touchDevice = 0; // ### HACK Remove once 10.8 is unsupported @@ -143,8 +147,10 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; m_frameStrutButtons = Qt::NoButton; m_sendKeyEvent = false; m_subscribesForGlobalFrameNotifications = false; +#ifndef QT_NO_OPENGL m_glContext = 0; m_shouldSetGLContextinDrawRect = false; +#endif currentCustomDragTypes = 0; m_sendUpAsRightButton = false; m_inputSource = 0; @@ -210,6 +216,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; return self; } +#ifndef QT_NO_OPENGL - (void) setQCocoaGLContext:(QCocoaGLContext *)context { m_glContext = context; @@ -231,6 +238,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; object:self]; } } +#endif - (void) globalFrameChanged:(NSNotification*)notification { @@ -516,10 +524,12 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - (void) drawRect:(NSRect)dirtyRect { +#ifndef QT_NO_OPENGL if (m_glContext && m_shouldSetGLContextinDrawRect) { [m_glContext->nsOpenGLContext() setView:self]; m_shouldSetGLContextinDrawRect = false; } +#endif if (m_platformWindow->m_drawContentBorderGradient) NSDrawWindowBackground(dirtyRect); @@ -986,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<Qt::MouseButtons>(static_cast<uint>([theEvent buttonMask])); qreal tangentialPressure = 0; qreal rotation = 0; int z = 0; @@ -993,14 +1004,21 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash) z = [theEvent absoluteZ]; if (deviceData.capabilityMask & 0x0800) - tangentialPressure = [theEvent tangentialPressure]; + tangentialPressure = ([theEvent tangentialPressure] * 2.0) - 1.0; - rotation = [theEvent rotation]; + rotation = 360.0 - [theEvent rotation]; + if (rotation > 180.0) + rotation -= 360.0; 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<uint>(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); } @@ -1092,6 +1110,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 { |