Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: ui/base/win/ime_input.cc

Issue 10907170: Show composition window for IME-unaware PPAPI plugins on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
« content/browser/renderer_host/render_widget_host_view_win.cc ('K') | « ui/base/win/ime_input.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698