summaryrefslogtreecommitdiffstats
path: root/chrome/common/gtk_util.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 23:31:11 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 23:31:11 +0000
commit5d365bd6cc0b12e8baa33cdb6055435ca80d1e7b (patch)
tree9c927e9ada5dabd27d3a8d0a5b810effff8b76f2 /chrome/common/gtk_util.cc
parentb81bf79682de74928c3a5be68ed9802f9717c5a9 (diff)
downloadchromium_src-5d365bd6cc0b12e8baa33cdb6055435ca80d1e7b.zip
chromium_src-5d365bd6cc0b12e8baa33cdb6055435ca80d1e7b.tar.gz
chromium_src-5d365bd6cc0b12e8baa33cdb6055435ca80d1e7b.tar.bz2
gtk: Implement and use x11_util::GetXWindowStack, which is a less flaky and faster version of gdk_screen_get_window_stack. The latter was not consistently returning our browser windows in the window stack.
BUG=none TEST=Extensive tab dragging. Review URL: http://codereview.chromium.org/179056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gtk_util.cc')
-rw-r--r--chrome/common/gtk_util.cc20
1 files changed, 6 insertions, 14 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index 16ce02b..83ddddd 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -251,9 +251,8 @@ bool IsScreenComposited() {
}
void EnumerateTopLevelWindows(x11_util::EnumerateWindowsDelegate* delegate) {
- GdkScreen* screen = gdk_screen_get_default();
- GList* stack = gdk_screen_get_window_stack(screen);
- if (!stack) {
+ std::vector<XID> stack;
+ if (!x11_util::GetXWindowStack(&stack)) {
// Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back
// to old school enumeration of all X windows. Some WMs parent 'top-level'
// windows in unnamed actual top-level windows (ion WM), so extend the
@@ -263,18 +262,11 @@ void EnumerateTopLevelWindows(x11_util::EnumerateWindowsDelegate* delegate) {
return;
}
- for (GList* iter = g_list_last(stack); iter; iter = iter->prev) {
- GdkWindow* window = static_cast<GdkWindow*>(iter->data);
- if (!gdk_window_is_visible(window))
- continue;
-
- XID xid = GDK_WINDOW_XID(window);
- if (delegate->ShouldStopIterating(xid))
- break;
+ std::vector<XID>::iterator iter;
+ for (iter = stack.begin(); iter != stack.end(); iter++) {
+ if (delegate->ShouldStopIterating(*iter))
+ return;
}
-
- g_list_foreach(stack, (GFunc)g_object_unref, NULL);
- g_list_free(stack);
}
void SetButtonTriggersNavigation(GtkWidget* button) {