Chromium Code Reviews| 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 // Some window managers (e.g. wmii) say they support _NET_ACTIVE_WINDOW but | |
| 62 // do not. See http://crbug.com/417767 | |
| 63 XID active_window; | |
| 61 wm_supports_active_window_ = | 64 wm_supports_active_window_ = |
| 62 ui::WmSupportsHint(atom_cache_.GetAtom("_NET_ACTIVE_WINDOW")); | 65 ui::WmSupportsHint(atom_cache_.GetAtom("_NET_ACTIVE_WINDOW")) && |
| 66 ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &active_window); | |
|
sadrul
2014/09/25 20:41:48
What if chrome is the first app the user launches?
| |
| 63 } | 67 } |
| 64 | 68 |
| 65 X11DesktopHandler::~X11DesktopHandler() { | 69 X11DesktopHandler::~X11DesktopHandler() { |
| 66 aura::Env::GetInstance()->RemoveObserver(this); | 70 aura::Env::GetInstance()->RemoveObserver(this); |
| 67 if (ui::PlatformEventSource::GetInstance()) | 71 if (ui::PlatformEventSource::GetInstance()) |
| 68 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 72 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
| 69 } | 73 } |
| 70 | 74 |
| 71 void X11DesktopHandler::ActivateWindow(::Window window) { | 75 void X11DesktopHandler::ActivateWindow(::Window window) { |
| 72 if (current_window_ == window && | 76 if (current_window_ == window && |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); | 235 ui::XMenuList::GetInstance()->MaybeUnregisterMenu(window); |
| 232 } | 236 } |
| 233 | 237 |
| 234 if (event_type == DestroyNotify) { | 238 if (event_type == DestroyNotify) { |
| 235 // Notify the XForeignWindowManager that |window| has been destroyed. | 239 // Notify the XForeignWindowManager that |window| has been destroyed. |
| 236 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); | 240 ui::XForeignWindowManager::GetInstance()->OnWindowDestroyed(window); |
| 237 } | 241 } |
| 238 } | 242 } |
| 239 | 243 |
| 240 } // namespace views | 244 } // namespace views |
| OLD | NEW |