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

Side by Side Diff: chrome/common/gtk_util.cc

Issue 141061: Revert to enumerating all X windows if the Window Manager doesn't support _NE... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/gtk_util.h ('k') | chrome/common/x11_util.h » ('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) 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> 7 #include <cstdarg>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <gdk/gdkx.h> 9 #include <gdk/gdkx.h>
10 10
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 210
211 return ret; 211 return ret;
212 } 212 }
213 213
214 bool IsScreenComposited() { 214 bool IsScreenComposited() {
215 GdkScreen* screen = gdk_screen_get_default(); 215 GdkScreen* screen = gdk_screen_get_default();
216 return gdk_screen_is_composited(screen) == TRUE; 216 return gdk_screen_is_composited(screen) == TRUE;
217 } 217 }
218 218
219 void EnumerateChildWindows(EnumerateWindowsDelegate* delegate) { 219 void EnumerateTopLevelWindows(x11_util::EnumerateWindowsDelegate* delegate) {
220 GdkScreen* screen = gdk_screen_get_default(); 220 GdkScreen* screen = gdk_screen_get_default();
221 GList* stack = gdk_screen_get_window_stack(screen); 221 GList* stack = gdk_screen_get_window_stack(screen);
222 DCHECK(stack); 222 if (!stack) {
223 // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back
224 // to old school enumeration of all X windows.
225 x11_util::EnumerateAllWindows(delegate);
226 return;
227 }
223 228
224 for (GList* iter = g_list_last(stack); iter; iter = iter->prev) { 229 for (GList* iter = g_list_last(stack); iter; iter = iter->prev) {
225 GdkWindow* window = static_cast<GdkWindow*>(iter->data); 230 GdkWindow* window = static_cast<GdkWindow*>(iter->data);
226 XID xid = GDK_WINDOW_XID(window); 231 XID xid = GDK_WINDOW_XID(window);
227 if (delegate->ShouldStopIterating(xid)) 232 if (delegate->ShouldStopIterating(xid))
228 break; 233 break;
229 } 234 }
230 235
231 g_list_foreach(stack, (GFunc)g_object_unref, NULL); 236 g_list_foreach(stack, (GFunc)g_object_unref, NULL);
232 g_list_free(stack); 237 g_list_free(stack);
233 } 238 }
234 239
235 void SetButtonTriggersNavigation(GtkWidget* button) { 240 void SetButtonTriggersNavigation(GtkWidget* button) {
236 // We handle button activation manually because we want to accept middle mouse 241 // We handle button activation manually because we want to accept middle mouse
237 // clicks. 242 // clicks.
238 g_signal_connect(G_OBJECT(button), "button-press-event", 243 g_signal_connect(G_OBJECT(button), "button-press-event",
239 G_CALLBACK(OnMouseButtonPressed), NULL); 244 G_CALLBACK(OnMouseButtonPressed), NULL);
240 g_signal_connect(G_OBJECT(button), "button-release-event", 245 g_signal_connect(G_OBJECT(button), "button-release-event",
241 G_CALLBACK(OnMouseButtonReleased), NULL); 246 G_CALLBACK(OnMouseButtonReleased), NULL);
242 } 247 }
243 248
244 } // namespace gtk_util 249 } // namespace gtk_util
OLDNEW
« no previous file with comments | « chrome/common/gtk_util.h ('k') | chrome/common/x11_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698