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

Unified Diff: ui/base/ime/input_method_win.cc

Issue 1566083002: Makes sure the keyboard typing isn't blocked when InputMethod::OnFocus() is not correctly called. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remote_input_method_win.cc is gone again. Created 4 years, 11 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 | « ui/base/ime/input_method_log_collector.cc ('k') | ui/base/ime/mock_input_method.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/input_method_win.cc
diff --git a/ui/base/ime/input_method_win.cc b/ui/base/ime/input_method_win.cc
index 56bbac1b3244b1618eeaa89001155b815223cdf6..a50d8771df642221d607482658f2437298a3f332 100644
--- a/ui/base/ime/input_method_win.cc
+++ b/ui/base/ime/input_method_win.cc
@@ -262,6 +262,22 @@ LRESULT InputMethodWin::OnChar(HWND window_handle,
BOOL* handled) {
*handled = TRUE;
+ if (!system_toplevel_window_focused()) {
+ GetLogCollector()->AddString(
+ "Unexpected OnChar: InputMethod is not active. Window focused: ");
+ GetLogCollector()->AddBoolean(
+ ::GetActiveWindow() == toplevel_window_handle_);
+ GetLogCollector()->DumpLogs();
+ // There are random issues that the keyboard typing doesn't work.
+ // The root cause might be the InputMethod::OnFocus() is not correctly
+ // called when the top-level window is activated
+ // (in DNWA::HandleActivationChanged).
+ // Calls OnFocus here to unblock the keyboard typing.
+ OnFocus();
+ } else {
+ GetLogCollector()->ClearLogs();
+ }
+
// We need to send character events to the focused text input client event if
// its text input type is ui::TEXT_INPUT_TYPE_NONE.
if (GetTextInputClient()) {
@@ -295,6 +311,7 @@ LRESULT InputMethodWin::OnImeSetContext(HWND window_handle,
WPARAM wparam,
LPARAM lparam,
BOOL* handled) {
+ GetLogCollector()->AddString("WM_IME_SETCONTEXT");
if (!!wparam) {
imm32_manager_.CreateImeWindow(window_handle);
if (system_toplevel_window_focused()) {
« no previous file with comments | « ui/base/ime/input_method_log_collector.cc ('k') | ui/base/ime/mock_input_method.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698