diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 08:20:19 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-15 08:20:19 +0000 |
commit | aeba67b45fc66b5c03205a470cb87d3995ab198a (patch) | |
tree | 84dcd8a86108ddd2b0c18e40795dfbea1b32dc7d /chrome/common | |
parent | f35334961b26e1382810780a99761c8fc1086d5f (diff) | |
download | chromium_src-aeba67b45fc66b5c03205a470cb87d3995ab198a.zip chromium_src-aeba67b45fc66b5c03205a470cb87d3995ab198a.tar.gz chromium_src-aeba67b45fc66b5c03205a470cb87d3995ab198a.tar.bz2 |
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
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/gtk_util.cc | 28 | ||||
-rw-r--r-- | chrome/common/gtk_util.h | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index 2c42f7d..842b99a 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -540,4 +540,32 @@ GdkCursor* GetCursor(GdkCursorType type) { return impl.GetCursorImpl(type); } +void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel) { + DCHECK(GTK_IS_WINDOW(popup) && GTK_WIDGET_TOPLEVEL(popup) && + GTK_WIDGET_REALIZED(popup)); + DCHECK(GTK_IS_WINDOW(toplevel) && GTK_WIDGET_TOPLEVEL(toplevel) && + GTK_WIDGET_REALIZED(toplevel)); + + // Stack the |popup| window directly above the |toplevel| window. + // The |popup| window is a direct child of the root window, so we need to + // find a similar ancestor for the toplevel window (which might have been + // reparented by a window manager). + XID toplevel_window_base = x11_util::GetHighestAncestorWindow( + x11_util::GetX11WindowFromGtkWidget(toplevel), + x11_util::GetX11RootWindow()); + if (toplevel_window_base) { + XID window_xid = x11_util::GetX11WindowFromGtkWidget(popup); + XID window_parent = x11_util::GetParentWindow(window_xid); + if (window_parent == x11_util::GetX11RootWindow()) { + x11_util::RestackWindow(window_xid, toplevel_window_base, true); + } else { + // The window manager shouldn't reparent override-redirect windows. + DLOG(ERROR) << "override-redirect window " << window_xid + << "'s parent is " << window_parent + << ", rather than root window " + << x11_util::GetX11RootWindow(); + } + } +} + } // namespace gtk_util diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h index dfdde5a..749aade 100644 --- a/chrome/common/gtk_util.h +++ b/chrome/common/gtk_util.h @@ -181,6 +181,9 @@ void SetAlwaysShowImage(GtkWidget* image_menu_item); // with gdk_cursor_new(); owner must gdk_cursor_unref() it when done with it. GdkCursor* GetCursor(GdkCursorType type); +// Stacks a |popup| window directly on top of a |toplevel| window. +void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel); + } // namespace gtk_util #endif // CHROME_COMMON_GTK_UTIL_H_ |