| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/ime/input_method_auralinux.h" | 5 #include "ui/base/ime/input_method_auralinux.h" |
| 6 | 6 |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "ui/base/ime/linux/linux_input_method_context_factory.h" | 8 #include "ui/base/ime/linux/linux_input_method_context_factory.h" |
| 9 #include "ui/base/ime/text_input_client.h" | 9 #include "ui/base/ime/text_input_client.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 bool InputMethodAuraLinux::DispatchKeyEvent(const ui::KeyEvent& event) { | 49 bool InputMethodAuraLinux::DispatchKeyEvent(const ui::KeyEvent& event) { |
| 50 DCHECK(event.type() == ET_KEY_PRESSED || event.type() == ET_KEY_RELEASED); | 50 DCHECK(event.type() == ET_KEY_PRESSED || event.type() == ET_KEY_RELEASED); |
| 51 DCHECK(system_toplevel_window_focused()); | 51 DCHECK(system_toplevel_window_focused()); |
| 52 | 52 |
| 53 // If no text input client, do nothing. | 53 // If no text input client, do nothing. |
| 54 if (!GetTextInputClient()) | 54 if (!GetTextInputClient()) |
| 55 return DispatchKeyEventPostIME(event); | 55 return DispatchKeyEventPostIME(event); |
| 56 | 56 |
| 57 // Let an IME handle the key event first. | 57 // Let an IME handle the key event first. |
| 58 if (input_method_context_->DispatchKeyEvent(event)) { | 58 if (input_method_context_->DispatchKeyEvent(event)) { |
| 59 if (event.type() == ET_KEY_PRESSED) { | 59 if (event.type() == ET_KEY_PRESSED && |
| 60 (event.flags() & ui::EF_IME_FABRICATED_KEY) == 0) { |
| 60 const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, | 61 const ui::KeyEvent fabricated_event(ET_KEY_PRESSED, |
| 61 VKEY_PROCESSKEY, | 62 VKEY_PROCESSKEY, |
| 62 event.flags(), | 63 event.flags(), |
| 63 false); // is_char | 64 false); // is_char |
| 64 DispatchKeyEventPostIME(fabricated_event); | 65 DispatchKeyEventPostIME(fabricated_event); |
| 65 } | 66 } |
| 66 return true; | 67 return true; |
| 67 } | 68 } |
| 68 | 69 |
| 69 // Otherwise, insert the character. | 70 // Otherwise, insert the character. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 TextInputClient* focused_before, | 147 TextInputClient* focused_before, |
| 147 TextInputClient* focused) { | 148 TextInputClient* focused) { |
| 148 input_method_context_->Reset(); | 149 input_method_context_->Reset(); |
| 149 input_method_context_->OnTextInputTypeChanged( | 150 input_method_context_->OnTextInputTypeChanged( |
| 150 focused ? focused->GetTextInputType() : TEXT_INPUT_TYPE_NONE); | 151 focused ? focused->GetTextInputType() : TEXT_INPUT_TYPE_NONE); |
| 151 | 152 |
| 152 InputMethodBase::OnDidChangeFocusedClient(focused_before, focused); | 153 InputMethodBase::OnDidChangeFocusedClient(focused_before, focused); |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace ui | 156 } // namespace ui |
| OLD | NEW |