Git commit b53adfca36dfedd0cad37f42a3021be33a24892f by Dmitry Kazakov. Committed on 06/06/2014 at 08:18. Pushed by dkazakov into branch 'master'. Fix hiding the brush outline when the cursor is outside the canvas Please check this patch on Gnome and Windows! BUG:335649 CCMAIL:kimageshop@kde.org Conflicts: krita/ui/input/kis_input_manager.cpp M +4 -0 krita/ui/input/kis_input_manager.cpp M +29 -3 krita/ui/input/kis_shortcut_matcher.cpp M +12 -0 krita/ui/input/kis_shortcut_matcher.h http://commits.kde.org/calligra/b53adfca36dfedd0cad37f42a3021be33a24892f diff --git a/krita/ui/input/kis_input_manager.cpp b/krita/ui/input/kis_input_manager.cpp index 56fccaa..53fddeb 100644 --- a/krita/ui/input/kis_input_manager.cpp +++ b/krita/ui/input/kis_input_manager.cpp @@ -613,6 +613,8 @@ bool KisInputManager::eventFilter(QObject* object, QEvent* event) d->canvas->canvasWidget()->setFocus(); stop_ignore_cursor_events(); touch_stop_block_press_events(); + + d->matcher.enterEvent(); break; case QEvent::Leave: d->debugEvent(event); @@ -623,6 +625,8 @@ bool KisInputManager::eventFilter(QObject* object, QEvent* event) */ stop_ignore_cursor_events(); touch_stop_block_press_events(); + + d->matcher.leaveEvent(); break; case QEvent::FocusIn: d->debugEvent(event); diff --git a/krita/ui/input/kis_shortcut_matcher.cpp b/krita/ui/input/kis_shortcut_matcher.cpp index e4796ac..178a903 100644 --- a/krita/ui/input/kis_shortcut_matcher.cpp +++ b/krita/ui/input/kis_shortcut_matcher.cpp @@ -43,6 +43,7 @@ public: , readyShortcut(0) , touchShortcut(0) , suppressAllActions(false) + , cursorEntered(false) , usingTouch(false) {} @@ -60,7 +61,12 @@ public: KisTouchShortcut *touchShortcut; bool suppressAllActions; + bool cursorEntered; bool usingTouch; + + inline bool actionsSuppressed() const { + return suppressAllActions || !cursorEntered; + } }; KisShortcutMatcher::KisShortcutMatcher() @@ -216,6 +222,26 @@ bool KisShortcutMatcher::mouseMoved(QMouseEvent *event) return true; } +void KisShortcutMatcher::enterEvent() +{ + m_d->cursorEntered = true; + + if (!m_d->runningShortcut) { + prepareReadyShortcuts(); + tryActivateReadyShortcut(); + } +} + +void KisShortcutMatcher::leaveEvent() +{ + m_d->cursorEntered = false; + + if (!m_d->runningShortcut) { + prepareReadyShortcuts(); + tryActivateReadyShortcut(); + } +} + bool KisShortcutMatcher::touchBeginEvent( QTouchEvent* event ) { Q_UNUSED(event) @@ -313,7 +339,7 @@ bool KisShortcutMatcher::tryRunKeyShortcut(Qt::Key key, QKeyEvent *event) template bool KisShortcutMatcher::tryRunSingleActionShortcutImpl(T param, U *event, const QList &keysState) { - if (m_d->suppressAllActions) return false; + if (m_d->actionsSuppressed()) return false; KisSingleActionShortcut *goodCandidate = 0; @@ -336,7 +362,7 @@ bool KisShortcutMatcher::tryRunSingleActionShortcutImpl(T param, U *event, const void KisShortcutMatcher::prepareReadyShortcuts() { m_d->readyShortcuts.clear(); - if (m_d->suppressAllActions) return; + if (m_d->actionsSuppressed()) return; foreach(KisStrokeShortcut *s, m_d->strokeShortcuts) { if (s->matchReady(m_d->keys, m_d->buttons)) { @@ -424,7 +450,7 @@ bool KisShortcutMatcher::tryRunTouchShortcut( QTouchEvent* event ) { KisTouchShortcut *goodCandidate = 0; - if (m_d->suppressAllActions) + if (m_d->actionsSuppressed()) return false; foreach(KisTouchShortcut* shortcut, m_d->touchShortcuts) { diff --git a/krita/ui/input/kis_shortcut_matcher.h b/krita/ui/input/kis_shortcut_matcher.h index 5cc54e3..b3cd01d 100644 --- a/krita/ui/input/kis_shortcut_matcher.h +++ b/krita/ui/input/kis_shortcut_matcher.h @@ -166,6 +166,18 @@ public: */ bool mouseMoved(QMouseEvent *event); + /** + * Handle cursor's Enter event. + * We never eat it because it might be used by someone else + */ + void enterEvent(); + + /** + * Handle cursor's Leave event. + * We never eat it because it might be used by someone else + */ + void leaveEvent(); + bool touchBeginEvent(QTouchEvent *event); bool touchUpdateEvent(QTouchEvent *event); bool touchEndEvent(QTouchEvent *event); _______________________________________________ Krita mailing list kimageshop@kde.org https://mail.kde.org/mailman/listinfo/kimageshop