| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/gtk_util.h" | 5 #include "chrome/common/gtk_util.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 | 9 |
| 10 #include <cstdarg> | 10 #include <cstdarg> |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 &true_value); | 533 &true_value); |
| 534 } | 534 } |
| 535 #endif | 535 #endif |
| 536 } | 536 } |
| 537 | 537 |
| 538 GdkCursor* GetCursor(GdkCursorType type) { | 538 GdkCursor* GetCursor(GdkCursorType type) { |
| 539 static GdkCursorCache impl; | 539 static GdkCursorCache impl; |
| 540 return impl.GetCursorImpl(type); | 540 return impl.GetCursorImpl(type); |
| 541 } | 541 } |
| 542 | 542 |
| 543 void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel) { |
| 544 DCHECK(GTK_IS_WINDOW(popup) && GTK_WIDGET_TOPLEVEL(popup) && |
| 545 GTK_WIDGET_REALIZED(popup)); |
| 546 DCHECK(GTK_IS_WINDOW(toplevel) && GTK_WIDGET_TOPLEVEL(toplevel) && |
| 547 GTK_WIDGET_REALIZED(toplevel)); |
| 548 |
| 549 // Stack the |popup| window directly above the |toplevel| window. |
| 550 // The |popup| window is a direct child of the root window, so we need to |
| 551 // find a similar ancestor for the toplevel window (which might have been |
| 552 // reparented by a window manager). |
| 553 XID toplevel_window_base = x11_util::GetHighestAncestorWindow( |
| 554 x11_util::GetX11WindowFromGtkWidget(toplevel), |
| 555 x11_util::GetX11RootWindow()); |
| 556 if (toplevel_window_base) { |
| 557 XID window_xid = x11_util::GetX11WindowFromGtkWidget(popup); |
| 558 XID window_parent = x11_util::GetParentWindow(window_xid); |
| 559 if (window_parent == x11_util::GetX11RootWindow()) { |
| 560 x11_util::RestackWindow(window_xid, toplevel_window_base, true); |
| 561 } else { |
| 562 // The window manager shouldn't reparent override-redirect windows. |
| 563 DLOG(ERROR) << "override-redirect window " << window_xid |
| 564 << "'s parent is " << window_parent |
| 565 << ", rather than root window " |
| 566 << x11_util::GetX11RootWindow(); |
| 567 } |
| 568 } |
| 569 } |
| 570 |
| 543 } // namespace gtk_util | 571 } // namespace gtk_util |
| OLD | NEW |