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

Unified Diff: ui/events/event.cc

Issue 321153002: aura-linux: Supports ISO Level3 Latch key. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed the approach. Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event.cc
diff --git a/ui/events/event.cc b/ui/events/event.cc
index 8d87d19acc3ea5e73f38c023c90be4247aedaef7..514394fefddcbf6d38a7e5ca48431e57fcf98999 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -563,10 +563,13 @@ uint16 KeyEvent::GetCharacter() const {
DCHECK(native_event()->type == KeyPress ||
native_event()->type == KeyRelease);
- uint16 ch = 0;
- if (!IsControlDown())
- ch = GetCharacterFromXEvent(native_event());
- return ch ? ch : GetCharacterFromKeyCode(key_code_, flags());
+ // When a control key is held, prefer ASCII characters to non ASCII
+ // characters in order to use it for shortcut keys. GetCharacterFromKeyCode
+ // returns 'a' for VKEY_A even if the key is actually bound to 'à' in X11.
+ // GetCharacterFromXEvent returns 'à' in that case.
+ return IsControlDown() ?
+ GetCharacterFromKeyCode(key_code_, flags()) :
+ GetCharacterFromXEvent(native_event());
#else
if (native_event()) {
DCHECK(EventTypeFromNative(native_event()) == ET_KEY_PRESSED ||
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698