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.
This commit is contained in:
Gaspar Capello 2023-06-05 18:32:47 -03:00 committed by David Capello
parent fc24613b81
commit a628bbb58b
2 changed files with 7 additions and 7 deletions

View File

@ -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<KeyMessage*>(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<KeyMessage*>(msg));
updateToolLoopModifiersIndicators();
updateAutoCelGuides(msg);
if (hasMouse()) {
updateToolLoopModifiersIndicators();
updateAutoCelGuides(msg);
updateQuicktool();
setCursor(mousePosInDisplay());
}

View File

@ -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 &&