| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/environment.h" | 8 #include "base/environment.h" |
| 9 #include "ui/base/ime/linux/linux_input_method_context_factory.h" | 9 #include "ui/base/ime/linux/linux_input_method_context_factory.h" |
| 10 #include "ui/base/ime/text_input_client.h" | 10 #include "ui/base/ime/text_input_client.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 bool InputMethodAuraLinux::OnUntranslatedIMEMessage( | 40 bool InputMethodAuraLinux::OnUntranslatedIMEMessage( |
| 41 const base::NativeEvent& event, | 41 const base::NativeEvent& event, |
| 42 NativeEventResult* result) { | 42 NativeEventResult* result) { |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 void InputMethodAuraLinux::DispatchKeyEvent(ui::KeyEvent* event) { | 46 void InputMethodAuraLinux::DispatchKeyEvent(ui::KeyEvent* event) { |
| 47 DCHECK(event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED); | 47 DCHECK(event->type() == ET_KEY_PRESSED || event->type() == ET_KEY_RELEASED); |
| 48 DCHECK(system_toplevel_window_focused()); | 48 DCHECK(system_toplevel_window_focused()); |
| 49 if (!system_toplevel_window_focused()) { | |
| 50 GetLogCollector()->AddString( | |
| 51 "Unexpected DispatchKeyEvent: InputMethod is not active."); | |
| 52 GetLogCollector()->DumpLogs(); | |
| 53 // There are random issues that the keyboard typing doesn't work. | |
| 54 // The root cause might be the InputMethod::OnFocus() is not correctly | |
| 55 // called when the top-level window is activated | |
| 56 // (in DNWA::HandleActivationChanged). | |
| 57 // Calls OnFocus here to unblock the keyboard typing. | |
| 58 OnFocus(); | |
| 59 } else { | |
| 60 GetLogCollector()->ClearLogs(); | |
| 61 } | |
| 62 | 49 |
| 63 // If no text input client, do nothing. | 50 // If no text input client, do nothing. |
| 64 if (!GetTextInputClient()) { | 51 if (!GetTextInputClient()) { |
| 65 ignore_result(DispatchKeyEventPostIME(event)); | 52 ignore_result(DispatchKeyEventPostIME(event)); |
| 66 return; | 53 return; |
| 67 } | 54 } |
| 68 | 55 |
| 69 suppress_next_result_ = false; | 56 suppress_next_result_ = false; |
| 70 composition_changed_ = false; | 57 composition_changed_ = false; |
| 71 result_text_.clear(); | 58 result_text_.clear(); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 359 |
| 373 void InputMethodAuraLinux::ConfirmCompositionText() { | 360 void InputMethodAuraLinux::ConfirmCompositionText() { |
| 374 TextInputClient* client = GetTextInputClient(); | 361 TextInputClient* client = GetTextInputClient(); |
| 375 if (client && client->HasCompositionText()) | 362 if (client && client->HasCompositionText()) |
| 376 client->ConfirmCompositionText(); | 363 client->ConfirmCompositionText(); |
| 377 | 364 |
| 378 ResetContext(); | 365 ResetContext(); |
| 379 } | 366 } |
| 380 | 367 |
| 381 } // namespace ui | 368 } // namespace ui |
| OLD | NEW |