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

Unified Diff: ui/base/ime/input_method_win.cc

Issue 2700933002: Updates the IME state when necessary when switching top-level windows. (Closed)
Patch Set: . Created 3 years, 10 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
« no previous file with comments | « ui/base/ime/input_method_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 49efa46632113f4ed070bb20fea853d86bc49869..e2bb52868157edb9335659f41e769c1359ae12b0 100644
--- a/ui/base/ime/input_method_win.cc
+++ b/ui/base/ime/input_method_win.cc
@@ -57,6 +57,11 @@ InputMethodWin::InputMethodWin(internal::InputMethodDelegate* delegate,
InputMethodWin::~InputMethodWin() {}
+void InputMethodWin::OnFocus() {
+ InputMethodBase::OnFocus();
+ RefreshInputLanguage();
+}
+
bool InputMethodWin::OnUntranslatedIMEMessage(
const base::NativeEvent& event,
InputMethod::NativeEventResult* result) {
@@ -275,8 +280,7 @@ void InputMethodWin::OnInputLocaleChanged() {
// which is known to be incompatible with TSF.
// TODO(shuchen): Use ITfLanguageProfileNotifySink instead.
OnInputMethodChanged();
- imm32_manager_.SetInputLanguage();
- UpdateIMEState();
+ RefreshInputLanguage();
}
bool InputMethodWin::IsInputLocaleCJK() const {
@@ -656,6 +660,20 @@ LRESULT InputMethodWin::OnQueryCharPosition(IMECHARPOSITION* char_positon) {
return 1; // returns non-zero value when succeeded.
}
+void InputMethodWin::RefreshInputLanguage() {
+ TextInputType type_original = GetTextInputType();
+ imm32_manager_.SetInputLanguage();
+ if (type_original != GetTextInputType()) {
+ // Only update the IME state when necessary.
+ // It's unnecessary to report IME state, when:
+ // 1) Switching betweeen 2 top-level windows, and the switched-away window
+ // receives OnInputLocaleChanged.
+ // 2) The text input type is not changed by |SetInputLanguage|.
+ // Please refer to crbug.com/679564.
+ UpdateIMEState();
+ }
+}
+
bool InputMethodWin::IsWindowFocused(const TextInputClient* client) const {
if (!client)
return false;
« no previous file with comments | « ui/base/ime/input_method_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698