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

Unified Diff: ui/views/widget/desktop_aura/x11_desktop_handler.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/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/x11_desktop_handler.cc
diff --git a/ui/views/widget/desktop_aura/x11_desktop_handler.cc b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
index 3aa874da6234a674f7da598cd6b0605dea1b0910..46aef1728fe522ff4a2fc898b01ceb8687a0c88f 100644
--- a/ui/views/widget/desktop_aura/x11_desktop_handler.cc
+++ b/ui/views/widget/desktop_aura/x11_desktop_handler.cc
@@ -10,7 +10,9 @@
#include "base/message_loop/message_loop.h"
#include "ui/aura/env.h"
#include "ui/aura/window_event_dispatcher.h"
+#include "ui/base/x/x11_menu_list.h"
#include "ui/base/x/x11_util.h"
+#include "ui/gfx/x/x11_error_tracker.h"
#if !defined(OS_CHROMEOS)
#include "ui/views/ime/input_method.h"
@@ -138,6 +140,26 @@ uint32_t X11DesktopHandler::Dispatch(const base::NativeEvent& event) {
}
break;
}
+ // Menus created by Chrome can be drag and drop targets. Since they are
+ // direct children of the screen root window and have override_redirect
+ // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them
+ // and use a separate cache to keep track of them.
+ // TODO(varkha): Implement caching of all top level X windows and their
+ // coordinates and stacking order to eliminate repeated calls to X server
+ // during mouse movement, drag and shaping events.
+ case CreateNotify: {
+ // The window might be destroyed if the message pump haven't gotten a
+ // chance to run but we can safely ignore the X error.
+ gfx::X11ErrorTracker error_tracker;
+ XCreateWindowEvent *xcwe = &event->xcreatewindow;
+ ui::XMenuList::GetInstance()->MaybeRegisterMenu(xcwe->window);
+ break;
+ }
+ case DestroyNotify: {
+ XDestroyWindowEvent *xdwe = &event->xdestroywindow;
+ ui::XMenuList::GetInstance()->MaybeUnregisterMenu(xdwe->window);
+ break;
+ }
}
return POST_DISPATCH_NONE;
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698