mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Merging keyCode and keyIdentifier and adjusting the docs accordingly
This commit is contained in:
@@ -73,7 +73,7 @@ ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted) {
|
||||
}
|
||||
|
||||
// Return key code of the char.
|
||||
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(std::string chr) {
|
||||
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr) {
|
||||
if (chr == "enter") return ui::VKEY_RETURN;
|
||||
if (chr == "backspace") return ui::VKEY_BACK;
|
||||
if (chr == "delete") return ui::VKEY_DELETE;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace atom {
|
||||
ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted);
|
||||
|
||||
// Return key code of the char from a string representation of the char
|
||||
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(std::string chr);
|
||||
ui::KeyboardCode KeyboardCodeFromKeyIdentifier(const std::string& chr);
|
||||
|
||||
} // namespace atom
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ bool Converter<blink::WebKeyboardEvent>::FromV8(
|
||||
|
||||
if (dict.Get("keyCode", &code))
|
||||
out->windowsKeyCode = atom::KeyboardCodeFromCharCode(code, &shifted);
|
||||
else if (dict.Get("keyIdentifier", &identifier))
|
||||
else if (dict.Get("keyCode", &identifier))
|
||||
out->windowsKeyCode = atom::KeyboardCodeFromKeyIdentifier(
|
||||
base::StringToLowerASCII(identifier));
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user