Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Side by Side Diff: ui/views/widget/desktop_aura/x11_desktop_handler.cc

Issue 144003015: Revert of Fixes _NET_ACTIVE_WINDOW support check in order to not always return no. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aura_deactivate
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 wm_supports_active_window_(false) { 48 wm_supports_active_window_(false) {
49 base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this); 49 base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this);
50 aura::Env::GetInstance()->AddObserver(this); 50 aura::Env::GetInstance()->AddObserver(this);
51 51
52 XWindowAttributes attr; 52 XWindowAttributes attr;
53 XGetWindowAttributes(xdisplay_, x_root_window_, &attr); 53 XGetWindowAttributes(xdisplay_, x_root_window_, &attr);
54 XSelectInput(xdisplay_, x_root_window_, 54 XSelectInput(xdisplay_, x_root_window_,
55 attr.your_event_mask | PropertyChangeMask | 55 attr.your_event_mask | PropertyChangeMask |
56 StructureNotifyMask | SubstructureNotifyMask); 56 StructureNotifyMask | SubstructureNotifyMask);
57 57
58 ::Window active_window; 58 std::vector<Atom> atoms;
59 wm_supports_active_window_ = 59 if (ui::GetAtomArrayProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &atoms)) {
60 ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &active_window) && 60 Atom active_window = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW");
61 active_window; 61 for (std::vector<Atom>::iterator iter = atoms.begin(); iter != atoms.end();
62 ++iter) {
63 if (*(iter) == active_window) {
64 wm_supports_active_window_ = true;
65 break;
66 }
67 }
68 }
62 } 69 }
63 70
64 X11DesktopHandler::~X11DesktopHandler() { 71 X11DesktopHandler::~X11DesktopHandler() {
65 aura::Env::GetInstance()->RemoveObserver(this); 72 aura::Env::GetInstance()->RemoveObserver(this);
66 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this); 73 base::MessagePumpX11::Current()->RemoveDispatcherForRootWindow(this);
67 } 74 }
68 75
69 void X11DesktopHandler::ActivateWindow(::Window window) { 76 void X11DesktopHandler::ActivateWindow(::Window window) {
70 if (wm_supports_active_window_) { 77 if (wm_supports_active_window_) {
71 DCHECK_EQ(gfx::GetXDisplay(), xdisplay_); 78 DCHECK_EQ(gfx::GetXDisplay(), xdisplay_);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 break; 129 break;
123 default: 130 default:
124 NOTREACHED(); 131 NOTREACHED();
125 } 132 }
126 } 133 }
127 134
128 bool X11DesktopHandler::Dispatch(const base::NativeEvent& event) { 135 bool X11DesktopHandler::Dispatch(const base::NativeEvent& event) {
129 // Check for a change to the active window. 136 // Check for a change to the active window.
130 switch (event->type) { 137 switch (event->type) {
131 case PropertyNotify: { 138 case PropertyNotify: {
132 ::Atom active_window_atom = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW"); 139 ::Atom active_window = atom_cache_.GetAtom("_NET_ACTIVE_WINDOW");
133 140
134 if (event->xproperty.window == x_root_window_ && 141 if (event->xproperty.window == x_root_window_ &&
135 event->xproperty.atom == active_window_atom) { 142 event->xproperty.atom == active_window) {
136 ::Window window; 143 int window;
137 if (ui::GetXIDProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) && 144 if (ui::GetIntProperty(x_root_window_, "_NET_ACTIVE_WINDOW", &window) &&
138 window) { 145 window) {
139 OnActiveWindowChanged(window); 146 OnActiveWindowChanged(static_cast< ::Window>(window));
140 } 147 }
141 } 148 }
142 break; 149 break;
143 } 150 }
144 } 151 }
145 152
146 return true; 153 return true;
147 } 154 }
148 155
149 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) { 156 void X11DesktopHandler::OnWindowInitialized(aura::Window* window) {
(...skipping 14 matching lines...) Expand all
164 171
165 DesktopWindowTreeHostX11* new_host = 172 DesktopWindowTreeHostX11* new_host =
166 views::DesktopWindowTreeHostX11::GetHostForXID(xid); 173 views::DesktopWindowTreeHostX11::GetHostForXID(xid);
167 if (new_host) 174 if (new_host)
168 new_host->HandleNativeWidgetActivationChanged(true); 175 new_host->HandleNativeWidgetActivationChanged(true);
169 176
170 current_window_ = xid; 177 current_window_ = xid;
171 } 178 }
172 179
173 } // namespace views 180 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698