From a628bbb58bc0980a8ac02cb7a3b2e967341da2d5 Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Mon, 5 Jun 2023 18:32:47 -0300 Subject: [PATCH] Fix changing brush size w/drag value when multiple editors are opened (fix #3884) This fixes unnecessary propagation of kKeyDownMessage/kKeyUpMessage messages across all open editors. The pressed key should be sent to the active editor or the one with the mouse over it. --- src/app/ui/editor/editor.cpp | 12 ++++++------ src/app/ui/editor/standby_state.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp index ebd0fe737..616e2954e 100644 --- a/src/app/ui/editor/editor.cpp +++ b/src/app/ui/editor/editor.cpp @@ -2078,13 +2078,13 @@ bool Editor::onProcessMessage(Message* msg) } #endif // ENABLE_DEVMODE - if (m_sprite) { + if (m_sprite && (isActive() || hasMouse())) { EditorStatePtr holdState(m_state); bool used = m_state->onKeyDown(this, static_cast(msg)); - updateToolLoopModifiersIndicators(); - updateAutoCelGuides(msg); if (hasMouse()) { + updateToolLoopModifiersIndicators(); + updateAutoCelGuides(msg); updateQuicktool(); setCursor(mousePosInDisplay()); } @@ -2095,13 +2095,13 @@ bool Editor::onProcessMessage(Message* msg) break; case kKeyUpMessage: - if (m_sprite) { + if (m_sprite && (isActive() || hasMouse())) { EditorStatePtr holdState(m_state); bool used = m_state->onKeyUp(this, static_cast(msg)); - updateToolLoopModifiersIndicators(); - updateAutoCelGuides(msg); if (hasMouse()) { + updateToolLoopModifiersIndicators(); + updateAutoCelGuides(msg); updateQuicktool(); setCursor(mousePosInDisplay()); } diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index a73bc20d4..b82fe6a8c 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -498,7 +498,7 @@ bool StandbyState::onKeyDown(Editor* editor, KeyMessage* msg) Keys keys = KeyboardShortcuts::instance() ->getDragActionsFromKeyMessage(KeyContext::MouseWheel, msg); - if (!keys.empty()) { + if (editor->hasMouse() && !keys.empty()) { // Don't enter DraggingValueState to change brush size if we are // in a selection-like tool if (keys.size() == 1 &&