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>bb10
parent
997dd020c1
commit
4f76c2dbad
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue