From 5d365bd6cc0b12e8baa33cdb6055435ca80d1e7b Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Tue, 1 Sep 2009 23:31:11 +0000 Subject: 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 --- chrome/common/gtk_util.cc | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'chrome/common/gtk_util.cc') 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 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(iter->data); - if (!gdk_window_is_visible(window)) - continue; - - XID xid = GDK_WINDOW_XID(window); - if (delegate->ShouldStopIterating(xid)) - break; + std::vector::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) { -- cgit v1.1