From 6181794722479012d3f35445b7f810dc84af189b Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 13 Nov 2018 08:30:12 -0800 Subject: [PATCH] feat: add numpad accelerator mappings --- atom/common/keyboard_util.cc | 29 ++++++++++++++++++++++++++++- docs/api/accelerator.md | 6 ++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/atom/common/keyboard_util.cc b/atom/common/keyboard_util.cc index 354cabcd8d3b8..a13e5aed8dc7e 100644 --- a/atom/common/keyboard_util.cc +++ b/atom/common/keyboard_util.cc @@ -40,6 +40,34 @@ ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& s, return ui::VKEY_OEM_PLUS; } else if (str == "tab") { return ui::VKEY_TAB; + } else if (str == "num0") { + return ui::VKEY_NUMPAD0; + } else if (str == "num1") { + return ui::VKEY_NUMPAD1; + } else if (str == "num2") { + return ui::VKEY_NUMPAD2; + } else if (str == "num3") { + return ui::VKEY_NUMPAD3; + } else if (str == "num4") { + return ui::VKEY_NUMPAD4; + } else if (str == "num5") { + return ui::VKEY_NUMPAD5; + } else if (str == "num6") { + return ui::VKEY_NUMPAD6; + } else if (str == "num7") { + return ui::VKEY_NUMPAD7; + } else if (str == "num8") { + return ui::VKEY_NUMPAD8; + } else if (str == "num9") { + return ui::VKEY_NUMPAD9; + } else if (str == "numadd") { + return ui::VKEY_ADD; + } else if (str == "nummult") { + return ui::VKEY_MULTIPLY; + } else if (str == "numdec") { + return ui::VKEY_DECIMAL; + } else if (str == "numsub") { + return ui::VKEY_SUBTRACT; } else if (str == "space") { return ui::VKEY_SPACE; } else if (str == "backspace") { @@ -118,7 +146,6 @@ ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) { return ui::VKEY_ESCAPE; case ' ': return ui::VKEY_SPACE; - case 'a': return ui::VKEY_A; case 'b': diff --git a/docs/api/accelerator.md b/docs/api/accelerator.md index 3f691f182f9ce..4a0ec9fe121e7 100644 --- a/docs/api/accelerator.md +++ b/docs/api/accelerator.md @@ -69,3 +69,9 @@ The `Super` key is mapped to the `Windows` key on Windows and Linux and * `VolumeUp`, `VolumeDown` and `VolumeMute` * `MediaNextTrack`, `MediaPreviousTrack`, `MediaStop` and `MediaPlayPause` * `PrintScreen` +* NumPad Keys + * `num0` - `num9` + * `numdec` - decimal key + * `numadd` - numpad `+` key + * `numsub` - numpad `-` key + * `nummult` - numpad `*` key