| 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 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 | 849 |
| 850 g_current_capture = this; | 850 g_current_capture = this; |
| 851 x11_capture_.reset(new X11ScopedCapture(xwindow_)); | 851 x11_capture_.reset(new X11ScopedCapture(xwindow_)); |
| 852 } | 852 } |
| 853 | 853 |
| 854 void DesktopWindowTreeHostX11::ReleaseCapture() { | 854 void DesktopWindowTreeHostX11::ReleaseCapture() { |
| 855 if (g_current_capture == this) | 855 if (g_current_capture == this) |
| 856 g_current_capture->OnCaptureReleased(); | 856 g_current_capture->OnCaptureReleased(); |
| 857 } | 857 } |
| 858 | 858 |
| 859 bool DesktopWindowTreeHostX11::QueryMouseLocation( | |
| 860 gfx::Point* location_return) { | |
| 861 aura::client::CursorClient* cursor_client = | |
| 862 aura::client::GetCursorClient(window()); | |
| 863 if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { | |
| 864 *location_return = gfx::Point(0, 0); | |
| 865 return false; | |
| 866 } | |
| 867 | |
| 868 ::Window root_return, child_return; | |
| 869 int root_x_return, root_y_return, win_x_return, win_y_return; | |
| 870 unsigned int mask_return; | |
| 871 XQueryPointer(xdisplay_, | |
| 872 xwindow_, | |
| 873 &root_return, | |
| 874 &child_return, | |
| 875 &root_x_return, &root_y_return, | |
| 876 &win_x_return, &win_y_return, | |
| 877 &mask_return); | |
| 878 *location_return = gfx::Point( | |
| 879 std::max(0, std::min(bounds_.width(), win_x_return)), | |
| 880 std::max(0, std::min(bounds_.height(), win_y_return))); | |
| 881 return (win_x_return >= 0 && win_x_return < bounds_.width() && | |
| 882 win_y_return >= 0 && win_y_return < bounds_.height()); | |
| 883 } | |
| 884 | |
| 885 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { | 859 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { |
| 886 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); | 860 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); |
| 887 } | 861 } |
| 888 | 862 |
| 889 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { | 863 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { |
| 890 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, | 864 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, |
| 891 bounds_.x() + location.x(), bounds_.y() + location.y()); | 865 bounds_.x() + location.x(), bounds_.y() + location.y()); |
| 892 } | 866 } |
| 893 | 867 |
| 894 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { | 868 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 if (linux_ui) { | 1612 if (linux_ui) { |
| 1639 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); | 1613 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(window); |
| 1640 if (native_theme) | 1614 if (native_theme) |
| 1641 return native_theme; | 1615 return native_theme; |
| 1642 } | 1616 } |
| 1643 | 1617 |
| 1644 return ui::NativeTheme::instance(); | 1618 return ui::NativeTheme::instance(); |
| 1645 } | 1619 } |
| 1646 | 1620 |
| 1647 } // namespace views | 1621 } // namespace views |
| OLD | NEW |