Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Unified Diff: ui/events/keycodes/platform_key_map_win.cc

Issue 2630213003: Return AltGraph for right-Alt keydown/keyup, under layouts which use AltGraph. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/keycodes/platform_key_map_win.h ('k') | ui/events/keycodes/platform_key_map_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/keycodes/platform_key_map_win.cc
diff --git a/ui/events/keycodes/platform_key_map_win.cc b/ui/events/keycodes/platform_key_map_win.cc
index 439384c634941d9eb9017b047e3dd464860a9f9f..c5a290c4dd8adf3bad92e0694768a7fb35dd660d 100644
--- a/ui/events/keycodes/platform_key_map_win.cc
+++ b/ui/events/keycodes/platform_key_map_win.cc
@@ -287,6 +287,9 @@ PlatformKeyMap::~PlatformKeyMap() {}
DomKey PlatformKeyMap::DomKeyFromKeyboardCodeImpl(KeyboardCode key_code,
int flags) const {
DomKey key = NonPrintableKeyboardCodeToDomKey(key_code, keyboard_layout_);
+ if (key == DomKey::ALT && (flags & EF_IS_EXTENDED_KEY) && has_alt_graph_) {
garykac 2017/01/18 15:55:29 Could you add a brief comment above this line?
Wez 2017/01/18 21:36:35 Done.
+ return DomKey::ALT_GRAPH;
+ }
if (key != DomKey::NONE)
return key;
@@ -346,6 +349,7 @@ void PlatformKeyMap::UpdateLayout(HKL layout) {
// TODO(chongz): Optimize layout switching (see crbug.com/587147).
keyboard_layout_ = layout;
printable_keycode_to_key_.clear();
+ has_alt_graph_ = false;
// Map size for some sample keyboard layouts:
// US: 476, French: 602, Persian: 482, Vietnamese: 1436
@@ -385,6 +389,11 @@ void PlatformKeyMap::UpdateLayout(HKL layout) {
printable_keycode_to_key_[std::make_pair(static_cast<int>(key_code),
flags)] =
DomKey::FromCharacter(translated_chars[0]);
+
+ // Detect whether the layout makes use of AltGraph.
+ if (flags & EF_ALTGR_DOWN) {
+ has_alt_graph_ = true;
+ }
} else {
// Ignores legacy non-printable control characters.
}
« no previous file with comments | « ui/events/keycodes/platform_key_map_win.h ('k') | ui/events/keycodes/platform_key_map_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698