Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
draft: try to move touch painting code to KisShortcutMatcher
Dmitry Kazakov6ce974708a34
diff --git a/libs/ui/input/kis_abstract_shortcut.h b/libs/ui/input/kis_abstract_shortcut.hindex 6de355c258..3c02d0c689 100644--- a/libs/ui/input/kis_abstract_shortcut.h+++ b/libs/ui/input/kis_abstract_shortcut.h@@ -48,7 +48,7 @@ public:/*** Returns true if the shortcut is enabled at the moment*/- bool isAvailable(KisInputActionGroupsMask mask) const;+ virtual bool isAvailable(KisInputActionGroupsMask mask) const;protected:bool compareKeys(const QSet<Qt::Key> &keys1,diff --git a/libs/ui/input/kis_input_manager.cpp b/libs/ui/input/kis_input_manager.cppindex 62e7b19c7a..aaf6a37a4b 100644--- a/libs/ui/input/kis_input_manager.cpp+++ b/libs/ui/input/kis_input_manager.cpp@@ -30,12 +30,13 @@#include "kis_abstract_input_action.h"#include "kis_tool_invocation_action.h"-#include "kis_pan_action.h"-#include "kis_alternate_invocation_action.h"-#include "kis_rotate_canvas_action.h"-#include "kis_zoom_action.h"-#include "KisPopupWidgetAction.h"-#include "kis_change_primary_setting_action.h"+// #include "kis_pan_action.h"+// #include "kis_alternate_invocation_action.h"+// #include "kis_rotate_canvas_action.h"+// #include "kis_zoom_action.h"+// #include "KisPopupWidgetAction.h"+// #include "kis_change_primary_setting_action.h"+#include "KisPopupWidgetInterface.h"#include "kis_shortcut_matcher.h"#include "kis_stroke_shortcut.h"@@ -811,21 +812,22 @@ bool KisInputManager::eventFilterImpl(QEvent * event)QTouchEvent *touchEvent = static_cast<QTouchEvent*>(event);retval = d->matcher.touchEndEvent(touchEvent);- if (d->touchStrokeStarted) {- retval = d->matcher.buttonReleased(Qt::LeftButton, touchEvent);- d->startingPos = {0, 0};- d->previousPos = {0, 0};- d->touchStrokeStarted = false; // stroke ended- } else if (!d->touchStrokeBlocked- && !KisConfig(true).disableTouchOnCanvas() && !d->touchHasBlockedPressEvents- && touchEvent->touchPoints().count() == 1) {- // If no stroke has been started while touch painting is enabled,- // the user tapped with one finger, but didn't make any motion that- // caused us to start a stroke. We produce a press and release in- // response so that the tool responds to their input.- d->matcher.buttonPressed(Qt::LeftButton, d->originatingTouchBeginEvent.data());- d->matcher.buttonReleased(Qt::LeftButton, touchEvent);- }++ // if (d->touchStrokeStarted) {+ // retval = d->matcher.buttonReleased(Qt::LeftButton, touchEvent);+ // d->startingPos = {0, 0};+ // d->previousPos = {0, 0};+ // d->touchStrokeStarted = false; // stroke ended+ // } else if (!d->touchStrokeBlocked+ // && !KisConfig(true).disableTouchOnCanvas() && !d->touchHasBlockedPressEvents+ // && touchEvent->touchPoints().count() == 1) {+ // // If no stroke has been started while touch painting is enabled,+ // // the user tapped with one finger, but didn't make any motion that+ // // caused us to start a stroke. We produce a press and release in+ // // response so that the tool responds to their input.+ // d->matcher.buttonPressed(Qt::LeftButton, d->originatingTouchBeginEvent.data());+ // d->matcher.buttonReleased(Qt::LeftButton, touchEvent);+ // }endTouch();d->allowMouseEvents();@@ -960,25 +962,29 @@ bool KisInputManager::handleTouchBegin(QTouchEvent *touchEvent)bool KisInputManager::handleTouchUpdate(QTouchEvent *touchEvent){QPointF currentPos = touchEvent->touchPoints().at(0).pos();- if (d->touchStrokeStarted- || (!d->touchStrokeBlocked- && !KisConfig(true).disableTouchOnCanvas() && !d->touchHasBlockedPressEvents- && touchEvent->touchPoints().count() == 1 && touchEvent->touchPointStates() != Qt::TouchPointStationary- && (qAbs(currentPos.x() - d->previousPos.x()) > 1 // stop wobbliness which Qt sends us- || qAbs(currentPos.y() - d->previousPos.y()) > 1))) {- d->previousPos = currentPos;- if (!d->touchStrokeStarted) {- // we start it here not in TouchBegin, because Qt::TouchPointStationary doesn't work with hpdi devices.- bool retval = d->matcher.buttonPressed(Qt::LeftButton, d->originatingTouchBeginEvent.data());- d->touchStrokeStarted = retval;- return retval;- } else {- // if it is a full-fledged stroke, then ignore (currentPos.x - previousPos.x)- bool retval = compressMoveEventCommon(touchEvent);- d->blockMouseEvents();- return retval;- }- } else {++ // TODO: lower threshold for touch painting!++ // if (d->touchStrokeStarted+ // || (!d->touchStrokeBlocked+ // && !KisConfig(true).disableTouchOnCanvas() && !d->touchHasBlockedPressEvents+ // && touchEvent->touchPoints().count() == 1 && touchEvent->touchPointStates() != Qt::TouchPointStationary+ // && (qAbs(currentPos.x() - d->previousPos.x()) > 1 // stop wobbliness which Qt sends us+ // || qAbs(currentPos.y() - d->previousPos.y()) > 1))) {+ // d->previousPos = currentPos;+ // if (!d->touchStrokeStarted) {+ // // we start it here not in TouchBegin, because Qt::TouchPointStationary doesn't work with hpdi devices.+ // bool retval = d->matcher.buttonPressed(Qt::LeftButton, d->originatingTouchBeginEvent.data());+ // d->touchStrokeStarted = retval;+ // return retval;+ // } else {+ // // if it is a full-fledged stroke, then ignore (currentPos.x - previousPos.x)+ // bool retval = compressMoveEventCommon(touchEvent);+ // d->blockMouseEvents();+ // return retval;+ // }+ // } else+ {KisAbstractInputAction::setInputManager(this);bool retval = d->matcher.touchUpdateEvent(touchEvent);d->touchHasBlockedPressEvents = retval;@@ -1090,6 +1096,19 @@ void KisInputManager::profileChanged()break;}}++ {+ KisAbstractInputAction *action = profile->actionForId("Tool Invocation");+ if (action) {+#ifndef Q_OS_MACOS+ // Touch painting shortcuts+ d->addTouchShortcut(action, KisToolInvocationAction::ActivateShortcut, KisShortcutConfiguration::OneFingerDrag, true);+ d->addTouchShortcut(action, KisToolInvocationAction::ActivateShortcut, KisShortcutConfiguration::OneFingerTap, true);+#else+ // TODO: implement code for MacOS!+#endif+ }+ }}else {dbgInput << "No Input Profile Found: canvas interaction will be impossible";diff --git a/libs/ui/input/kis_input_manager_p.cpp b/libs/ui/input/kis_input_manager_p.cppindex 813495d574..a79d818868 100644--- a/libs/ui/input/kis_input_manager_p.cpp+++ b/libs/ui/input/kis_input_manager_p.cpp@@ -558,10 +558,13 @@ void KisInputManager::Private::addWheelShortcut(KisAbstractInputAction* action,matcher.addShortcut(keyShortcut.release());}-void KisInputManager::Private::addTouchShortcut(KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture)+void KisInputManager::Private::addTouchShortcut(KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture, bool isTouchPainting){KisTouchShortcut *shortcut = new KisTouchShortcut(action, index, gesture);- dbgKrita << "TouchAction:" << action->name();+ if (isTouchPainting) {+ shortcut->setIsTouchPainting(true);+ }+ dbgKrita << "TouchAction:" << action->name() << (isTouchPainting ? "touch-painting" : "");switch(gesture) {#ifndef Q_OS_MACOScase KisShortcutConfiguration::OneFingerTap:@@ -570,7 +573,7 @@ void KisInputManager::Private::addTouchShortcut(KisAbstractInputAction* action,// disable this type of shortcut when touch painting is active. Except// touch hold shortcuts, since touching and holding in one spot does// nothing otherwise and is therefore unambiguous.- shortcut->setDisableOnTouchPainting(true);+ //shortcut->setDisableOnTouchPainting(true);Q_FALLTHROUGH();case KisShortcutConfiguration::OneFingerHold:shortcut->setMinimumTouchPoints(1);diff --git a/libs/ui/input/kis_input_manager_p.h b/libs/ui/input/kis_input_manager_p.hindex ea93cbca36..9a766704d2 100644--- a/libs/ui/input/kis_input_manager_p.h+++ b/libs/ui/input/kis_input_manager_p.h@@ -34,7 +34,7 @@ public:Private(KisInputManager *qq);void addStrokeShortcut(KisAbstractInputAction* action, int index, const QList< Qt::Key >& modifiers, Qt::MouseButtons buttons);void addKeyShortcut(KisAbstractInputAction* action, int index,const QList<Qt::Key> &keys);- void addTouchShortcut( KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture );+ void addTouchShortcut( KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture, bool isTouchPainting = false);bool addNativeGestureShortcut( KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture );void addWheelShortcut(KisAbstractInputAction* action, int index, const QList< Qt::Key >& modifiers, KisShortcutConfiguration::MouseWheelMovement wheelAction);bool processUnhandledEvent(QEvent *event);diff --git a/libs/ui/input/kis_input_profile.cpp b/libs/ui/input/kis_input_profile.cppindex daaf08f4f8..9129877bda 100644--- a/libs/ui/input/kis_input_profile.cpp+++ b/libs/ui/input/kis_input_profile.cpp@@ -53,6 +53,16 @@ QList< KisShortcutConfiguration * > KisInputProfile::allShortcuts() constreturn d->shortcuts.values();}+KisAbstractInputAction* KisInputProfile::actionForId(const QString &id) const+{+ for (auto it = d->shortcuts.begin(); it != d->shortcuts.end(); ++it) {+ if (it.key()->id() == id) {+ return it.key();+ }+ }+ return nullptr;+}+QList< KisShortcutConfiguration * > KisInputProfile::shortcutsForAction(KisAbstractInputAction *action) const{if (d->shortcuts.contains(action)) {diff --git a/libs/ui/input/kis_input_profile.h b/libs/ui/input/kis_input_profile.hindex c34861d053..8b1a35d62e 100644--- a/libs/ui/input/kis_input_profile.h+++ b/libs/ui/input/kis_input_profile.h@@ -41,6 +41,12 @@ public:* \return A list of all shortcuts available.*/QList<KisShortcutConfiguration *> allShortcuts() const;++ /**+ * Return the action object for a specific \p id+ */+ KisAbstractInputAction* actionForId(const QString &id) const;+/*** \return A list of shortcuts associated with the given action.*diff --git a/libs/ui/input/kis_touch_shortcut.cpp b/libs/ui/input/kis_touch_shortcut.cppindex 2cfffa7476..1fd5942634 100644--- a/libs/ui/input/kis_touch_shortcut.cpp+++ b/libs/ui/input/kis_touch_shortcut.cpp@@ -20,12 +20,14 @@ public:, maxTouchPoints(0), type(type), disableOnTouchPainting(false)+ , isTouchPainting(false){ }int minTouchPoints;int maxTouchPoints;GestureAction type;bool disableOnTouchPainting;+ bool isTouchPainting;};KisTouchShortcut::KisTouchShortcut(KisAbstractInputAction* action, int index, GestureAction type)@@ -42,7 +44,7 @@ KisTouchShortcut::~KisTouchShortcut()int KisTouchShortcut::priority() const{- return action()->priority();+ return d->isTouchPainting ? std::numeric_limits<int>::max() : action()->priority();}bool KisTouchShortcut::isHoldType() const@@ -69,6 +71,24 @@ void KisTouchShortcut::setDisableOnTouchPainting(bool disableOnTouchPainting)d->disableOnTouchPainting = disableOnTouchPainting;}+void KisTouchShortcut::setIsTouchPainting(bool value)+{+ d->isTouchPainting = value;+}++bool KisTouchShortcut::isAvailable(KisInputActionGroupsMask mask) const+{+ if (d->isTouchPainting && KisConfig(true).disableTouchOnCanvas()) {+ return false;+ }++ // if (d->disableOnTouchPainting && !KisConfig(true).disableTouchOnCanvas()) {+ // return false;+ // }++ return KisAbstractShortcut::isAvailable(mask);+}+bool KisTouchShortcut::matchTapType(QTouchEvent *event, Qt::TouchPointStates allowedStates){return matchTouchPoint(event, allowedStates)@@ -115,6 +135,6 @@ bool KisTouchShortcut::matchTouchPoint(QTouchEvent *event, Qt::TouchPointStates{const int numStillActivePoints = countTouchPoints(event, allowedStates);- return (!d->disableOnTouchPainting || KisConfig(true).disableTouchOnCanvas())- && numStillActivePoints >= d->minTouchPoints && numStillActivePoints <= d->maxTouchPoints;+ return /*(!d->disableOnTouchPainting || KisConfig(true).disableTouchOnCanvas())+ &&*/ numStillActivePoints >= d->minTouchPoints && numStillActivePoints <= d->maxTouchPoints;}diff --git a/libs/ui/input/kis_touch_shortcut.h b/libs/ui/input/kis_touch_shortcut.hindex 846ea15c1e..065fa03a6f 100644--- a/libs/ui/input/kis_touch_shortcut.h+++ b/libs/ui/input/kis_touch_shortcut.h@@ -28,11 +28,14 @@ class KRITAUI_EXPORT KisTouchShortcut : public KisAbstractShortcutint priority() const override;bool isHoldType() const;+ bool isAvailable(KisInputActionGroupsMask mask) const override;void setMinimumTouchPoints( int min );void setMaximumTouchPoints( int max );void setDisableOnTouchPainting(bool disableOnTouchPainting);+ void setIsTouchPainting(bool value);+bool matchTapType(QTouchEvent *event, Qt::TouchPointStates allowedStates);bool matchDragType(QTouchEvent *event, Qt::TouchPointStates allowedStates);bool matchHoldType(QTouchEvent *event, Qt::TouchPointStates allowedStates);diff --git a/libs/ui/tests/kis_input_manager_test.cpp b/libs/ui/tests/kis_input_manager_test.cppindex d0b942a025..e65d02ec7b 100644--- a/libs/ui/tests/kis_input_manager_test.cpp+++ b/libs/ui/tests/kis_input_manager_test.cpp@@ -74,11 +74,11 @@ struct TestingAction : public KisAbstractInputActionRunning};- TestingAction()- : KisAbstractInputAction("TestingAction")+ TestingAction(const QString &id = "test")+ : KisAbstractInputAction(id), m_isHighResolution(false){- setName("testing touch action");+ setName(id);reset();}~TestingAction() {}@@ -192,7 +192,7 @@ KisTouchShortcut* createTouchShortcut(KisAbstractInputAction *action,// disable this type of shortcut when touch painting is active. Except// touch hold shortcuts, since touching and holding in one spot does// nothing otherwise and is therefore unambiguous.- s->setDisableOnTouchPainting(true);+ //s->setDisableOnTouchPainting(true);Q_FALLTHROUGH();case KisShortcutConfiguration::OneFingerHold:s->setMinimumTouchPoints(1);@@ -810,85 +810,111 @@ void KisInputManagerTest::testTouchMoves_data()QTest::addColumn<int>("fingerCount");QTest::addColumn<int>("eventsCount");QTest::addColumn<QPointF>("pointOffset");- QTest::addColumn<QList<int>>("triggeredShortcuts");+ QTest::addColumn<bool>("enableTouchPainting");+ QTest::addColumn<QList<int>>("triggeredTouchShortcuts");+ QTest::addColumn<QList<int>>("triggeredPaintShortcuts");const QPointF dragOffset(10,10);const QPointF dirtyDragOffset(1,1);const QPointF tapOffset(0.5,0.5);- QTest::addRow("clean-1p-drag") << "touchCleanDrag" << 1 << 100 << dragOffset << QList<int>{15};- QTest::addRow("clean-2p-drag") << "touchCleanDrag" << 2 << 100 << dragOffset << QList<int>{16};- QTest::addRow("clean-3p-drag") << "touchCleanDrag" << 3 << 100 << dragOffset << QList<int>{17};+ const bool touchPaintingOn = true;+ const bool touchPaintingOff = false;- QTest::addRow("clean-1p-tap") << "touchCleanDrag" << 1 << 10 << tapOffset << QList<int>{20};- QTest::addRow("clean-2p-tap") << "touchCleanDrag" << 2 << 10 << tapOffset << QList<int>{21};- QTest::addRow("clean-3p-tap") << "touchCleanDrag" << 3 << 10 << tapOffset << QList<int>{22};+ QTest::addRow("clean-1p-drag") << "touchCleanDrag" << 1 << 100 << dragOffset << touchPaintingOff << QList<int>{15} << QList<int>{};+ QTest::addRow("clean-2p-drag") << "touchCleanDrag" << 2 << 100 << dragOffset << touchPaintingOff << QList<int>{16} << QList<int>{};+ QTest::addRow("clean-3p-drag") << "touchCleanDrag" << 3 << 100 << dragOffset << touchPaintingOff << QList<int>{17} << QList<int>{};++ QTest::addRow("clean-1p-drag-paint") << "touchCleanDrag" << 1 << 100 << dragOffset << touchPaintingOn << QList<int>{} << QList<int>{30};+ QTest::addRow("clean-2p-drag-paint") << "touchCleanDrag" << 2 << 100 << dragOffset << touchPaintingOn << QList<int>{16} << QList<int>{};+ QTest::addRow("clean-3p-drag-paint") << "touchCleanDrag" << 3 << 100 << dragOffset << touchPaintingOn << QList<int>{17} << QList<int>{};++ QTest::addRow("clean-1p-tap") << "touchCleanDrag" << 1 << 10 << tapOffset << touchPaintingOff << QList<int>{20} << QList<int>{};+ QTest::addRow("clean-2p-tap") << "touchCleanDrag" << 2 << 10 << tapOffset << touchPaintingOff << QList<int>{21} << QList<int>{};+ QTest::addRow("clean-3p-tap") << "touchCleanDrag" << 3 << 10 << tapOffset << touchPaintingOff << QList<int>{22} << QList<int>{};++ QTest::addRow("clean-1p-tap-paint") << "touchCleanDrag" << 1 << 10 << tapOffset << touchPaintingOn << QList<int>{} << QList<int>{31};+ QTest::addRow("clean-2p-tap-paint") << "touchCleanDrag" << 2 << 10 << tapOffset << touchPaintingOn << QList<int>{21} << QList<int>{};+ QTest::addRow("clean-3p-tap-paint") << "touchCleanDrag" << 3 << 10 << tapOffset << touchPaintingOn << QList<int>{22} << QList<int>{};// 16px is the threshold for distinguishing taps and drags (touch-begin + 16 steps + touch-end)- QTest::addRow("clean-1p-tap-upper-bound") << "touchCleanDrag" << 1 << 18 << QPointF(1, 0) << QList<int>{20};- QTest::addRow("clean-1p-drag-lower-bound") << "touchCleanDrag" << 1 << 19 << QPointF(1, 0) << QList<int>{15};+ QTest::addRow("clean-1p-tap-upper-bound") << "touchCleanDrag" << 1 << 18 << QPointF(1, 0) << touchPaintingOff << QList<int>{20} << QList<int>{};+ QTest::addRow("clean-1p-drag-lower-bound") << "touchCleanDrag" << 1 << 19 << QPointF(1, 0) << touchPaintingOff << QList<int>{15} << QList<int>{};- QTest::addRow("dirty-start-2p-drag") << "touchDragDirtyStart" << 2 << 100 << dirtyDragOffset << QList<int>{16};- QTest::addRow("dirty-start-3p-drag") << "touchDragDirtyStart" << 3 << 100 << dirtyDragOffset << QList<int>{17};+ QTest::addRow("dirty-start-2p-drag") << "touchDragDirtyStart" << 2 << 100 << dirtyDragOffset << touchPaintingOff << QList<int>{16} << QList<int>{};+ QTest::addRow("dirty-start-3p-drag") << "touchDragDirtyStart" << 3 << 100 << dirtyDragOffset << touchPaintingOff << QList<int>{17} << QList<int>{};- QTest::addRow("dirty-end-2p-drag") << "touchDragDirtyEnd" << 2 << 100 << dirtyDragOffset << QList<int>{16};- QTest::addRow("dirty-end-3p-drag") << "touchDragDirtyEnd" << 3 << 100 << dirtyDragOffset << QList<int>{17};+ QTest::addRow("dirty-end-2p-drag") << "touchDragDirtyEnd" << 2 << 100 << dirtyDragOffset << touchPaintingOff << QList<int>{16} << QList<int>{};+ QTest::addRow("dirty-end-3p-drag") << "touchDragDirtyEnd" << 3 << 100 << dirtyDragOffset << touchPaintingOff << QList<int>{17} << QList<int>{};- QTest::addRow("dirty-end-2p-tap") << "touchDragDirtyEnd" << 2 << 10 << tapOffset << QList<int>{21};- QTest::addRow("dirty-end-3p-tap") << "touchDragDirtyEnd" << 3 << 10 << tapOffset << QList<int>{22};+ QTest::addRow("dirty-end-2p-tap") << "touchDragDirtyEnd" << 2 << 10 << tapOffset << touchPaintingOff << QList<int>{21} << QList<int>{};+ QTest::addRow("dirty-end-3p-tap") << "touchDragDirtyEnd" << 3 << 10 << tapOffset << touchPaintingOff << QList<int>{22} << QList<int>{};// the current implementation is expected to switch to a "more-fingers-rich" shortcut immetiately- QTest::addRow("clean-2p-then-3p-drag") << "touchDragTwoThenThree" << 2 << 100 << dragOffset << QList<int>{16, 17};+ QTest::addRow("clean-2p-then-3p-drag") << "touchDragTwoThenThree" << 2 << 100 << dragOffset << touchPaintingOff << QList<int>{16, 17} << QList<int>{};// the current implementation is expected to stay on the "finger-richest" shortcut and,// not to switch to a "finger-poorer" shortcut- QTest::addRow("clean-3p-then-2p-drag") << "touchDragThreeThenTwo" << 3 << 100 << dragOffset << QList<int>{17};+ QTest::addRow("clean-3p-then-2p-drag") << "touchDragThreeThenTwo" << 3 << 100 << dragOffset << touchPaintingOff << QList<int>{17} << QList<int>{};// the 3-point gesture should be run twice during the same run- QTest::addRow("clean-3p-then-2p-then-3p-drag") << "touchDragThreeThenTwoThenThree" << 3 << 100 << dragOffset << QList<int>{17, 17};+ QTest::addRow("clean-3p-then-2p-then-3p-drag") << "touchDragThreeThenTwoThenThree" << 3 << 100 << dragOffset << touchPaintingOff << QList<int>{17, 17} << QList<int>{};}void KisInputManagerTest::testTouchMoves(){+ std::unique_ptr<TestingAction> paintAction(new TestingAction("paint-action"));+ std::unique_ptr<TestingAction> a(new TestingAction("touch-action"));+KisShortcutMatcher m;m.enterEvent();- TestingAction *a = new TestingAction();-m.addShortcut(- createKeyShortcut(a, 10,+ createKeyShortcut(a.get(), 10,QSet<Qt::Key>() << Qt::Key_Shift,Qt::Key_Enter));m.addShortcut(- createStrokeShortcut(a, 13,+ createStrokeShortcut(a.get(), 13,QSet<Qt::Key>(),Qt::LeftButton));- // TODO: add a separate test for that!- // let single finger gestures to work- KisConfig(false).setTouchPainting(KisConfig::TOUCH_PAINTING_DISABLED);-m.addShortcut(- createTouchShortcut(a, 15, KisShortcutConfiguration::OneFingerDrag));+ createTouchShortcut(a.get(), 15, KisShortcutConfiguration::OneFingerDrag));m.addShortcut(- createTouchShortcut(a, 16, KisShortcutConfiguration::TwoFingerDrag));+ createTouchShortcut(a.get(), 16, KisShortcutConfiguration::TwoFingerDrag));m.addShortcut(- createTouchShortcut(a, 17, KisShortcutConfiguration::ThreeFingerDrag));+ createTouchShortcut(a.get(), 17, KisShortcutConfiguration::ThreeFingerDrag));m.addShortcut(- createTouchShortcut(a, 20, KisShortcutConfiguration::OneFingerTap));+ createTouchShortcut(a.get(), 20, KisShortcutConfiguration::OneFingerTap));m.addShortcut(- createTouchShortcut(a, 21, KisShortcutConfiguration::TwoFingerTap));+ createTouchShortcut(a.get(), 21, KisShortcutConfiguration::TwoFingerTap));m.addShortcut(- createTouchShortcut(a, 22, KisShortcutConfiguration::ThreeFingerTap));+ createTouchShortcut(a.get(), 22, KisShortcutConfiguration::ThreeFingerTap));++ {+ // Touch painting shortcuts+ auto *shortcutDrag = createTouchShortcut(paintAction.get(), 30, KisShortcutConfiguration::OneFingerDrag);+ shortcutDrag->setIsTouchPainting(true);+ m.addShortcut(shortcutDrag);++ auto *shortcutTap = createTouchShortcut(paintAction.get(), 31, KisShortcutConfiguration::OneFingerTap);+ shortcutTap->setIsTouchPainting(true);+ m.addShortcut(shortcutTap);+ }QFETCH(QString, sequenceName);QFETCH(int, fingerCount);QFETCH(int, eventsCount);QFETCH(QPointF, pointOffset);- QFETCH(QList<int>, triggeredShortcuts);+ QFETCH(bool, enableTouchPainting);+ QFETCH(QList<int>, triggeredTouchShortcuts);+ QFETCH(QList<int>, triggeredPaintShortcuts);++ KisConfig(false).setTouchPainting(enableTouchPainting ? KisConfig::TOUCH_PAINTING_ENABLED+ : KisConfig::TOUCH_PAINTING_DISABLED);std::unique_ptr<TouchSequenceGeneratorBase> strokeGenerator(createTouchSequenceGenerator(sequenceName, fingerCount, eventsCount - 1, pointOffset));@@ -938,10 +964,14 @@ void KisInputManagerTest::testTouchMoves()}}- QCOMPARE(a->m_begunIndexes, triggeredShortcuts);- QCOMPARE(a->m_endedIndexes, triggeredShortcuts);- QCOMPARE(a->m_ended, true);+ QCOMPARE(a->m_begunIndexes, triggeredTouchShortcuts);+ QCOMPARE(a->m_endedIndexes, triggeredTouchShortcuts);+ QCOMPARE(a->m_ended, !a->m_begunIndexes.isEmpty());//QCOMPARE(a->m_gotInput, true); // TODO!++ QCOMPARE(paintAction->m_begunIndexes, triggeredPaintShortcuts);+ QCOMPARE(paintAction->m_endedIndexes, triggeredPaintShortcuts);+ QCOMPARE(paintAction->m_ended, !paintAction->m_begunIndexes.isEmpty());}#include "../input/wintab/kis_incremental_average.h"