Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Fix trouch-tap gestures to actually work

Dmitry Kazakov511d0a1c6b95
diff --git a/libs/ui/input/kis_shortcut_matcher.cpp b/libs/ui/input/kis_shortcut_matcher.cpp
index 99f4d86685..e83911e40c 100644
--- a/libs/ui/input/kis_shortcut_matcher.cpp
+++ b/libs/ui/input/kis_shortcut_matcher.cpp
@@ -1186,15 +1186,21 @@ void KisShortcutMatcher::forceDeactivateAllActions()
void KisShortcutMatcher::setMaxTouchPointEvent(QTouchEvent *event)
{
- int touchPointCount = event->touchPoints().size();
- if (touchPointCount > m_d->maxTouchPoints) {
- m_d->maxTouchPoints = touchPointCount;
+ int previousNumTouchPoints = -1;
+
+ if (m_d->bestCandidateForTapTouchEvent) {
+ QTouchEvent *bestTouchEvent = static_cast<QTouchEvent*>(m_d->bestCandidateForTapTouchEvent.data());
+ previousNumTouchPoints = KisTouchShortcut::countTouchPoints(bestTouchEvent, KisTouchShortcut::pressedOnlyTouchStates());
+ }
+
+ const int newNumTouchPoints = KisTouchShortcut::countTouchPoints(event, KisTouchShortcut::pressedOnlyTouchStates());;
+
+ if (newNumTouchPoints >= previousNumTouchPoints) {
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
KoPointerEvent::copyQtPointerEvent(event, m_d->bestCandidateForTapTouchEvent);
#else
m_d->bestCandidateForTapTouchEvent.reset(event->clone());
#endif
-
}
}