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

Side by Side Diff: ui/base/gtk/gtk_windowing.cc

Issue 8588068: GTK: Create the start of a compatibility header wrapping deprecated methods. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase to ToT and remove views/ cleanups. Created 9 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/base/gtk/gtk_floating_container.cc ('k') | ui/gfx/gtk_native_view_id_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/base/gtk/gtk_windowing.h" 5 #include "ui/base/gtk/gtk_windowing.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/base/gtk/gtk_compat.h"
10 #include "ui/base/x/x11_util.h" 11 #include "ui/base/x/x11_util.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel) { 15 void StackPopupWindow(GtkWidget* popup, GtkWidget* toplevel) {
15 DCHECK(GTK_IS_WINDOW(popup) && GTK_WIDGET_TOPLEVEL(popup) && 16 DCHECK(GTK_IS_WINDOW(popup) && gtk_widget_is_toplevel(popup) &&
16 GTK_WIDGET_REALIZED(popup)); 17 gtk_widget_get_realized(popup));
17 DCHECK(GTK_IS_WINDOW(toplevel) && GTK_WIDGET_TOPLEVEL(toplevel) && 18 DCHECK(GTK_IS_WINDOW(toplevel) && gtk_widget_is_toplevel(toplevel) &&
18 GTK_WIDGET_REALIZED(toplevel)); 19 gtk_widget_get_realized(toplevel));
19 20
20 // Stack the |popup| window directly above the |toplevel| window. 21 // Stack the |popup| window directly above the |toplevel| window.
21 // The popup window is a direct child of the root window, so we need to 22 // The popup window is a direct child of the root window, so we need to
22 // find a similar ancestor for the toplevel window (which might have been 23 // find a similar ancestor for the toplevel window (which might have been
23 // reparented by a window manager). We grab the server while we're doing 24 // reparented by a window manager). We grab the server while we're doing
24 // this -- otherwise, we'll get an error if the window manager reparents the 25 // this -- otherwise, we'll get an error if the window manager reparents the
25 // toplevel window right after we call GetHighestAncestorWindow(). 26 // toplevel window right after we call GetHighestAncestorWindow().
26 gdk_x11_display_grab(gtk_widget_get_display(toplevel)); 27 gdk_x11_display_grab(gtk_widget_get_display(toplevel));
27 XID toplevel_window_base = ui::GetHighestAncestorWindow( 28 XID toplevel_window_base = ui::GetHighestAncestorWindow(
28 ui::GetX11WindowFromGtkWidget(toplevel), 29 ui::GetX11WindowFromGtkWidget(toplevel),
29 ui::GetX11RootWindow()); 30 ui::GetX11RootWindow());
30 if (toplevel_window_base) { 31 if (toplevel_window_base) {
31 XID window_xid = ui::GetX11WindowFromGtkWidget(popup); 32 XID window_xid = ui::GetX11WindowFromGtkWidget(popup);
32 XID window_parent = ui::GetParentWindow(window_xid); 33 XID window_parent = ui::GetParentWindow(window_xid);
33 if (window_parent == ui::GetX11RootWindow()) { 34 if (window_parent == ui::GetX11RootWindow()) {
34 ui::RestackWindow(window_xid, toplevel_window_base, true); 35 ui::RestackWindow(window_xid, toplevel_window_base, true);
35 } else { 36 } else {
36 // The window manager shouldn't reparent override-redirect windows. 37 // The window manager shouldn't reparent override-redirect windows.
37 DLOG(ERROR) << "override-redirect window " << window_xid 38 DLOG(ERROR) << "override-redirect window " << window_xid
38 << "'s parent is " << window_parent 39 << "'s parent is " << window_parent
39 << ", rather than root window " 40 << ", rather than root window "
40 << ui::GetX11RootWindow(); 41 << ui::GetX11RootWindow();
41 } 42 }
42 } 43 }
43 gdk_x11_display_ungrab(gtk_widget_get_display(toplevel)); 44 gdk_x11_display_ungrab(gtk_widget_get_display(toplevel));
44 } 45 }
45 46
46 } // namespace ui 47 } // namespace ui
47 48
OLDNEW
« no previous file with comments | « ui/base/gtk/gtk_floating_container.cc ('k') | ui/gfx/gtk_native_view_id_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698