fix: keep shifted character in menu accelerator (#29202)
* fix: correctly handle shifted char in accelerator * test: use actual accelerator of NSMenuItem * chore: simplify KeyboardCodeFromStr * chore: GetAcceleratorTextAt is testing only
This commit is contained in:
parent
31190d4c6d
commit
3cfe5c6a21
11 changed files with 168 additions and 83 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "base/optional.h"
|
||||
#include "ui/events/keycodes/keyboard_codes.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -15,9 +16,11 @@ namespace electron {
|
|||
// pressed.
|
||||
ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted);
|
||||
|
||||
// Return key code of the |str|, and also determine whether the SHIFT key is
|
||||
// Return key code of the |str|, if the original key is a shifted character,
|
||||
// for example + and /, set it in |shifted_char|.
|
||||
// pressed.
|
||||
ui::KeyboardCode KeyboardCodeFromStr(const std::string& str, bool* shifted);
|
||||
ui::KeyboardCode KeyboardCodeFromStr(const std::string& str,
|
||||
base::Optional<char16_t>* shifted_char);
|
||||
|
||||
} // namespace electron
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue