summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-25 16:58:53 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-25 16:58:53 +0000
commit6b1efe3b7fba6c62b020161bdc9eb9dd70fb3bb0 (patch)
treee71329badc4bf99ba3840435303ac6033dc91fbd /views
parent92da5d2733639e2bddaaf04233cc879799e31a38 (diff)
downloadchromium_src-6b1efe3b7fba6c62b020161bdc9eb9dd70fb3bb0.zip
chromium_src-6b1efe3b7fba6c62b020161bdc9eb9dd70fb3bb0.tar.gz
chromium_src-6b1efe3b7fba6c62b020161bdc9eb9dd70fb3bb0.tar.bz2
aura: Fix shift/ctrl/alt keyevents with RWHVA and X11.
One of the functions didn't really do what it claimed it did. This ended up causing problems where pressing just the shift key (or the ctrl or alt key) would cause some garbage character to show up. BUG=101440 TEST=manually Review URL: http://codereview.chromium.org/8380033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/events/event_x.cc18
1 files changed, 4 insertions, 14 deletions
diff --git a/views/events/event_x.cc b/views/events/event_x.cc
index 1c1c51d..edf48e9 100644
--- a/views/events/event_x.cc
+++ b/views/events/event_x.cc
@@ -20,16 +20,6 @@ namespace views {
namespace {
-uint16 GetCharacterFromXKeyEvent(XKeyEvent* key) {
- char buf[6];
- int bytes_written = XLookupString(key, buf, 6, NULL, NULL);
- DCHECK_LE(bytes_written, 6);
-
- string16 result;
- return (bytes_written > 0 && UTF8ToUTF16(buf, bytes_written, &result) &&
- result.length() == 1) ? result[0] : 0;
-}
-
// The following two functions are copied from event_gtk.cc. These will be
// removed when GTK dependency is removed.
#if defined(TOOLKIT_USES_GTK)
@@ -72,7 +62,7 @@ uint16 KeyEvent::GetCharacter() const {
DCHECK(native_event()->type == KeyPress ||
native_event()->type == KeyRelease);
- uint16 ch = GetCharacterFromXKeyEvent(&native_event()->xkey);
+ uint16 ch = ui::DefaultSymbolFromXEvent(native_event());
return ch ? ch : GetCharacterFromKeyCode(key_code_, flags());
}
@@ -110,15 +100,15 @@ uint16 KeyEvent::GetUnmodifiedCharacter() const {
DCHECK(native_event()->type == KeyPress ||
native_event()->type == KeyRelease);
- XKeyEvent key = native_event()->xkey;
+ XKeyEvent *key = &native_event()->xkey;
static const unsigned int kIgnoredModifiers = ControlMask | LockMask |
Mod1Mask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask;
// We can't use things like (key.state & ShiftMask), as it may mask out bits
// used by X11 internally.
- key.state &= ~kIgnoredModifiers;
- uint16 ch = GetCharacterFromXKeyEvent(&key);
+ key->state &= ~kIgnoredModifiers;
+ uint16 ch = ui::DefaultSymbolFromXEvent(native_event());
return ch ? ch :
GetCharacterFromKeyCode(key_code_, flags() & ui::EF_SHIFT_DOWN);
}