summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 05:08:22 +0000
committeryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 05:08:22 +0000
commitd05cdf266c794c4a68622bae449b861b05940f74 (patch)
treecfbc425b4bc586f04a1f99686e9d1c13a69a1059
parentd3f46585fdf14a7f69f12b97a86396e0efdb8773 (diff)
downloadchromium_src-d05cdf266c794c4a68622bae449b861b05940f74.zip
chromium_src-d05cdf266c794c4a68622bae449b861b05940f74.tar.gz
chromium_src-d05cdf266c794c4a68622bae449b861b05940f74.tar.bz2
Modify language menu so it does not take the keyboard focus on popup.
BUG=chromium-os:5796 TEST=login, enable Japanese IME, click Omnibox, type aaa, make sure a preedit string like あああ is shown, click the language menu botton on the top-right corner of Chrome, make sure the language menu pops up, click the button again to close the menu, verify that the preedit string あああ still exists. Review URL: http://codereview.chromium.org/3185009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56485 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/status/language_menu_button.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/status/language_menu_button.cc b/chrome/browser/chromeos/status/language_menu_button.cc
index b74f4e6..695cdf7 100644
--- a/chrome/browser/chromeos/status/language_menu_button.cc
+++ b/chrome/browser/chromeos/status/language_menu_button.cc
@@ -393,6 +393,22 @@ void LanguageMenuButton::RunMenu(views::View* source, const gfx::Point& pt) {
GetActiveInputMethods());
RebuildModel();
language_menu_.Rebuild();
+
+ // Disallow the menu widget to grab the keyboard focus. This is necessary to
+ // enable users to change status of an input method (e.g. change the input
+ // mode from Japanese Hiragana to Japanese Katakana) without discarding a
+ // preedit string. See crosbug.com/5796 for details. Note that menus other
+ // than this one should not call the Gtk+ API since it is a special API only
+ // for a menu related to IME/keyboard. See the Gtk+ API reference at:
+ // http://library.gnome.org/devel/gtk/stable/GtkMenuShell.html
+ gfx::NativeMenu native_menu = language_menu_.GetNativeMenu();
+ if (native_menu) {
+ gtk_menu_shell_set_take_focus(GTK_MENU_SHELL(native_menu), FALSE);
+ } else {
+ LOG(ERROR)
+ << "Can't call gtk_menu_shell_set_take_focus since NativeMenu is NULL";
+ }
+
language_menu_.UpdateStates();
language_menu_.RunMenuAt(pt, views::Menu2::ALIGN_TOPRIGHT);
}