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

Unified Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.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: Adds menus to the lsit of top level windows returned by EnumerateTopLevelWindows (including other p… 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
Index: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
index e7101ac8ce1a95fe645e36e15d0b94875144cb88..6e171959e09047ffd8d0c6f8aabf4f78d139469f 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc
@@ -58,6 +58,7 @@ const char* kAtomsToCache[] = {
kXdndSelection,
"XdndStatus",
"XdndTypeList",
+ "_NET_WM_WINDOW_TYPE_MENU",
NULL
};
@@ -70,9 +71,11 @@ static base::LazyInstance<
class DragTargetWindowFinder : public ui::EnumerateWindowsDelegate {
public:
DragTargetWindowFinder(XID ignored_icon_window,
+ Atom menu_type_atom,
gfx::Point screen_loc)
: ignored_icon_window_(ignored_icon_window),
output_window_(None),
+ menu_type_atom_(menu_type_atom),
screen_loc_(screen_loc) {
ui::EnumerateTopLevelWindows(this);
}
@@ -92,7 +95,10 @@ class DragTargetWindowFinder : public ui::EnumerateWindowsDelegate {
if (!ui::WindowContainsPoint(window, screen_loc_))
return false;
- if (ui::PropertyExists(window, "WM_STATE")) {
+ int value = 0;
+ if (ui::PropertyExists(window, "WM_STATE") ||
+ (ui::GetIntProperty(window, "_NET_WM_WINDOW_TYPE", &value) &&
+ static_cast<Atom>(value) == menu_type_atom_)) {
output_window_ = window;
return true;
}
@@ -103,6 +109,7 @@ class DragTargetWindowFinder : public ui::EnumerateWindowsDelegate {
private:
XID ignored_icon_window_;
XID output_window_;
+ const Atom menu_type_atom_;
gfx::Point screen_loc_;
DISALLOW_COPY_AND_ASSIGN(DragTargetWindowFinder);
@@ -113,8 +120,9 @@ class DragTargetWindowFinder : public ui::EnumerateWindowsDelegate {
// |mouse_window|. If there's a Xdnd aware window, it will be returned in
// |dest_window|.
void FindWindowFor(const gfx::Point& screen_point,
- ::Window* mouse_window, ::Window* dest_window) {
- DragTargetWindowFinder finder(None, screen_point);
+ ::Window* mouse_window, ::Window* dest_window,
+ Atom menu_type_atom) {
+ DragTargetWindowFinder finder(None, menu_type_atom, screen_point);
*mouse_window = finder.window();
*dest_window = None;
@@ -666,7 +674,8 @@ void DesktopDragDropClientAuraX11::OnMouseMovement(XMotionEvent* event) {
// Find the current window the cursor is over.
::Window mouse_window = None;
::Window dest_window = None;
- FindWindowFor(screen_point, &mouse_window, &dest_window);
+ FindWindowFor(screen_point, &mouse_window, &dest_window,
+ atom_cache_.GetAtom("_NET_WM_WINDOW_TYPE_MENU"));
if (source_current_window_ != dest_window) {
if (source_current_window_ != None)

Powered by Google App Engine
This is Rietveld 408576698