| Index: ui/base/x/x11_util.cc
|
| diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
|
| index d0d0188bd8c1359de6585577b92e112a154b57fe..b058b2fe340b77e1e877279f21fc8c2077f4f360 100644
|
| --- a/ui/base/x/x11_util.cc
|
| +++ b/ui/base/x/x11_util.cc
|
| @@ -769,6 +769,25 @@ bool EnumerateAllWindows(EnumerateWindowsDelegate* delegate, int max_depth) {
|
| return EnumerateChildren(delegate, root, max_depth, 0);
|
| }
|
|
|
| +void EnumerateTopLevelWindows(ui::EnumerateWindowsDelegate* delegate) {
|
| + std::vector<XID> stack;
|
| + if (!ui::GetXWindowStack(ui::GetX11RootWindow(), &stack)) {
|
| + // Window Manager doesn't support _NET_CLIENT_LIST_STACKING, so fall back
|
| + // to old school enumeration of all X windows. Some WMs parent 'top-level'
|
| + // windows in unnamed actual top-level windows (ion WM), so extend the
|
| + // search depth to all children of top-level windows.
|
| + const int kMaxSearchDepth = 1;
|
| + ui::EnumerateAllWindows(delegate, kMaxSearchDepth);
|
| + return;
|
| + }
|
| +
|
| + std::vector<XID>::iterator iter;
|
| + for (iter = stack.begin(); iter != stack.end(); iter++) {
|
| + if (delegate->ShouldStopIterating(*iter))
|
| + return;
|
| + }
|
| +}
|
| +
|
| bool GetXWindowStack(Window window, std::vector<XID>* windows) {
|
| windows->clear();
|
|
|
|
|