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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 } | 179 } |
| 180 | 180 |
| 181 void X11DesktopHandler::OnActiveWindowChanged(::Window xid) { | 181 void X11DesktopHandler::OnActiveWindowChanged(::Window xid) { |
| 182 if (current_window_ == xid) | 182 if (current_window_ == xid) |
| 183 return; | 183 return; |
| 184 DesktopWindowTreeHostX11* old_host = | 184 DesktopWindowTreeHostX11* old_host = |
| 185 views::DesktopWindowTreeHostX11::GetHostForXID(current_window_); | 185 views::DesktopWindowTreeHostX11::GetHostForXID(current_window_); |
| 186 if (old_host) | 186 if (old_host) |
| 187 old_host->HandleNativeWidgetActivationChanged(false); | 187 old_host->HandleNativeWidgetActivationChanged(false); |
| 188 | 188 |
| 189 current_window_ = xid; | |
|
msw
2014/03/11 00:58:50
q: Why must the order of operations be changed her
Yuki
2014/03/11 15:27:37
I've added a comment. The active widget must be c
msw
2014/03/11 23:24:37
Okay, this may have weird implications for code ch
Yuki
2014/03/12 09:13:15
Will address any issues that would arise.
FocusMa
| |
| 190 | |
| 189 DesktopWindowTreeHostX11* new_host = | 191 DesktopWindowTreeHostX11* new_host = |
| 190 views::DesktopWindowTreeHostX11::GetHostForXID(xid); | 192 views::DesktopWindowTreeHostX11::GetHostForXID(xid); |
| 191 if (new_host) | 193 if (new_host) |
| 192 new_host->HandleNativeWidgetActivationChanged(true); | 194 new_host->HandleNativeWidgetActivationChanged(true); |
| 193 | |
| 194 current_window_ = xid; | |
| 195 } | 195 } |
| 196 | 196 |
| 197 ::Window X11DesktopHandler::GetNextToActivateInStack( | 197 ::Window X11DesktopHandler::GetNextToActivateInStack( |
| 198 const std::vector< ::Window >& windows) { | 198 const std::vector< ::Window >& windows) { |
| 199 DCHECK(current_window_); | 199 DCHECK(current_window_); |
| 200 | 200 |
| 201 // We start by doing a fast forward in the stack to find the active window. | 201 // We start by doing a fast forward in the stack to find the active window. |
| 202 std::vector< ::Window >::const_iterator it = | 202 std::vector< ::Window >::const_iterator it = |
| 203 std::find(windows.begin(), windows.end(), current_window_); | 203 std::find(windows.begin(), windows.end(), current_window_); |
| 204 | 204 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 230 return *it; | 230 return *it; |
| 231 } | 231 } |
| 232 | 232 |
| 233 // If we reached that point, that means we have not found an appropriate | 233 // If we reached that point, that means we have not found an appropriate |
| 234 // window to activate. There is nothing we can do about it and the caller | 234 // window to activate. There is nothing we can do about it and the caller |
| 235 // should take care of doing the right thing. | 235 // should take care of doing the right thing. |
| 236 return 0; | 236 return 0; |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace views | 239 } // namespace views |
| OLD | NEW |