From 5ac07c082308f4333498120b4362a9e721aa5c8c Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 5 Nov 2019 10:46:47 -0300 Subject: [PATCH] Fix pressing buttons with Alt+mnemonic or Cmd+mnemonic (regression introduced in 536a4c5d3aedccb4f24c5a5e28324ddad7638e18) --- src/ui/button.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/ui/button.cpp b/src/ui/button.cpp index be9763c93..1cc243806 100644 --- a/src/ui/button.cpp +++ b/src/ui/button.cpp @@ -96,15 +96,12 @@ bool ButtonBase::onProcessMessage(Message* msg) } } - // Check if the user pressed mnemonic. - if (mnemonicPressed) { - setSelected(true); - return true; - } - // Magnetic widget catches ENTERs - else if (isFocusMagnet() && - ((scancode == kKeyEnter) || - (scancode == kKeyEnterPad))) { + if (// Check if the user pressed mnemonic + mnemonicPressed || + // Magnetic widget catches ENTERs + (isFocusMagnet() && + ((scancode == kKeyEnter) || + (scancode == kKeyEnterPad)))) { manager()->setFocus(this); // Dispatch focus movement messages (because the buttons @@ -117,8 +114,8 @@ bool ButtonBase::onProcessMessage(Message* msg) } // For kCheckWidget or kRadioWidget else { - /* if the widget has the focus and the user press space or - if the user press Alt+the underscored letter of the button */ + // If the widget has the focus and the user press space or + // if the user press Alt+the underscored letter of the button if ((hasFocus() && (scancode == kKeySpace)) || mnemonicPressed) { if (m_behaviorType == kCheckWidget) { // Swap the select status