From aeba67b45fc66b5c03205a470cb87d3995ab198a Mon Sep 17 00:00:00 2001 From: "suzhe@chromium.org" Date: Thu, 15 Oct 2009 08:20:19 +0000 Subject: Linux: Stack autocomplete popup window directly on top of the browser's toplevel window. BUG=19082 "Linux: Omnibox auto-complete popup is on top of IME candidate window when using SCIM" TEST=Please refer to the bug report for how to test. Review URL: http://codereview.chromium.org/274046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29102 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/views/autocomplete/autocomplete_popup_gtk.cc | 16 ++++++++++++++-- .../browser/views/autocomplete/autocomplete_popup_gtk.h | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'chrome/browser/views') diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc index 0905546..d7698ec 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.cc @@ -8,6 +8,7 @@ #include "chrome/browser/autocomplete/autocomplete_edit_view.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" +#include "chrome/common/gtk_util.h" //////////////////////////////////////////////////////////////////////////////// // AutocompletePopupGtk, public: @@ -15,7 +16,8 @@ AutocompletePopupGtk::AutocompletePopupGtk( AutocompletePopupContentsView* contents) : WidgetGtk(WidgetGtk::TYPE_POPUP), - contents_(contents) { + contents_(contents), + edit_view_(NULL) { set_delete_on_destroy(false); } @@ -31,14 +33,18 @@ void AutocompletePopupGtk::Init(AutocompleteEditView* edit_view, // The contents is owned by the LocationBarView. contents_->SetParentOwned(false); SetContentsView(contents_); + + edit_view_ = edit_view; } void AutocompletePopupGtk::Show() { // Move the popup to the place appropriate for the window's current position - // it may have been moved since it was last shown. SetBounds(contents_->GetPopupBounds()); - if (!IsVisible()) + if (!IsVisible()) { WidgetGtk::Show(); + StackWindow(); + } } bool AutocompletePopupGtk::IsOpen() const { @@ -48,3 +54,9 @@ bool AutocompletePopupGtk::IsOpen() const { bool AutocompletePopupGtk::IsCreated() const { return GTK_IS_WIDGET(GetNativeView()); } + +void AutocompletePopupGtk::StackWindow() { + GtkWidget* toplevel = gtk_widget_get_toplevel(edit_view_->GetNativeView()); + DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); + gtk_util::StackPopupWindow(GetNativeView(), toplevel); +} diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h index 3ae2625..08e003e 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h +++ b/chrome/browser/views/autocomplete/autocomplete_popup_gtk.h @@ -28,8 +28,12 @@ class AutocompletePopupGtk : public views::WidgetGtk { // Returns true if the popup has been created. bool IsCreated() const; + // Restack the popup window directly above the browser's toplevel window. + void StackWindow(); + private: AutocompletePopupContentsView* contents_; + AutocompleteEditView* edit_view_; DISALLOW_COPY_AND_ASSIGN(AutocompletePopupGtk); }; -- cgit v1.1