| 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..5f3d91537967e3d5a048b00723574ef2c9d6150f 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,29 @@ void InputMethodWin::DispatchKeyEvent(ui::KeyEvent* event) {
|
| return;
|
| }
|
|
|
| + std::vector<MSG> char_msgs;
|
| const base::NativeEvent& native_key_event = event->native_event();
|
| + ::TranslateMessage(&native_key_event);
|
| + // Peek & remove the following messages in the message queue.
|
| + // - WM_CHAR (0x0102)
|
| + // - WM_DEADCHAR (0x0103)
|
| + // - WM_SYSCHAR (0x0106)
|
| + // - WM_SYSDEADCHAR (0x0107)
|
| + // And only process WM_CHAR & WM_SYSCHAR message in browser.
|
| + MSG msg;
|
| + while (::PeekMessage(&msg, native_key_event.hwnd, WM_CHAR, WM_DEADCHAR,
|
| + PM_REMOVE)) {
|
| + if (msg.message == WM_CHAR)
|
| + char_msgs.push_back(msg);
|
| + }
|
| + while (::PeekMessage(&msg, native_key_event.hwnd, WM_SYSCHAR, WM_SYSDEADCHAR,
|
| + PM_REMOVE)) {
|
| + if (msg.message == WM_SYSCHAR)
|
| + 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 +156,15 @@ 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 || details.target_destroyed ||
|
| + event->stopped_propagation()) {
|
| + return;
|
| + }
|
| +
|
| + for (size_t i = 0; i < char_msgs.size(); ++i) {
|
| + msg = char_msgs[i];
|
| + OnChar(msg.hwnd, msg.message, msg.wParam, msg.lParam, &handled);
|
| + }
|
| }
|
|
|
| void InputMethodWin::OnTextInputTypeChanged(const TextInputClient* client) {
|
| @@ -224,11 +250,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 +608,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()),
|
|
|