|
Lines 44-58
bool EnumerateChildren(ShouldStopIteratingCallback should_stop_iterating,
Link Here
|
| 44 |
for (iter = windows.rbegin(); iter != windows.rend(); iter++) { |
44 |
for (iter = windows.rbegin(); iter != windows.rend(); iter++) { |
| 45 |
if (IsWindowNamed(*iter) && should_stop_iterating.Run(*iter)) |
45 |
if (IsWindowNamed(*iter) && should_stop_iterating.Run(*iter)) |
| 46 |
return true; |
46 |
return true; |
| 47 |
} |
47 |
if (depth < max_depth) { |
| 48 |
|
48 |
if (EnumerateChildren(should_stop_iterating, *iter, max_depth, depth + 1)) |
| 49 |
// If we're at this point, we didn't find the window we're looking for at the |
|
|
| 50 |
// current level, so we need to recurse to the next level. We use a second |
| 51 |
// loop because the recursion and call to XQueryTree are expensive and is only |
| 52 |
// needed for a small number of cases. |
| 53 |
if (++depth <= max_depth) { |
| 54 |
for (iter = windows.rbegin(); iter != windows.rend(); iter++) { |
| 55 |
if (EnumerateChildren(should_stop_iterating, *iter, max_depth, depth)) |
| 56 |
return true; |
49 |
return true; |
| 57 |
} |
50 |
} |
| 58 |
} |
51 |
} |
|
Lines 68-76
bool EnumerateAllWindows(ShouldStopIteratingCallback should_stop_iterating,
Link Here
|
| 68 |
|
61 |
|
| 69 |
void EnumerateTopLevelWindows( |
62 |
void EnumerateTopLevelWindows( |
| 70 |
ui::ShouldStopIteratingCallback should_stop_iterating) { |
63 |
ui::ShouldStopIteratingCallback should_stop_iterating) { |
| 71 |
// Some WMs parent 'top-level' windows in unnamed actual top-level windows |
64 |
// WMs may reparent toplevel windows inside their own containers, so extend |
| 72 |
// (ion WM), so extend the search depth to all children of top-level windows. |
65 |
// the search to all grandchildren of all toplevel windows. |
| 73 |
const int kMaxSearchDepth = 1; |
66 |
const int kMaxSearchDepth = 2; |
| 74 |
ui::EnumerateAllWindows(should_stop_iterating, kMaxSearchDepth); |
67 |
ui::EnumerateAllWindows(should_stop_iterating, kMaxSearchDepth); |
| 75 |
} |
68 |
} |
| 76 |
|
69 |
|
| 77 |
- |
|
|