Index: ui/base/win/ime_input.cc |
diff --git a/ui/base/win/ime_input.cc b/ui/base/win/ime_input.cc |
index 2fa31082f411429bb21fc0e9a4e885275db1fefd..dcb4ef37968adb6202adfa105499dcf3f6e4977e 100644 |
--- a/ui/base/win/ime_input.cc |
+++ b/ui/base/win/ime_input.cc |
@@ -123,7 +123,8 @@ ImeInput::ImeInput() |
input_language_id_(LANG_USER_DEFAULT), |
is_composing_(false), |
system_caret_(false), |
- caret_rect_(-1, -1, 0, 0) { |
+ caret_rect_(-1, -1, 0, 0), |
+ use_composition_window_(false) { |
} |
ImeInput::~ImeInput() { |
@@ -190,8 +191,10 @@ void ImeInput::DestroyImeWindow(HWND window_handle) { |
void ImeInput::MoveImeWindow(HWND window_handle, HIMC imm_context) { |
int x = caret_rect_.x(); |
int y = caret_rect_.y(); |
+ |
const int kCaretMargin = 1; |
- if (PRIMARYLANGID(input_language_id_) == LANG_CHINESE) { |
+ if (!use_composition_window_ && |
+ PRIMARYLANGID(input_language_id_) == LANG_CHINESE) { |
// As written in a comment in ImeInput::CreateImeWindow(), |
// Chinese IMEs ignore function calls to ::ImmSetCandidateWindow() |
// when a user disables TSF (Text Service Framework) and CUAS (Cicero |
@@ -216,6 +219,14 @@ void ImeInput::MoveImeWindow(HWND window_handle, HIMC imm_context) { |
break; |
} |
} |
+ if (use_composition_window_) { |
+ // Moves the composition text window. |
+ COMPOSITIONFORM cf = {CFS_POINT, {x, y}}; |
+ ::ImmSetCompositionWindow(imm_context, &cf); |
+ // Don't need to set the position of candidate window. |
+ return; |
+ } |
+ |
if (PRIMARYLANGID(input_language_id_) == LANG_KOREAN) { |
// Chinese IMEs and Japanese IMEs require the upper-left corner of |
// the caret to move the position of their candidate windows. |
@@ -446,6 +457,10 @@ void ImeInput::UpdateCaretRect(HWND window_handle, |
} |
} |
+void ImeInput::SetUseCompositionWindow(bool use_composition_window) { |
+ use_composition_window_ = use_composition_window; |
+} |
+ |
std::string ImeInput::GetInputLanguageName() const { |
const LCID locale_id = MAKELCID(input_language_id_, SORT_DEFAULT); |
// max size for LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME is 9. |