| 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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { | 981 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { |
| 982 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, | 982 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, |
| 983 bounds_.x() + location.x(), bounds_.y() + location.y()); | 983 bounds_.x() + location.x(), bounds_.y() + location.y()); |
| 984 } | 984 } |
| 985 | 985 |
| 986 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { | 986 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { |
| 987 // TODO(erg): Conditional on us enabling touch on desktop linux builds, do | 987 // TODO(erg): Conditional on us enabling touch on desktop linux builds, do |
| 988 // the same tap-to-click disabling here that chromeos does. | 988 // the same tap-to-click disabling here that chromeos does. |
| 989 } | 989 } |
| 990 | 990 |
| 991 void DesktopWindowTreeHostX11::PostNativeEvent( | |
| 992 const base::NativeEvent& native_event) { | |
| 993 DCHECK(xwindow_); | |
| 994 DCHECK(xdisplay_); | |
| 995 XEvent xevent = *native_event; | |
| 996 xevent.xany.display = xdisplay_; | |
| 997 xevent.xany.window = xwindow_; | |
| 998 | |
| 999 switch (xevent.type) { | |
| 1000 case EnterNotify: | |
| 1001 case LeaveNotify: | |
| 1002 case MotionNotify: | |
| 1003 case KeyPress: | |
| 1004 case KeyRelease: | |
| 1005 case ButtonPress: | |
| 1006 case ButtonRelease: { | |
| 1007 // The fields used below are in the same place for all of events | |
| 1008 // above. Using xmotion from XEvent's unions to avoid repeating | |
| 1009 // the code. | |
| 1010 xevent.xmotion.root = x_root_window_; | |
| 1011 xevent.xmotion.time = CurrentTime; | |
| 1012 | |
| 1013 gfx::Point point(xevent.xmotion.x, xevent.xmotion.y); | |
| 1014 ConvertPointToNativeScreen(&point); | |
| 1015 xevent.xmotion.x_root = point.x(); | |
| 1016 xevent.xmotion.y_root = point.y(); | |
| 1017 } | |
| 1018 default: | |
| 1019 break; | |
| 1020 } | |
| 1021 XSendEvent(xdisplay_, xwindow_, False, 0, &xevent); | |
| 1022 } | |
| 1023 | |
| 1024 //////////////////////////////////////////////////////////////////////////////// | 991 //////////////////////////////////////////////////////////////////////////////// |
| 1025 // DesktopWindowTreeHostX11, ui::EventSource implementation: | 992 // DesktopWindowTreeHostX11, ui::EventSource implementation: |
| 1026 | 993 |
| 1027 ui::EventProcessor* DesktopWindowTreeHostX11::GetEventProcessor() { | 994 ui::EventProcessor* DesktopWindowTreeHostX11::GetEventProcessor() { |
| 1028 return dispatcher(); | 995 return dispatcher(); |
| 1029 } | 996 } |
| 1030 | 997 |
| 1031 //////////////////////////////////////////////////////////////////////////////// | 998 //////////////////////////////////////////////////////////////////////////////// |
| 1032 // DesktopWindowTreeHostX11, private: | 999 // DesktopWindowTreeHostX11, private: |
| 1033 | 1000 |
| (...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 if (linux_ui) { | 1927 if (linux_ui) { |
| 1961 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1928 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 1962 if (native_theme) | 1929 if (native_theme) |
| 1963 return native_theme; | 1930 return native_theme; |
| 1964 } | 1931 } |
| 1965 | 1932 |
| 1966 return ui::NativeTheme::instance(); | 1933 return ui::NativeTheme::instance(); |
| 1967 } | 1934 } |
| 1968 | 1935 |
| 1969 } // namespace views | 1936 } // namespace views |
| OLD | NEW |