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

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: Implements menu XID caching and dispatches mouse drags in a posted task (test) 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 f18f087dce335d474e95fb11a6bb297ebc699243..301d2c538d9a877aa78c8798a55e4a2046efdf96 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
};
@@ -74,9 +75,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);
}
@@ -96,7 +99,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;
}
@@ -107,6 +113,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);
@@ -117,8 +124,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;
@@ -428,6 +436,11 @@ DesktopDragDropClientAuraX11::DesktopDragDropClientAuraX11(
DesktopDragDropClientAuraX11::~DesktopDragDropClientAuraX11() {
g_live_client_map.Get().erase(xwindow_);
+ // Make sure that all observers are unregistered from source and target
+ // windows. This may be necessary when the parent native widget gets destroyed
+ // while a drag operation is in progress.
+ NotifyDragLeave();
+ target_current_context_.reset();
sadrul 2014/03/26 18:01:07 You shouldn't need to do this. target_current_cont
varkha 2014/03/27 04:48:13 Done.
}
// static
@@ -681,7 +694,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