Index: ui/base/x/x11_util.cc |
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc |
index 007157c821d4316345a90bd458bcd1bd06db226b..91b8600aaa04e26898e78414b4f66d9bf6c35e2f 100644 |
--- a/ui/base/x/x11_util.cc |
+++ b/ui/base/x/x11_util.cc |
@@ -35,6 +35,7 @@ |
#include "base/threading/thread.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
#include "third_party/skia/include/core/SkPostConfig.h" |
+#include "ui/base/x/x11_menu_list.h" |
#include "ui/base/x/x11_util_internal.h" |
#include "ui/events/event_utils.h" |
#include "ui/events/keycodes/keyboard_code_conversion_x.h" |
@@ -1067,6 +1068,18 @@ bool EnumerateChildren(EnumerateWindowsDelegate* delegate, XID window, |
if (depth > max_depth) |
return false; |
+ std::vector<XID> windows; |
+ std::vector<XID>::iterator iter; |
+ if (depth == 0) { |
+ XMenuList::GetInstance()->InsertMenuWindowXIDs(&windows); |
+ // Enumerate the menus first. |
+ for (iter = windows.begin(); iter != windows.end(); iter++) { |
+ if (delegate->ShouldStopIterating(*iter)) |
+ return true; |
+ } |
+ windows.clear(); |
+ } |
+ |
XID root, parent, *children; |
unsigned int num_children; |
int status = XQueryTree(gfx::GetXDisplay(), window, &root, &parent, &children, |
@@ -1074,7 +1087,6 @@ bool EnumerateChildren(EnumerateWindowsDelegate* delegate, XID window, |
if (status == 0) |
return false; |
- std::vector<XID> windows; |
for (int i = static_cast<int>(num_children) - 1; i >= 0; i--) |
windows.push_back(children[i]); |
@@ -1082,7 +1094,6 @@ bool EnumerateChildren(EnumerateWindowsDelegate* delegate, XID window, |
// XQueryTree returns the children of |window| in bottom-to-top order, so |
// reverse-iterate the list to check the windows from top-to-bottom. |
- std::vector<XID>::iterator iter; |
for (iter = windows.begin(); iter != windows.end(); iter++) { |
if (IsWindowNamed(*iter) && delegate->ShouldStopIterating(*iter)) |
return true; |
@@ -1118,6 +1129,7 @@ void EnumerateTopLevelWindows(ui::EnumerateWindowsDelegate* delegate) { |
ui::EnumerateAllWindows(delegate, kMaxSearchDepth); |
return; |
} |
+ XMenuList::GetInstance()->InsertMenuWindowXIDs(&stack); |
std::vector<XID>::iterator iter; |
for (iter = stack.begin(); iter != stack.end(); iter++) { |