Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 830990 | Differences between
and this patch

Collapse All | Expand All

(-)a/ui/platform_window/x11/x11_topmost_window_finder.cc (-15 / +7 lines)
Lines 42-60 bool EnumerateChildren(ShouldStopIteratingCallback should_stop_iterating, Link Here
42
  // reverse-iterate the list to check the windows from top-to-bottom.
42
  // reverse-iterate the list to check the windows from top-to-bottom.
43
  std::vector<x11::Window>::reverse_iterator iter;
43
  std::vector<x11::Window>::reverse_iterator iter;
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 (depth < max_depth) {
46
      return true;
46
      if (EnumerateChildren(should_stop_iterating, *iter, max_depth, depth + 1))
47
  }
48
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;
47
        return true;
57
    }
48
    }
49
    if (IsWindowNamed(*iter) && should_stop_iterating.Run(*iter))
50
      return true;
58
  }
51
  }
59
52
60
  return false;
53
  return false;
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
- 

Return to bug 830990