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

Side by Side 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, 8 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h" 5 #include "ui/views/widget/desktop_aura/x11_desktop_handler.h"
6 6
7 #include <X11/Xatom.h> 7 #include <X11/Xatom.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "ui/aura/env.h" 11 #include "ui/aura/env.h"
12 #include "ui/aura/window_event_dispatcher.h" 12 #include "ui/aura/window_event_dispatcher.h"
13 #include "ui/base/x/x11_menu_list.h"
13 #include "ui/base/x/x11_util.h" 14 #include "ui/base/x/x11_util.h"
15 #include "ui/gfx/x/x11_error_tracker.h"
14 16
15 #if !defined(OS_CHROMEOS) 17 #if !defined(OS_CHROMEOS)
16 #include "ui/views/ime/input_method.h" 18 #include "ui/views/ime/input_method.h"
17 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" 19 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
18 #endif 20 #endif
19 21
20 namespace { 22 namespace {
21 23
22 const char* kAtomsToCache[] = { 24 const char* kAtomsToCache[] = {
23 "_NET_ACTIVE_WINDOW", 25 "_NET_ACTIVE_WINDOW",
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (event->xproperty.window == x_root_window_ && 133 if (event->xproperty.window == x_root_window_ &&
132 event->xproperty.atom == active_window_atom) { 134 event->xproperty.atom == active_window_atom) {
133 ::Window window; 135 ::Window window;
134 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && 136 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) &&
135 window) { 137 window) {
136 OnActiveWindowChanged(window); 138 OnActiveWindowChanged(window);
137 } 139 }
138 } 140 }
139 break; 141 break;
140 } 142 }
143 // Menus created by Chrome can be drag and drop targets. Since they are
144 // direct children of the screen root window and have override_redirect
145 // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them
146 // and use a separate cache to keep track of them.
147 // TODO(varkha): Implement caching of all top level X windows and their
148 // coordinates and stacking order to eliminate repeated calls to X server
149 // during mouse movement, drag and shaping events.
150 case CreateNotify: {
151 // The window might be destroyed if the message pump haven't gotten a
152 // chance to run but we can safely ignore the X error.
153 gfx::X11ErrorTracker error_tracker;
154 XCreateWindowEvent *xcwe = &event->xcreatewindow;
155 ui::XMenuList::GetInstance()->MaybeRegisterMenu(xcwe->window);
156 break;
157 }
158 case DestroyNotify: {
159 XDestroyWindowEvent *xdwe = &event->xdestroywindow;
160 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(xdwe->window);
161 break;
162 }
141 } 163 }
142 164
143 return POST_DISPATCH_NONE; 165 return POST_DISPATCH_NONE;
144 } 166 }
145 167
146 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) { 168 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) {
147 } 169 }
148 170
149 void X11DesktopHandler::OnWillDestroyEnv() { 171 void X11DesktopHandler::OnWillDestroyEnv() {
150 g_handler = NULL; 172 g_handler = NULL;
(...skipping 10 matching lines...) Expand all
161 183
162 DesktopWindowTreeHostX11* new_host = 184 DesktopWindowTreeHostX11* new_host =
163 views::DesktopWindowTreeHostX11::GetHostForXID(xid); 185 views::DesktopWindowTreeHostX11::GetHostForXID(xid);
164 if (new_host) 186 if (new_host)
165 new_host->HandleNativeWidgetActivationChanged(true); 187 new_host->HandleNativeWidgetActivationChanged(true);
166 188
167 current_window_ = xid; 189 current_window_ = xid;
168 } 190 }
169 191
170 } // namespace views 192 } // namespace views
OLDNEW
« 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