Commit 37ad078c authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix handling a tablet when "Pan/Scroll" mode is assigned to a button

We should not handle tablet events when the driver uses them for some
other action, e.g. "Pan/Scroll".

NOTE: Wacom's "Pan/Scroll" feature generates only vertical wheel scroll
      events, so I would still recommend using usual Middle-button panning
      instead.

WARNING: Right now we still generate TabletMove events, even if we know
         that the driver has eaten that event! Not sure if it is the best
         approach.

BUG:334204
parent d67ed6da
......@@ -113,7 +113,24 @@ struct DefaultButtonsConverter : public KisTabletSupportWin::ButtonsConverter
int btn = 0x1 << i;
if (btn & btnNew) {
*buttons |= buttonValueToEnum(btn);
Qt::MouseButton convertedButton =
buttonValueToEnum(btn);
*buttons |= convertedButton;
/**
* If a button that is present in hardware input is
* mapped to a Qt::NoButton, it means that it is going
* to be eaten by the driver, for example by its
* "Pan/Scroll" feature. Therefore we shouldn't handle
* any of the events associated to it. So just return
* Qt::NoButton here.
*/
if (convertedButton == Qt::NoButton) {
*button = Qt::NoButton;
*buttons = Qt::NoButton;
break;
}
}
}
}
......@@ -360,10 +377,15 @@ bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf,
<< "Scaled:" << hiResGlobal;
#endif
Qt::MouseButton button = Qt::NoButton;
Qt::MouseButtons buttons;
globalButtonsConverter->convert(btnOld, btnNew, &button, &buttons);
t = KisTabletEvent::TabletMoveEx;
if (buttonPressed) {
if (buttonPressed && button != Qt::NoButton) {
t = KisTabletEvent::TabletPressEx;
} else if (buttonReleased) {
} else if (buttonReleased && button != Qt::NoButton) {
t = KisTabletEvent::TabletReleaseEx;
}
......@@ -442,11 +464,6 @@ bool translateTabletEvent(const MSG &msg, PACKET *localPacketBuf,
rotation = ort.orTwist;
}
Qt::MouseButton button = Qt::NoButton;
Qt::MouseButtons buttons;
globalButtonsConverter->convert(btnOld, btnNew, &button, &buttons);
KisTabletEvent e(t, localPos, globalPos, hiResGlobal, currentTabletPointer.currentDevice,
currentTabletPointer.currentPointerType, prsNew, tiltX, tiltY,
tangentialPressure, rotation, z, modifiers, currentTabletPointer.llId,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment