| 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/desktop_window_tree_host_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 10 #include <X11/Xregion.h> | 10 #include <X11/Xregion.h> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 case XINotifyPassiveUngrab: | 168 case XINotifyPassiveUngrab: |
| 169 return NotifyUngrab; | 169 return NotifyUngrab; |
| 170 case XINotifyWhileGrabbed: | 170 case XINotifyWhileGrabbed: |
| 171 return NotifyWhileGrabbed; | 171 return NotifyWhileGrabbed; |
| 172 default: | 172 default: |
| 173 NOTREACHED(); | 173 NOTREACHED(); |
| 174 return NotifyNormal; | 174 return NotifyNormal; |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 int IgnoreX11Errors(XDisplay* display, XErrorEvent* error) { |
| 179 return 0; |
| 180 } |
| 181 |
| 178 } // namespace | 182 } // namespace |
| 179 | 183 |
| 180 //////////////////////////////////////////////////////////////////////////////// | 184 //////////////////////////////////////////////////////////////////////////////// |
| 181 // DesktopWindowTreeHostX11, public: | 185 // DesktopWindowTreeHostX11, public: |
| 182 | 186 |
| 183 DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( | 187 DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( |
| 184 internal::NativeWidgetDelegate* native_widget_delegate, | 188 internal::NativeWidgetDelegate* native_widget_delegate, |
| 185 DesktopNativeWidgetAura* desktop_native_widget_aura) | 189 DesktopNativeWidgetAura* desktop_native_widget_aura) |
| 186 : xdisplay_(gfx::GetXDisplay()), | 190 : xdisplay_(gfx::GetXDisplay()), |
| 187 xwindow_(0), | 191 xwindow_(0), |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 // service our _NET_ACTIVE_WINDOW request. | 797 // service our _NET_ACTIVE_WINDOW request. |
| 794 xclient.xclient.data.l[2] = None; | 798 xclient.xclient.data.l[2] = None; |
| 795 xclient.xclient.data.l[3] = 0; | 799 xclient.xclient.data.l[3] = 0; |
| 796 xclient.xclient.data.l[4] = 0; | 800 xclient.xclient.data.l[4] = 0; |
| 797 | 801 |
| 798 XSendEvent(xdisplay_, x_root_window_, False, | 802 XSendEvent(xdisplay_, x_root_window_, False, |
| 799 SubstructureRedirectMask | SubstructureNotifyMask, &xclient); | 803 SubstructureRedirectMask | SubstructureNotifyMask, &xclient); |
| 800 } else { | 804 } else { |
| 801 XRaiseWindow(xdisplay_, xwindow_); | 805 XRaiseWindow(xdisplay_, xwindow_); |
| 802 // Directly ask the X server to give focus to the window. Note that the call | 806 // Directly ask the X server to give focus to the window. Note that the call |
| 803 // will raise an X error if the window is not mapped. | 807 // would have raised an X error if the window is not mapped. |
| 808 auto old_error_handler = XSetErrorHandler(IgnoreX11Errors); |
| 804 XSetInputFocus(xdisplay_, xwindow_, RevertToParent, timestamp); | 809 XSetInputFocus(xdisplay_, xwindow_, RevertToParent, timestamp); |
| 805 // At this point, we know we will receive focus, and some tests depend on a | 810 XSetErrorHandler(old_error_handler); |
| 806 // window being IsActive() immediately after an Activate(), so just set this | |
| 807 // state now. | |
| 808 has_pointer_focus_ = false; | |
| 809 has_window_focus_ = true; | |
| 810 } | 811 } |
| 811 AfterActivationStateChanged(); | 812 AfterActivationStateChanged(); |
| 812 } | 813 } |
| 813 | 814 |
| 814 void DesktopWindowTreeHostX11::Deactivate() { | 815 void DesktopWindowTreeHostX11::Deactivate() { |
| 815 BeforeActivationStateChanged(); | 816 BeforeActivationStateChanged(); |
| 816 | 817 |
| 817 // Ignore future input events. | 818 // Ignore future input events. |
| 818 ignore_keyboard_input_ = true; | 819 ignore_keyboard_input_ = true; |
| 819 | 820 |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2350 | 2351 |
| 2351 // static | 2352 // static |
| 2352 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 2353 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 2353 internal::NativeWidgetDelegate* native_widget_delegate, | 2354 internal::NativeWidgetDelegate* native_widget_delegate, |
| 2354 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 2355 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 2355 return new DesktopWindowTreeHostX11(native_widget_delegate, | 2356 return new DesktopWindowTreeHostX11(native_widget_delegate, |
| 2356 desktop_native_widget_aura); | 2357 desktop_native_widget_aura); |
| 2357 } | 2358 } |
| 2358 | 2359 |
| 2359 } // namespace views | 2360 } // namespace views |
| OLD | NEW |