diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 03:09:46 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-24 03:09:46 +0000 |
commit | 75ce59818f03c88848fd3cf52208e988b9c57d94 (patch) | |
tree | 49c87da685575ff4afb44cb19cb460f1fcd756b8 | |
parent | 189fff9b9a6540d3b135e85ee71b65934d32925d (diff) | |
download | chromium_src-75ce59818f03c88848fd3cf52208e988b9c57d94.zip chromium_src-75ce59818f03c88848fd3cf52208e988b9c57d94.tar.gz chromium_src-75ce59818f03c88848fd3cf52208e988b9c57d94.tar.bz2 |
Merge 67207 - [cros] Fix two issues related to gtk im context support.
BUG=chromium-os:9208
BUG=chromium-os:9575
TEST=See bug reports.
Issue 9208 is due to ibus's async nature: some ibus engines may update preedit string when getting reset. It may happen after calling GtkIMContextWrapper::CancelComposition() method, which then cause this method being called recursively.
So we need to suppress any preedit string signals triggered by GtkIMContextWrapper::CancelComposition() method, just like what we have done for commit signal (http://crbug.com/50485 and issue http://crosbug.com/4792).
Issue 9575 is caused by improper handling of "grab-notify" signal in RWHVGtk, which should not focus in the input context again when the window has been focused out.
Review URL: http://codereview.chromium.org/5372001
TBR=suzhe@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/branches/552d/src@67209 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/gtk_im_context_wrapper.cc | 8 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_widget_host_view_gtk.cc | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc index 1c07795..69efcf6 100644 --- a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc +++ b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc @@ -455,13 +455,19 @@ void GtkIMContextWrapper::HandleCommit(const string16& text) { } void GtkIMContextWrapper::HandlePreeditStart() { + // Ignore preedit related signals triggered by CancelComposition() method. + if (suppress_next_commit_) + return; is_composing_text_ = true; } void GtkIMContextWrapper::HandlePreeditChanged(const gchar* text, PangoAttrList* attrs, int cursor_position) { - suppress_next_commit_ = false; + // Ignore preedit related signals triggered by CancelComposition() method. + if (suppress_next_commit_) + return; + // Don't set is_preedit_changed_ to false if there is no change, because // this handler might be called multiple times with the same data. is_preedit_changed_ = true; diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index c69397d..f9cd3f4 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -203,6 +203,9 @@ class RenderWidgetHostViewGtkWidget { if (!host_view->is_showing_context_menu_) host_view->GetRenderWidgetHost()->Blur(); + // Prevents us from stealing input context focus in OnGrabNotify() handler. + host_view->was_focused_before_grab_ = false; + // Disable the GtkIMContext object. host_view->im_context_->OnFocusOut(); |