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 7db88b6298a3aba4b56d8eff5902250e1a2f00de..c8869ae826d576c243119533048d22d3c3ac3078 100644 |
--- a/ui/base/ime/input_method_win.cc |
+++ b/ui/base/ime/input_method_win.cc |
@@ -32,8 +32,7 @@ InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate, |
accept_carriage_return_(false), |
enabled_(false), |
is_candidate_popup_open_(false), |
- composing_window_handle_(NULL), |
- suppress_next_char_(false) { |
+ composing_window_handle_(NULL) { |
SetDelegate(delegate); |
} |
@@ -104,9 +103,17 @@ void InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) { |
return; |
} |
+ MSG msg; |
+ std::vector<MSG> char_msgs; |
const base::NativeEvent& native_key_event = event->native_event(); |
+ ::TranslateMessage(&native_key_event); |
+ while (::PeekMessage(&msg, native_key_event.hwnd, WM_CHAR, WM_SYSCHAR, |
James Su
2015/08/03 07:31:18
is it necessary to handle WM_DEADCHAR and WM_SYSDE
Shu Chen
2015/08/03 07:39:59
No, chrome nevers handles WM_DEADCHAR & WM_SYSDEAD
yukawa
2015/08/03 08:09:46
The fact that Chrome has never handled WM_DEADCHAR
Shu Chen
2015/08/04 08:18:42
What do you mean by removing WM_DEADCHAR?
If you m
yukawa
2015/08/04 08:35:07
Ah, sorry I misunderstood this code.
Can you leave
Shu Chen
2015/08/05 01:36:45
Done.
|
+ PM_REMOVE)) { |
+ char_msgs.push_back(msg); |
+ } |
+ |
+ BOOL handled = FALSE; |
if (native_key_event.message == WM_CHAR) { |
- BOOL handled; |
OnChar(native_key_event.hwnd, native_key_event.message, |
native_key_event.wParam, native_key_event.lParam, &handled); |
if (handled) |
@@ -137,8 +144,14 @@ void InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) { |
} |
ui::EventDispatchDetails details = DispatchKeyEventPostIME(event); |
- if (!details.dispatcher_destroyed) |
- suppress_next_char_ = event->stopped_propagation(); |
+ if (details.dispatcher_destroyed || event->stopped_propagation()) |
James Su
2015/08/03 07:07:11
is it necessary to check details.target_destroyed?
Shu Chen
2015/08/04 08:18:42
Done.
|
+ return; |
+ |
+ for (size_t i = 0; i < char_msgs.size(); ++i) { |
+ msg = char_msgs[i]; |
+ if (msg.message == WM_CHAR || msg.message == WM_SYSCHAR) |
+ OnChar(msg.hwnd, msg.message, msg.wParam, msg.lParam, &handled); |
+ } |
} |
void InputMethodWin::OnTextInputTypeChanged(const TextInputClient* client) { |
@@ -224,11 +237,6 @@ LRESULT InputMethodWin::OnChar(HWND window_handle, |
*handled = TRUE; |
- if (suppress_next_char_) { |
- suppress_next_char_ = false; |
- return 0; |
- } |
- |
// 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()) { |
@@ -587,10 +595,6 @@ bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const { |
void InputMethodWin::DispatchFabricatedKeyEvent(ui::KeyEvent* event) { |
if (event->is_char()) { |
- if (suppress_next_char_) { |
- suppress_next_char_ = false; |
- return; |
- } |
if (GetTextInputClient()) { |
GetTextInputClient()->InsertChar( |
static_cast<base::char16>(event->key_code()), |