Skip to content
Snippets Groups Projects
Commit 822b6ed7 authored by yusukes@google.com's avatar yusukes@google.com
Browse files

Pass a correct input method descriptor to the ActiveInputMethodsChanged function.

A comment explaining why ActiveInputMethodsChanged has to be called in FlushImeConfig() is also added since it took some time for me to figure out why it was necessary.

BUG=chromium-os:10676
TEST=manually done.

Review URL: http://codereview.chromium.org/6088010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70725 0039d316-1c4b-4281-b951-d872f2087c98
parent d9e6f8b3
No related merge requests found
...@@ -327,12 +327,35 @@ class InputMethodLibraryImpl : public InputMethodLibrary, ...@@ -327,12 +327,35 @@ class InputMethodLibraryImpl : public InputMethodLibrary,
this, &InputMethodLibraryImpl::FlushImeConfig); this, &InputMethodLibraryImpl::FlushImeConfig);
} }
// Notify the current input method and the number of active input methods to
// the UI so that the UI could determine e.g. if it should show/hide the
// input method indicator, etc. We have to call FOR_EACH_OBSERVER here since
// updating "preload_engine" does not necessarily trigger a DBus signal such
// as "global-engine-changed". For example,
// 1) If we change the preload_engine from "xkb:us:intl:eng" (i.e. the
// indicator is hidden) to "xkb:us:intl:eng,mozc", we have to update UI
// so it shows the indicator, but no signal is sent from ibus-daemon
// because the current input method is not changed.
// 2) If we change the preload_engine from "xkb:us::eng,mozc" (i.e. the
// indicator is shown and ibus-daemon is started) to "xkb:us::eng", we
// have to update UI so it hides the indicator, but we should not expect
// that ibus-daemon could send a DBus signal since the daemon is killed
// right after this FlushImeConfig() call.
if (active_input_methods_are_changed) { if (active_input_methods_are_changed) {
scoped_ptr<InputMethodDescriptor> current_input_method(
chromeos::GetCurrentInputMethod(input_method_status_connection_));
// The |current_input_method_| member variable should not be used since
// the variable might be stale. SetImeConfig("preload_engine") call above
// might change the current input method in ibus-daemon, but the variable
// is not updated until InputMethodChangedHandler(), which is the handler
// for the global-engine-changed DBus signal, is called.
const size_t num_active_input_methods = GetNumActiveInputMethods(); const size_t num_active_input_methods = GetNumActiveInputMethods();
FOR_EACH_OBSERVER(Observer, observers_, if (current_input_method.get()) {
ActiveInputMethodsChanged(this, FOR_EACH_OBSERVER(Observer, observers_,
current_input_method_, ActiveInputMethodsChanged(this,
num_active_input_methods)); *current_input_method.get(),
num_active_input_methods));
}
} }
} }
......
...@@ -4,5 +4,5 @@ vars = { ...@@ -4,5 +4,5 @@ vars = {
deps = { deps = {
"src/third_party/cros": "src/third_party/cros":
Var("chromium_git") + "/cros.git@08c38e03", Var("chromium_git") + "/cros.git@1ee59b10",
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment