Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(952)

Unified Diff: ui/base/x/x11_util.cc

Issue 196213004: Allows menu host windows to be enumerated in DragTargetWindowFinder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allows menu host windows to be enumerated in DragTargetWindowFinder (fixing broken tests) Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/x/x11_menu_list.cc ('k') | ui/views/corewm/desktop_capture_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/x/x11_util.cc
diff --git a/ui/base/x/x11_util.cc b/ui/base/x/x11_util.cc
index 3ba6ce77b1fc273598a39d52a554ff51e7e9314f..708f962634f47afe04eea19883b5ad341a3a4d3f 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"
@@ -1083,6 +1084,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,
@@ -1090,7 +1103,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]);
@@ -1098,7 +1110,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;
@@ -1134,6 +1145,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++) {
« no previous file with comments | « ui/base/x/x11_menu_list.cc ('k') | ui/views/corewm/desktop_capture_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698