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 | 9 |
9 #include "base/linux_util.h" | 10 #include "base/linux_util.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
12 | 13 |
13 namespace { | 14 namespace { |
14 | 15 |
15 // Callback used in RemoveAllChildren. | 16 // Callback used in RemoveAllChildren. |
16 void RemoveWidget(GtkWidget* widget, gpointer container) { | 17 void RemoveWidget(GtkWidget* widget, gpointer container) { |
17 gtk_container_remove(GTK_CONTAINER(container), widget); | 18 gtk_container_remove(GTK_CONTAINER(container), widget); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 158 } |
158 | 159 |
159 return ret; | 160 return ret; |
160 } | 161 } |
161 | 162 |
162 bool IsScreenComposited() { | 163 bool IsScreenComposited() { |
163 GdkScreen* screen = gdk_screen_get_default(); | 164 GdkScreen* screen = gdk_screen_get_default(); |
164 return gdk_screen_is_composited(screen) == TRUE; | 165 return gdk_screen_is_composited(screen) == TRUE; |
165 } | 166 } |
166 | 167 |
| 168 void EnumerateChildWindows(EnumerateWindowsDelegate* delegate) { |
| 169 GdkScreen* screen = gdk_screen_get_default(); |
| 170 GList* stack = gdk_screen_get_window_stack(screen); |
| 171 DCHECK(stack); |
| 172 |
| 173 for (GList* iter = g_list_last(stack); iter; iter = iter->prev) { |
| 174 GdkWindow* window = static_cast<GdkWindow*>(iter->data); |
| 175 XID xid = GDK_WINDOW_XID(window); |
| 176 if (delegate->ShouldStopIterating(xid)) |
| 177 break; |
| 178 } |
| 179 |
| 180 g_list_foreach(stack, (GFunc)g_object_unref, NULL); |
| 181 g_list_free(stack); |
| 182 } |
| 183 |
167 } // namespace gtk_util | 184 } // namespace gtk_util |
OLD | NEW |