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

Side by Side Diff: chrome/common/x11_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/x11_util.h ('k') | no next file » | 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 // This file defines utility functions for X11 (Linux only). This code has been 5 // This file defines utility functions for X11 (Linux only). This code has been
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support
7 // remains woefully incomplete. 7 // remains woefully incomplete.
8 8
9 #include "chrome/common/x11_util.h" 9 #include "chrome/common/x11_util.h"
10 10
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return false; 154 return false;
155 155
156 if (!XTranslateCoordinates(GetSecondaryDisplay(), window, root, 156 if (!XTranslateCoordinates(GetSecondaryDisplay(), window, root,
157 0, 0, &x, &y, &child)) 157 0, 0, &x, &y, &child))
158 return false; 158 return false;
159 159
160 *rect = gfx::Rect(x, y, width, height); 160 *rect = gfx::Rect(x, y, width, height);
161 return true; 161 return true;
162 } 162 }
163 163
164 bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate) {
165 XID root = GetX11RootWindow();
166 XID parent;
167 XID* children;
168 unsigned int num_children;
169 int status = XQueryTree(GetXDisplay(), root, &root, &parent,
170 &children, &num_children);
171 if (status == 0)
172 return false;
173
174 for (unsigned int i = 0; i < num_children; i++) {
175 if (delegate->ShouldStopIterating(children[i]))
176 break;
177 }
178
179 XFree(children);
180 return true;
181 }
182
164 XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual) { 183 XRenderPictFormat* GetRenderVisualFormat(Display* dpy, Visual* visual) {
165 static XRenderPictFormat* pictformat = NULL; 184 static XRenderPictFormat* pictformat = NULL;
166 if (pictformat) 185 if (pictformat)
167 return pictformat; 186 return pictformat;
168 187
169 DCHECK(QueryRenderSupport(dpy)); 188 DCHECK(QueryRenderSupport(dpy));
170 189
171 pictformat = XRenderFindVisualFormat(dpy, visual); 190 pictformat = XRenderFindVisualFormat(dpy, visual);
172 CHECK(pictformat) << "XRENDER does not support default visual"; 191 CHECK(pictformat) << "XRENDER does not support default visual";
173 192
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return false; 311 return false;
293 312
294 if (children) 313 if (children)
295 XFree(children); 314 XFree(children);
296 315
297 *parent_is_root = root_window == *parent_window; 316 *parent_is_root = root_window == *parent_window;
298 return true; 317 return true;
299 } 318 }
300 319
301 } // namespace x11_util 320 } // namespace x11_util
OLDNEW
« no previous file with comments | « chrome/common/x11_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698