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 <cstdarg> | |
8 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
9 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
10 | 9 |
| 10 #include <cstdarg> |
| 11 |
11 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
12 #include "base/linux_util.h" | 13 #include "base/linux_util.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 // Callback used in RemoveAllChildren. | 19 // Callback used in RemoveAllChildren. |
19 void RemoveWidget(GtkWidget* widget, gpointer container) { | 20 void RemoveWidget(GtkWidget* widget, gpointer container) { |
20 gtk_container_remove(GTK_CONTAINER(container), widget); | 21 gtk_container_remove(GTK_CONTAINER(container), widget); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 bool IsScreenComposited() { | 227 bool IsScreenComposited() { |
227 GdkScreen* screen = gdk_screen_get_default(); | 228 GdkScreen* screen = gdk_screen_get_default(); |
228 return gdk_screen_is_composited(screen) == TRUE; | 229 return gdk_screen_is_composited(screen) == TRUE; |
229 } | 230 } |
230 | 231 |
231 void EnumerateTopLevelWindows(x11_util::EnumerateWindowsDelegate* delegate) { | 232 void EnumerateTopLevelWindows(x11_util::EnumerateWindowsDelegate* delegate) { |
232 GdkScreen* screen = gdk_screen_get_default(); | 233 GdkScreen* screen = gdk_screen_get_default(); |
233 GList* stack = gdk_screen_get_window_stack(screen); | 234 GList* stack = gdk_screen_get_window_stack(screen); |
234 if (!stack) { | 235 if (!stack) { |
235 // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back | 236 // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back |
236 // to old school enumeration of all X windows. | 237 // to old school enumeration of all X windows. Some WMs parent 'top-level' |
237 x11_util::EnumerateAllWindows(delegate); | 238 // windows in unnamed actual top-level windows (ion WM), so extend the |
| 239 // search depth to all children of top-level windows. |
| 240 const int kMaxSearchDepth = 1; |
| 241 x11_util::EnumerateAllWindows(delegate, kMaxSearchDepth); |
238 return; | 242 return; |
239 } | 243 } |
240 | 244 |
241 for (GList* iter = g_list_last(stack); iter; iter = iter->prev) { | 245 for (GList* iter = g_list_last(stack); iter; iter = iter->prev) { |
242 GdkWindow* window = static_cast<GdkWindow*>(iter->data); | 246 GdkWindow* window = static_cast<GdkWindow*>(iter->data); |
243 if (!gdk_window_is_visible(window)) | 247 if (!gdk_window_is_visible(window)) |
244 continue; | 248 continue; |
245 | 249 |
246 XID xid = GDK_WINDOW_XID(window); | 250 XID xid = GDK_WINDOW_XID(window); |
247 if (delegate->ShouldStopIterating(xid)) | 251 if (delegate->ShouldStopIterating(xid)) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, | 284 // GTK_NO_WINDOW widgets, and are relative to widget->allocation.x, |
281 // widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. | 285 // widget->allocation.y for widgets that are GTK_NO_WINDOW widgets. |
282 // | 286 // |
283 // So the base is always (0,0). | 287 // So the base is always (0,0). |
284 gfx::Rect widget_allocation(0, 0, widget->allocation.width, | 288 gfx::Rect widget_allocation(0, 0, widget->allocation.width, |
285 widget->allocation.height); | 289 widget->allocation.height); |
286 return widget_allocation.Contains(x, y); | 290 return widget_allocation.Contains(x, y); |
287 } | 291 } |
288 | 292 |
289 } // namespace gtk_util | 293 } // namespace gtk_util |
OLD | NEW |