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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 if (ui::PlatformEventSource::GetInstance()) | 51 if (ui::PlatformEventSource::GetInstance()) |
52 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 52 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
53 aura::Env::GetInstance()->AddObserver(this); | 53 aura::Env::GetInstance()->AddObserver(this); |
54 | 54 |
55 XWindowAttributes attr; | 55 XWindowAttributes attr; |
56 XGetWindowAttributes(xdisplay_, x_root_window_, &attr); | 56 XGetWindowAttributes(xdisplay_, x_root_window_, &attr); |
57 XSelectInput(xdisplay_, x_root_window_, | 57 XSelectInput(xdisplay_, x_root_window_, |
58 attr.your_event_mask | PropertyChangeMask | | 58 attr.your_event_mask | PropertyChangeMask | |
59 StructureNotifyMask | SubstructureNotifyMask); | 59 StructureNotifyMask | SubstructureNotifyMask); |
60 | 60 |
61 ::Window active_window; | |
62 wm_supports_active_window_ = | 61 wm_supports_active_window_ = |
63 ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &active_window) && | 62 ui::WmSupportsHint(atom_cache_.GetAtom("_NET_ACTIVE_WINDOW")); |
64 active_window; | |
65 } | 63 } |
66 | 64 |
67 X11DesktopHandler::~X11DesktopHandler() { | 65 X11DesktopHandler::~X11DesktopHandler() { |
68 aura::Env::GetInstance()->RemoveObserver(this); | 66 aura::Env::GetInstance()->RemoveObserver(this); |
69 if (ui::PlatformEventSource::GetInstance()) | 67 if (ui::PlatformEventSource::GetInstance()) |
70 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 68 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
71 } | 69 } |
72 | 70 |
73 void X11DesktopHandler::ActivateWindow(::Window window) { | 71 void X11DesktopHandler::ActivateWindow(::Window window) { |
74 if (current_window_ == window && | 72 if (current_window_ == window && |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); | 231 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); |
234 } | 232 } |
235 | 233 |
236 if (event_type == DestroyNotify) { | 234 if (event_type == DestroyNotify) { |
237 // Notify the XForeignWindowManager that |window| has been destroyed. | 235 // Notify the XForeignWindowManager that |window| has been destroyed. |
238 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); | 236 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); |
239 } | 237 } |
240 } | 238 } |
241 | 239 |
242 } // namespace views | 240 } // namespace views |
OLD | NEW |