summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qnsview.mm
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2016-12-22 14:33:29 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-01-02 14:47:05 +0000
commit4f76c2dbadb09a27cecaba5a36512f68fac3d319 (patch)
tree3cb816a27bdb54d5d4e54d0c22cd9b01726290fa /src/plugins/platforms/cocoa/qnsview.mm
parent997dd020c1e86c466f862d0f83da7d6474266d4a (diff)
Cocoa: make "Send correct mouse buttons for tablets" optional
Add an env variable QT_MAC_TABLET_IGNORE_BUTTON_MAPPING which, if set, reverts to the old behavior. The issues that it fixes are: 1) With a Genius tablet, it's not possible to generate a middle-click at all, regardless of preferences, unless you set this variable 2) With a Wacom mouse (passive mouse used with an Intuos 3), the side-buttons (normally mapped to forward and back buttons) do not work unless you set this variable [ChangeLog][macOS][Tablet support] If you have changed the button mapping of your Wacom tablet in System Preferences, it will be respected in Qt applications. To revert to the old behavior, set the environment variable QT_MAC_TABLET_IGNORE_BUTTON_MAPPING Task-number: QTBUG-57487 Task-number: QTBUG-54160 Change-Id: I0a1c9c6550e4dfe6ee2daa2d993f22691430826c Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 2e64204fb7..78287b482c 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1064,6 +1064,8 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
- (bool)handleTabletEvent: (NSEvent *)theEvent
{
+ static bool ignoreButtonMapping = qEnvironmentVariableIsSet("QT_MAC_TABLET_IGNORE_BUTTON_MAPPING");
+
if (!m_platformWindow)
return false;
@@ -1112,14 +1114,15 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
rotation -= 360.0;
Qt::KeyboardModifiers keyboardModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]];
+ Qt::MouseButtons buttons = ignoreButtonMapping ? static_cast<Qt::MouseButtons>(static_cast<uint>([theEvent buttonMask])) : m_buttons;
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>(m_buttons), pressure, xTilt, yTilt, rotation);
+ static_cast<uint>(buttons), pressure, xTilt, yTilt, rotation);
QWindowSystemInterface::handleTabletEvent(m_platformWindow->window(), timestamp, windowPoint, screenPoint,
- deviceData.device, deviceData.pointerType, m_buttons, pressure, xTilt, yTilt,
+ deviceData.device, deviceData.pointerType, buttons, pressure, xTilt, yTilt,
tangentialPressure, rotation, z, deviceData.uid,
keyboardModifiers);
return true;