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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_win.h" 5 #include "ui/base/ime/input_method_win.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 } 255 }
256 256
257 LRESULT InputMethodWin::OnChar(HWND window_handle, 257 LRESULT InputMethodWin::OnChar(HWND window_handle,
258 UINT message, 258 UINT message,
259 WPARAM wparam, 259 WPARAM wparam,
260 LPARAM lparam, 260 LPARAM lparam,
261 const base::NativeEvent& event, 261 const base::NativeEvent& event,
262 BOOL* handled) { 262 BOOL* handled) {
263 *handled = TRUE; 263 *handled = TRUE;
264 264
265 if (!system_toplevel_window_focused()) {
266 LOG(ERROR) <<
267 "Char message got without the top-level window being activated.";
yukawa 2016/01/07 11:09:42 (optional) We can also log |GetActiveWindow() == t
Shu Chen 2016/01/08 02:04:11 I think ::GetActiveWindow() could return non-top-l
yukawa 2016/01/08 02:21:20 (just FYI) AFAIK it always returns a top-level win
Shu Chen 2016/01/08 09:00:16 Done.
268 // There are random issues that the keyboard typing doesn't work.
269 // The root cause might be the InputMethod::OnFocus() is not correctly
270 // called when the top-level window is activated
271 // (in DNWA::HandleActivationChanged).
272 // Calls OnFocus here to unblock the keyboard typing.
273 OnFocus();
274 }
275
265 // We need to send character events to the focused text input client event if 276 // We need to send character events to the focused text input client event if
266 // its text input type is ui::TEXT_INPUT_TYPE_NONE. 277 // its text input type is ui::TEXT_INPUT_TYPE_NONE.
267 if (GetTextInputClient()) { 278 if (GetTextInputClient()) {
268 const base::char16 kCarriageReturn = L'\r'; 279 const base::char16 kCarriageReturn = L'\r';
269 const base::char16 ch = static_cast<base::char16>(wparam); 280 const base::char16 ch = static_cast<base::char16>(wparam);
270 // A mask to determine the previous key state from |lparam|. The value is 1 281 // A mask to determine the previous key state from |lparam|. The value is 1
271 // if the key is down before the message is sent, or it is 0 if the key is 282 // if the key is down before the message is sent, or it is 0 if the key is
272 // up. 283 // up.
273 const uint32_t kPrevKeyDownBit = 0x40000000; 284 const uint32_t kPrevKeyDownBit = 0x40000000;
274 if (ch == kCarriageReturn && !(lparam & kPrevKeyDownBit)) 285 if (ch == kCarriageReturn && !(lparam & kPrevKeyDownBit))
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 enabled_ = true; 645 enabled_ = true;
635 break; 646 break;
636 } 647 }
637 648
638 imm32_manager_.SetTextInputMode(window_handle, text_input_mode); 649 imm32_manager_.SetTextInputMode(window_handle, text_input_mode);
639 tsf_inputscope::SetInputScopeForTsfUnawareWindow( 650 tsf_inputscope::SetInputScopeForTsfUnawareWindow(
640 window_handle, text_input_type, text_input_mode); 651 window_handle, text_input_type, text_input_mode);
641 } 652 }
642 653
643 } // namespace ui 654 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698