diff options
author | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 12:06:14 +0000 |
---|---|---|
committer | hbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-19 12:06:14 +0000 |
commit | 6468b72bb88843d39a831b6841bc1f02cf77dc98 (patch) | |
tree | 8d4bd12cddd917e8cabb221129d7c3b0718ae9d2 /chrome/browser/autocomplete | |
parent | 08e0f82c4a60e88a8967536afe4d997f8051be81 (diff) | |
download | chromium_src-6468b72bb88843d39a831b6841bc1f02cf77dc98.zip chromium_src-6468b72bb88843d39a831b6841bc1f02cf77dc98.tar.gz chromium_src-6468b72bb88843d39a831b6841bc1f02cf77dc98.tar.bz2 |
A quick fix for Issue 2720.
To investigate this issue, we noticed some IMEs got confused when we change the text in a rich-edit control and finish an ongoing IME composition while they are composing a text. To prevent this, we accept keywords when they are activated.
Review URL: http://codereview.chromium.org/42275
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12089 0039d316-1c4b-4281-b951-d872f2087c98
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); |