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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 if (event->xproperty.window == x_root_window_ && | 131 if (event->xproperty.window == x_root_window_ && |
132 event->xproperty.atom == active_window_atom) { | 132 event->xproperty.atom == active_window_atom) { |
133 ::Window window; | 133 ::Window window; |
134 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && | 134 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && |
135 window) { | 135 window) { |
136 OnActiveWindowChanged(window); | 136 OnActiveWindowChanged(window); |
137 } | 137 } |
138 } | 138 } |
139 break; | 139 break; |
140 } | 140 } |
141 // Menus created by Chrome can be drag and drop targets. Since they are | |
142 // direct children of the screen root window and have override_redirect | |
143 // we cannot use regular _NET_CLIENT_LIST_STACKING property to find them | |
144 // and use a separate cache to keep track of them. | |
145 // TODO(varkha): Implement caching of all top level X windows and their | |
146 // coordinates and stacking order to eliminate repeated calls to X server | |
147 // during mouse movement and drag events. | |
Elliot Glaysher
2014/03/25 20:11:07
...and shaping.
varkha
2014/03/26 00:15:53
Done.
| |
148 case CreateNotify: { | |
149 XCreateWindowEvent *xcwe = &event->xcreatewindow; | |
150 ui::XMenuList::GetInstance()->MaybeRegisterMenu(xcwe->window); | |
151 break; | |
152 } | |
153 case DestroyNotify: { | |
154 XDestroyWindowEvent *xdwe = &event->xdestroywindow; | |
155 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(xdwe->window); | |
156 break; | |
157 } | |
141 } | 158 } |
142 | 159 |
143 return POST_DISPATCH_NONE; | 160 return POST_DISPATCH_NONE; |
144 } | 161 } |
145 | 162 |
146 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) { | 163 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) { |
147 } | 164 } |
148 | 165 |
149 void X11DesktopHandler::OnWillDestroyEnv() { | 166 void X11DesktopHandler::OnWillDestroyEnv() { |
150 g_handler = NULL; | 167 g_handler = NULL; |
(...skipping 10 matching lines...) Expand all Loading... | |
161 | 178 |
162 DesktopWindowTreeHostX11* new_host = | 179 DesktopWindowTreeHostX11* new_host = |
163 views::DesktopWindowTreeHostX11::GetHostForXID(xid); | 180 views::DesktopWindowTreeHostX11::GetHostForXID(xid); |
164 if (new_host) | 181 if (new_host) |
165 new_host->HandleNativeWidgetActivationChanged(true); | 182 new_host->HandleNativeWidgetActivationChanged(true); |
166 | 183 |
167 current_window_ = xid; | 184 current_window_ = xid; |
168 } | 185 } |
169 | 186 |
170 } // namespace views | 187 } // namespace views |
OLD | NEW |