mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-28 15:20:15 +00:00
Fix button's kKeyUpMessage handling
Now the checkbox button skips the kKeyUpMessage when the key being depressed is not the space key and is not the associated mnemonic key. Before this change, for instance, if a checkbox received the focus by using the Tab key, the kKeyUpMessage (of the Tab key) was intercepted by the checkbox and triggered the onClick() event.
This commit is contained in:
parent
8a8a324651
commit
9ca6368088
@ -153,12 +153,22 @@ bool ButtonBase::onProcessMessage(Message* msg)
|
||||
}
|
||||
break;
|
||||
|
||||
case kCheckWidget: {
|
||||
// Fire onClick() event
|
||||
onClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
case kCheckWidget:
|
||||
KeyMessage* keymsg = static_cast<KeyMessage*>(msg);
|
||||
KeyScancode scancode = keymsg->scancode();
|
||||
const bool mnemonicPressed =
|
||||
(mnemonic() &&
|
||||
(!mnemonicRequiresModifiers() ||
|
||||
msg->altPressed() ||
|
||||
msg->cmdPressed()) &&
|
||||
isMnemonicPressed(keymsg));
|
||||
// Fire the onClick() event only if the user pressed space or
|
||||
// Alt+the underscored letter of the checkbox label.
|
||||
if (scancode == kKeySpace || mnemonicPressed) {
|
||||
onClick();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user