Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1230)

Unified Diff: chrome/common/gtk_util.cc

Issue 274046: Linux: Stack autocomplete popup window directly on top of the browser's tople... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/gtk_util.cc
===================================================================
--- chrome/common/gtk_util.cc (revision 29084)
+++ chrome/common/gtk_util.cc (working copy)
@@ -540,4 +540,32 @@
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
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698