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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 xclient.xclient.data.l[1] = CurrentTime; | 87 xclient.xclient.data.l[1] = CurrentTime; |
88 xclient.xclient.data.l[2] = None; | 88 xclient.xclient.data.l[2] = None; |
89 xclient.xclient.data.l[3] = 0; | 89 xclient.xclient.data.l[3] = 0; |
90 xclient.xclient.data.l[4] = 0; | 90 xclient.xclient.data.l[4] = 0; |
91 | 91 |
92 XSendEvent(xdisplay_, x_root_window_, False, | 92 XSendEvent(xdisplay_, x_root_window_, False, |
93 SubstructureRedirectMask | SubstructureNotifyMask, | 93 SubstructureRedirectMask | SubstructureNotifyMask, |
94 &xclient); | 94 &xclient); |
95 } else { | 95 } else { |
96 XRaiseWindow(xdisplay_, window); | 96 XRaiseWindow(xdisplay_, window); |
97 | |
98 // XRaiseWindow will not give input focus to the window. We now need to ask | |
99 // the X server to do that. However, if the window is not viewable this will | |
100 // produce an error so we have to check that before making the call. | |
101 XWindowAttributes attributes; | |
102 XGetWindowAttributes(xdisplay_, window, &attributes); | |
103 if (attributes.map_state == IsViewable) | |
sadrul
2014/01/15 19:23:50
Is this only ever called from DesktopWindowTreeHos
mlamouri (slow - plz ping)
2014/01/15 23:15:18
The assertion goes away but the test fail with tha
sadrul
2014/01/15 23:18:53
Shouldn't we return early from DesktopWindowTreeHo
mlamouri (slow - plz ping)
2014/01/15 23:27:50
I think that would be reasonable but it would brea
sadrul
2014/01/15 23:31:35
The test can be fixed by making sure the widgets c
| |
104 XSetInputFocus(xdisplay_, window, RevertToParent, CurrentTime); | |
105 | |
97 OnActiveWindowChanged(window); | 106 OnActiveWindowChanged(window); |
98 } | 107 } |
99 } | 108 } |
100 | 109 |
101 bool X11DesktopHandler::IsActiveWindow(::Window window) const { | 110 bool X11DesktopHandler::IsActiveWindow(::Window window) const { |
102 return window == current_window_; | 111 return window == current_window_; |
103 } | 112 } |
104 | 113 |
105 void X11DesktopHandler::ProcessXEvent(const base::NativeEvent& event) { | 114 void X11DesktopHandler::ProcessXEvent(const base::NativeEvent& event) { |
106 switch (event->type) { | 115 switch (event->type) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 | 167 |
159 DesktopWindowTreeHostX11* new_host = | 168 DesktopWindowTreeHostX11* new_host = |
160 views::DesktopWindowTreeHostX11::GetHostForXID(xid); | 169 views::DesktopWindowTreeHostX11::GetHostForXID(xid); |
161 if (new_host) | 170 if (new_host) |
162 new_host->HandleNativeWidgetActivationChanged(true); | 171 new_host->HandleNativeWidgetActivationChanged(true); |
163 | 172 |
164 current_window_ = xid; | 173 current_window_ = xid; |
165 } | 174 } |
166 | 175 |
167 } // namespace views | 176 } // namespace views |
OLD | NEW |