| 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;
|
|
|