| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
| 10 | 10 |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 } | 762 } |
| 763 | 763 |
| 764 return false; | 764 return false; |
| 765 } | 765 } |
| 766 | 766 |
| 767 bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, int max_depth) { | 767 bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, int max_depth) { |
| 768 XID root = GetX11RootWindow(); | 768 XID root = GetX11RootWindow(); |
| 769 return EnumerateChildren(delegate, root, max_depth, 0); | 769 return EnumerateChildren(delegate, root, max_depth, 0); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void EnumerateTopLevelWindows(ui::EnumerateWindowsDelegate* delegate) { |
| 773 std::vector<XID> stack; |
| 774 if (!ui::GetXWindowStack(ui::GetX11RootWindow(), &stack)) { |
| 775 // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back |
| 776 // to old school enumeration of all X windows. Some WMs parent 'top-level' |
| 777 // windows in unnamed actual top-level windows (ion WM), so extend the |
| 778 // search depth to all children of top-level windows. |
| 779 const int kMaxSearchDepth = 1; |
| 780 ui::EnumerateAllWindows(delegate, kMaxSearchDepth); |
| 781 return; |
| 782 } |
| 783 |
| 784 std::vector<XID>::iterator iter; |
| 785 for (iter = stack.begin(); iter != stack.end(); iter++) { |
| 786 if (delegate->ShouldStopIterating(*iter)) |
| 787 return; |
| 788 } |
| 789 } |
| 790 |
| 772 bool GetXWindowStack(Window window, std::vector<XID>* windows) { | 791 bool GetXWindowStack(Window window, std::vector<XID>* windows) { |
| 773 windows->clear(); | 792 windows->clear(); |
| 774 | 793 |
| 775 Atom type; | 794 Atom type; |
| 776 int format; | 795 int format; |
| 777 unsigned long count; | 796 unsigned long count; |
| 778 unsigned char *data = NULL; | 797 unsigned char *data = NULL; |
| 779 if (GetProperty(window, | 798 if (GetProperty(window, |
| 780 "_NET_CLIENT_LIST_STACKING", | 799 "_NET_CLIENT_LIST_STACKING", |
| 781 ~0L, | 800 ~0L, |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1259 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1278 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
| 1260 << "minor_code " << static_cast<int>(error_event.minor_code) | 1279 << "minor_code " << static_cast<int>(error_event.minor_code) |
| 1261 << " (" << request_str << ")"; | 1280 << " (" << request_str << ")"; |
| 1262 } | 1281 } |
| 1263 | 1282 |
| 1264 // ---------------------------------------------------------------------------- | 1283 // ---------------------------------------------------------------------------- |
| 1265 // End of x11_util_internal.h | 1284 // End of x11_util_internal.h |
| 1266 | 1285 |
| 1267 | 1286 |
| 1268 } // namespace ui | 1287 } // namespace ui |
| OLD | NEW |