Fix pressing buttons with Alt+mnemonic or Cmd+mnemonic (regression introduced in 536a4c5d3a)

master
David Capello 2019-11-05 10:46:47 -03:00
parent d6c6b00b32
commit 5ac07c0823
1 changed files with 8 additions and 11 deletions

View File

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