diff options
Diffstat (limited to 'chrome/browser/autocomplete')
| -rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_win.cc | 22 | ||||
| -rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_win.h | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index 66db822..d8c88b0 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -1202,6 +1202,28 @@ LRESULT AutocompleteEditViewWin::OnImeComposition(UINT message, return result; } +LRESULT AutocompleteEditViewWin::OnImeNotify(UINT message, + WPARAM wparam, + LPARAM lparam) { + if (wparam == IMN_SETOPENSTATUS) { + // A user has activated (or deactivated) IMEs (but not started a + // composition). + // Some IMEs get confused when we accept keywords while they are composing + // text. To prevent this situation, we accept keywords when an IME is + // activated. + HIMC imm_context = ImmGetContext(m_hWnd); + if (imm_context) { + if (ImmGetOpenStatus(imm_context) && + model_->is_keyword_hint() && !model_->keyword().empty()) { + ScopedFreeze freeze(this, GetTextObjectModel()); + model_->AcceptKeyword(); + } + ImmReleaseContext(m_hWnd, imm_context); + } + } + return DefWindowProc(message, wparam, lparam); +} + void AutocompleteEditViewWin::OnKeyDown(TCHAR key, UINT repeat_count, UINT flags) { diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h index b69005a..06bfbab 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h @@ -151,6 +151,7 @@ class AutocompleteEditViewWin MSG_WM_CUT(OnCut) MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject) MESSAGE_HANDLER_EX(WM_IME_COMPOSITION, OnImeComposition) + MESSAGE_HANDLER_EX(WM_IME_NOTIFY, OnImeNotify) MSG_WM_KEYDOWN(OnKeyDown) MSG_WM_KEYUP(OnKeyUp) MSG_WM_KILLFOCUS(OnKillFocus) @@ -230,6 +231,7 @@ class AutocompleteEditViewWin void OnCut(); LRESULT OnGetObject(UINT uMsg, WPARAM wparam, LPARAM lparam); LRESULT OnImeComposition(UINT message, WPARAM wparam, LPARAM lparam); + LRESULT OnImeNotify(UINT message, WPARAM wparam, LPARAM lparam); void OnKeyDown(TCHAR key, UINT repeat_count, UINT flags); void OnKeyUp(TCHAR key, UINT repeat_count, UINT flags); void OnKillFocus(HWND focus_wnd); |
