OLD | NEW |
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" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 if (event->xproperty.window == x_root_window_ && | 158 if (event->xproperty.window == x_root_window_ && |
159 event->xproperty.atom == active_window_atom) { | 159 event->xproperty.atom == active_window_atom) { |
160 ::Window window; | 160 ::Window window; |
161 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && | 161 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && |
162 window) { | 162 window) { |
163 OnActiveWindowChanged(window); | 163 OnActiveWindowChanged(window); |
164 } | 164 } |
165 } | 165 } |
166 break; | 166 break; |
167 } | 167 } |
| 168 // Menus created by Chrome can be Drag and Drop targets. Since they are |
| 169 // direct children of the screen root window and have override_redirect |
| 170 // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them |
| 171 // and therefore use a separate cache to keep track of them. |
| 172 case CreateNotify: { |
| 173 XCreateWindowEvent *xcwe = &event->xcreatewindow; |
| 174 ui::XMenuList::GetInstance()->MaybeRegisterMenu(xcwe->window); |
| 175 break; |
| 176 } |
| 177 case DestroyNotify: { |
| 178 XDestroyWindowEvent *xdwe = &event->xdestroywindow; |
| 179 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(xdwe->window); |
| 180 break; |
| 181 } |
168 } | 182 } |
169 | 183 |
170 return POST_DISPATCH_NONE; | 184 return POST_DISPATCH_NONE; |
171 } | 185 } |
172 | 186 |
173 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) { | 187 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) { |
174 } | 188 } |
175 | 189 |
176 void X11DesktopHandler::OnWillDestroyEnv() { | 190 void X11DesktopHandler::OnWillDestroyEnv() { |
177 g_handler = NULL; | 191 g_handler = NULL; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 return *it; | 244 return *it; |
231 } | 245 } |
232 | 246 |
233 // If we reached that point, that means we have not found an appropriate | 247 // If we reached that point, that means we have not found an appropriate |
234 // window to activate. There is nothing we can do about it and the caller | 248 // window to activate. There is nothing we can do about it and the caller |
235 // should take care of doing the right thing. | 249 // should take care of doing the right thing. |
236 return 0; | 250 return 0; |
237 } | 251 } |
238 | 252 |
239 } // namespace views | 253 } // namespace views |
OLD | NEW |