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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 XSendEvent(xdisplay_, x_root_window_, False, | 85 XSendEvent(xdisplay_, x_root_window_, False, |
| 86 SubstructureRedirectMask | SubstructureNotifyMask, | 86 SubstructureRedirectMask | SubstructureNotifyMask, |
| 87 &xclient); | 87 &xclient); |
| 88 } else { | 88 } else { |
| 89 XRaiseWindow(xdisplay_, window); | 89 XRaiseWindow(xdisplay_, window); |
| 90 | 90 |
| 91 // XRaiseWindow will not give input focus to the window. We now need to ask | 91 // XRaiseWindow will not give input focus to the window. We now need to ask |
| 92 // the X server to do that. Note that the call will raise an X error if the | 92 // the X server to do that. Note that the call will raise an X error if the |
| 93 // window is not mapped. | 93 // window is not mapped. |
| 94 XSetInputFocus(xdisplay_, window, RevertToParent, CurrentTime); | 94 XSetInputFocus(xdisplay_, window, RevertToParent, CurrentTime); |
| 95 | |
| 96 OnActiveWindowChanged(window); | |
| 97 } | 95 } |
| 96 // Notify synchronously in order to maintain focus on a correct view when | |
| 97 // activation changes. | |
| 98 OnActiveWindowChanged(window); | |
|
varkha
2014/02/26 20:30:18
Without this when a tab that is dragged from one b
Elliot Glaysher
2014/02/26 20:33:17
Not that I know of. sadrul@ might be a better pers
| |
| 98 } | 99 } |
| 99 | 100 |
| 100 void X11DesktopHandler::DeactivateWindow(::Window window) { | 101 void X11DesktopHandler::DeactivateWindow(::Window window) { |
| 101 DCHECK(IsActiveWindow(window)); | 102 DCHECK(IsActiveWindow(window)); |
| 102 | 103 |
| 103 std::vector< ::Window > windows; | 104 std::vector< ::Window > windows; |
| 104 if (!ui::GetXWindowStack(x_root_window_, &windows)) { | 105 if (!ui::GetXWindowStack(x_root_window_, &windows)) { |
| 105 // TODO(mlamouri): use XQueryTree in case of _NET_CLIENT_LIST_STACKING is | 106 // TODO(mlamouri): use XQueryTree in case of _NET_CLIENT_LIST_STACKING is |
| 106 // not supported by the WM. | 107 // not supported by the WM. |
| 107 NOTIMPLEMENTED(); | 108 NOTIMPLEMENTED(); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 return *it; | 231 return *it; |
| 231 } | 232 } |
| 232 | 233 |
| 233 // If we reached that point, that means we have not found an appropriate | 234 // 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 | 235 // window to activate. There is nothing we can do about it and the caller |
| 235 // should take care of doing the right thing. | 236 // should take care of doing the right thing. |
| 236 return 0; | 237 return 0; |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace views | 240 } // namespace views |
| OLD | NEW |