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