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++
Make sure that the default actions are activated after touch-end
Dmitry Kazakov1337dc18649e
diff --git a/libs/ui/input/kis_shortcut_matcher.cpp b/libs/ui/input/kis_shortcut_matcher.cppindex 4dc0730ac6..1281269b2c 100644--- a/libs/ui/input/kis_shortcut_matcher.cpp+++ b/libs/ui/input/kis_shortcut_matcher.cpp@@ -465,6 +465,8 @@ bool KisShortcutMatcher::touchUpdateEvent(QTouchEvent *event)bool KisShortcutMatcher::touchEndEvent(QTouchEvent *event){+ Private::RecursionNotifier notifier(this);+m_d->maxTouchPoints = 0;if (!m_d->isTouchDragDetected && m_d->bestCandidateTouchEvent && !hasRunningShortcut()) {@@ -473,11 +475,22 @@ bool KisShortcutMatcher::touchEndEvent(QTouchEvent *event)DEBUG_TOUCH_ACTION("ending", event)// we should try and end the shortcut too (it might be that there is none? (sketch))- return tryEndTouchShortcut(event);+ const bool retval = tryEndTouchShortcut(event);++ if (notifier.isInRecursion()) {+ forceDeactivateAllActions();+ } else if (!hasRunningShortcut()) {+ prepareReadyShortcuts();+ tryActivateReadyShortcut();+ }++ return retval;}void KisShortcutMatcher::touchCancelEvent(QTouchEvent *event, const QPointF &localPos){+ Private::RecursionNotifier notifier(this);+m_d->maxTouchPoints = 0;KIS_SAFE_ASSERT_RECOVER_NOOP(!m_d->runningShortcut || !m_d->touchShortcut);@@ -495,6 +508,13 @@ void KisShortcutMatcher::touchCancelEvent(QTouchEvent *event, const QPointF &loctouchShortcut->action()->end(dstEvent.data());touchShortcut->action()->deactivate(touchShortcut->shortcutIndex());}++ if (notifier.isInRecursion()) {+ forceDeactivateAllActions();+ } else if (!hasRunningShortcut()) {+ prepareReadyShortcuts();+ tryActivateReadyShortcut();+ }}bool KisShortcutMatcher::nativeGestureBeginEvent(QNativeGestureEvent *event)@@ -522,9 +542,19 @@ bool KisShortcutMatcher::nativeGestureEvent(QNativeGestureEvent *event)bool KisShortcutMatcher::nativeGestureEndEvent(QNativeGestureEvent *event){+ Private::RecursionNotifier notifier(this);+if ( m_d->nativeGestureShortcut && !m_d->nativeGestureShortcut->match( event ) ) {tryEndNativeGestureShortcut( event );}++ if (notifier.isInRecursion()) {+ forceDeactivateAllActions();+ } else if (!hasRunningShortcut()) {+ prepareReadyShortcuts();+ tryActivateReadyShortcut();+ }+return true;}@@ -1042,6 +1072,8 @@ bool KisShortcutMatcher::tryRunNativeGestureShortcut(QNativeGestureEvent* event)bool KisShortcutMatcher::tryEndNativeGestureShortcut(QNativeGestureEvent* event){+ Private::RecursionNotifier notifier(this);+if (m_d->nativeGestureShortcut) {// first reset running shortcut to avoid infinite recursion via end()KisNativeGestureShortcut *nativeGestureShortcut = m_d->nativeGestureShortcut;@@ -1054,5 +1086,12 @@ bool KisShortcutMatcher::tryEndNativeGestureShortcut(QNativeGestureEvent* event)return true;}+ if (notifier.isInRecursion()) {+ forceDeactivateAllActions();+ } else if (!hasRunningShortcut()) {+ prepareReadyShortcuts();+ tryActivateReadyShortcut();+ }+return false;}