Added special key identifiers for OSX and Windows

This commit is contained in:
gellert 2016-02-06 22:33:21 +01:00 committed by Cheng Zhao
parent d9ad51e989
commit 070772b4b9
2 changed files with 14 additions and 2 deletions

View file

@ -80,6 +80,16 @@ ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr) {
if (chr == "tab") return ui::VKEY_TAB;
if (chr == "escape") return ui::VKEY_ESCAPE;
if (chr == "control") return ui::VKEY_CONTROL;
#if defined(OS_MACOSX)
if (chr == "command"
|| chr == "cmd"
|| chr == "meta") return ui::VKEY_COMMAND;
if (chr == "option") return ui::VKEY_MENU;
#endif
#if defined(OS_WIN)
if (chr == "meta") return ui::VKEY_LWIN;
if (chr == "altgr") return ui::VKEY_ALTGR;
#endif
if (chr == "alt") return ui::VKEY_MENU;
if (chr == "shift") return ui::VKEY_SHIFT;
if (chr == "end") return ui::VKEY_END;

View file

@ -769,8 +769,10 @@ For keyboard events, the `event` object also have following properties:
* `keyCode` Char or String (**required**) - The character that will be sent
as the keyboard event. Can be a single UTF-8 character, or the name of the
key that generates the event. Accepted key names are `enter`, `backspace`,
`delete`, `tab`, `escape`, `control`, `alt`, `shift`, `end`, `home`, `insert`,
`left`, `up`, `right`, `down`, `pageUp`, `pageDown`, `printScreen`
`delete`, `tab`, `escape`, `control`, `alt`, `altgr` (Windows only), `shift`,
`end`, `home`, `insert`, `left`, `up`, `right`, `down`, `pageUp`, `pageDown`,
`printScreen`, `meta`, `cmd` (OSX only), `command` (OSX only), `option`
(OSX only)
For mouse events, the `event` object also have following properties: