diff options
author | yukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-16 02:57:11 +0000 |
---|---|---|
committer | yukishiino@chromium.org <yukishiino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-16 02:57:11 +0000 |
commit | e50dfd06b947adedc2c1e6a5d7746e49b43178f8 (patch) | |
tree | 2714d014c5229a82a4c6d4f010495492e3b35088 /ui | |
parent | 1bbd6f09feb6873650a36328d4ccbc4441712de3 (diff) | |
download | chromium_src-e50dfd06b947adedc2c1e6a5d7746e49b43178f8.zip chromium_src-e50dfd06b947adedc2c1e6a5d7746e49b43178f8.tar.gz chromium_src-e50dfd06b947adedc2c1e6a5d7746e49b43178f8.tar.bz2 |
Clean up InputMethodLinuxX11 following crrev.com/48203002
http://crrev.com/48203002 makes it possible to make the implementation of InputMethodXxx family much simpler and cleaner. Cleans InputMethodLinuxX11 following the CL.
TEST=none
Review URL: https://codereview.chromium.org/61903004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/ime/input_method_linux_x11.cc | 27 | ||||
-rw-r--r-- | ui/base/ime/input_method_linux_x11.h | 2 |
2 files changed, 11 insertions, 18 deletions
diff --git a/ui/base/ime/input_method_linux_x11.cc b/ui/base/ime/input_method_linux_x11.cc index 08d9109..5d9b8c9 100644 --- a/ui/base/ime/input_method_linux_x11.cc +++ b/ui/base/ime/input_method_linux_x11.cc @@ -46,38 +46,31 @@ bool InputMethodLinuxX11::OnUntranslatedIMEMessage( } bool InputMethodLinuxX11::DispatchKeyEvent(const ui::KeyEvent& event) { + DCHECK(event.type() == ET_KEY_PRESSED || event.type() == ET_KEY_RELEASED); + DCHECK(system_toplevel_window_focused()); + if (!event.HasNativeEvent()) return DispatchFabricatedKeyEvent(event); - const base::NativeEvent& native_key_event = event.native_event(); - EventType event_type = EventTypeFromNative(native_key_event); - DCHECK(event_type == ET_KEY_PRESSED || event_type == ET_KEY_RELEASED); - DCHECK(system_toplevel_window_focused()); - // If no text input client, do nothing. + const base::NativeEvent& native_key_event = event.native_event(); if (!GetTextInputClient()) return DispatchKeyEventPostIME(native_key_event); // Let an IME handle the key event first. if (input_method_context_->DispatchKeyEvent(native_key_event)) { - if (event_type == ET_KEY_PRESSED) + if (event.type() == ET_KEY_PRESSED) DispatchFabricatedKeyEventPostIME(ET_KEY_PRESSED, VKEY_PROCESSKEY, - EventFlagsFromNative(native_key_event)); + event.flags()); return true; } // Otherwise, insert the character. const bool handled = DispatchKeyEventPostIME(native_key_event); - if (event_type == ET_KEY_PRESSED && GetTextInputClient()) { - uint16 ch = 0; - const int flags = EventFlagsFromNative(native_key_event); - if (!(flags & EF_CONTROL_DOWN)) - ch = GetCharacterFromXEvent(native_key_event); - if (!ch) - ch = GetCharacterFromKeyCode(KeyboardCodeFromNative(native_key_event), - flags); + if (event.type() == ET_KEY_PRESSED && GetTextInputClient()) { + const uint16 ch = event.GetCharacter(); if (ch) { - GetTextInputClient()->InsertChar(ch, flags); + GetTextInputClient()->InsertChar(ch, event.flags()); return true; } } @@ -167,6 +160,8 @@ void InputMethodLinuxX11::OnDidChangeFocusedClient( InputMethodBase::OnDidChangeFocusedClient(focused_before, focused); } +// private + bool InputMethodLinuxX11::DispatchFabricatedKeyEvent( const ui::KeyEvent& event) { // Let a post IME handler handle the key event. diff --git a/ui/base/ime/input_method_linux_x11.h b/ui/base/ime/input_method_linux_x11.h index fb340e3..13a51a3 100644 --- a/ui/base/ime/input_method_linux_x11.h +++ b/ui/base/ime/input_method_linux_x11.h @@ -9,8 +9,6 @@ #include "ui/base/ime/input_method_base.h" #include "ui/base/ime/linux/linux_input_method_context.h" -typedef struct _GtkIMContext GtkIMContext; - namespace ui { // A ui::InputMethod implementation for a X11 event loop on GNU/Linux. |