| 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 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 ShowWindowWithState(ui::SHOW_STATE_NORMAL); | 750 ShowWindowWithState(ui::SHOW_STATE_NORMAL); |
| 751 } | 751 } |
| 752 | 752 |
| 753 void DesktopWindowTreeHostX11::Hide() { | 753 void DesktopWindowTreeHostX11::Hide() { |
| 754 if (window_mapped_) { | 754 if (window_mapped_) { |
| 755 XWithdrawWindow(xdisplay_, xwindow_, 0); | 755 XWithdrawWindow(xdisplay_, xwindow_, 0); |
| 756 window_mapped_ = false; | 756 window_mapped_ = false; |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 | 759 |
| 760 void DesktopWindowTreeHostX11::ToggleFullScreen() { | |
| 761 NOTIMPLEMENTED(); | |
| 762 } | |
| 763 | |
| 764 gfx::Rect DesktopWindowTreeHostX11::GetBounds() const { | 760 gfx::Rect DesktopWindowTreeHostX11::GetBounds() const { |
| 765 return bounds_; | 761 return bounds_; |
| 766 } | 762 } |
| 767 | 763 |
| 768 void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { | 764 void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { |
| 769 bool origin_changed = bounds_.origin() != bounds.origin(); | 765 bool origin_changed = bounds_.origin() != bounds.origin(); |
| 770 bool size_changed = bounds_.size() != bounds.size(); | 766 bool size_changed = bounds_.size() != bounds.size(); |
| 771 XWindowChanges changes = {0}; | 767 XWindowChanges changes = {0}; |
| 772 unsigned value_mask = 0; | 768 unsigned value_mask = 0; |
| 773 | 769 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 797 bounds_ = bounds; | 793 bounds_ = bounds; |
| 798 | 794 |
| 799 if (origin_changed) | 795 if (origin_changed) |
| 800 native_widget_delegate_->AsWidget()->OnNativeWidgetMove(); | 796 native_widget_delegate_->AsWidget()->OnNativeWidgetMove(); |
| 801 if (size_changed) | 797 if (size_changed) |
| 802 OnHostResized(bounds.size()); | 798 OnHostResized(bounds.size()); |
| 803 else | 799 else |
| 804 compositor()->ScheduleRedrawRect(gfx::Rect(bounds.size())); | 800 compositor()->ScheduleRedrawRect(gfx::Rect(bounds.size())); |
| 805 } | 801 } |
| 806 | 802 |
| 807 gfx::Insets DesktopWindowTreeHostX11::GetInsets() const { | |
| 808 return gfx::Insets(); | |
| 809 } | |
| 810 | |
| 811 void DesktopWindowTreeHostX11::SetInsets(const gfx::Insets& insets) { | |
| 812 } | |
| 813 | |
| 814 gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { | 803 gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { |
| 815 return bounds_.origin(); | 804 return bounds_.origin(); |
| 816 } | 805 } |
| 817 | 806 |
| 818 void DesktopWindowTreeHostX11::SetCapture() { | 807 void DesktopWindowTreeHostX11::SetCapture() { |
| 819 // This is vaguely based on the old NativeWidgetGtk implementation. | 808 // This is vaguely based on the old NativeWidgetGtk implementation. |
| 820 // | 809 // |
| 821 // X11's XPointerGrab() shouldn't be used for everything; it doesn't map | 810 // X11's XPointerGrab() shouldn't be used for everything; it doesn't map |
| 822 // cleanly to Windows' SetCapture(). GTK only provides a separate concept of | 811 // cleanly to Windows' SetCapture(). GTK only provides a separate concept of |
| 823 // a grab that wasn't the X11 pointer grab, but was instead a manual | 812 // a grab that wasn't the X11 pointer grab, but was instead a manual |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 &root_x_return, &root_y_return, | 844 &root_x_return, &root_y_return, |
| 856 &win_x_return, &win_y_return, | 845 &win_x_return, &win_y_return, |
| 857 &mask_return); | 846 &mask_return); |
| 858 *location_return = gfx::Point( | 847 *location_return = gfx::Point( |
| 859 std::max(0, std::min(bounds_.width(), win_x_return)), | 848 std::max(0, std::min(bounds_.width(), win_x_return)), |
| 860 std::max(0, std::min(bounds_.height(), win_y_return))); | 849 std::max(0, std::min(bounds_.height(), win_y_return))); |
| 861 return (win_x_return >= 0 && win_x_return < bounds_.width() && | 850 return (win_x_return >= 0 && win_x_return < bounds_.width() && |
| 862 win_y_return >= 0 && win_y_return < bounds_.height()); | 851 win_y_return >= 0 && win_y_return < bounds_.height()); |
| 863 } | 852 } |
| 864 | 853 |
| 865 bool DesktopWindowTreeHostX11::ConfineCursorToRootWindow() { | |
| 866 NOTIMPLEMENTED(); | |
| 867 return false; | |
| 868 } | |
| 869 | |
| 870 void DesktopWindowTreeHostX11::UnConfineCursor() { | |
| 871 NOTIMPLEMENTED(); | |
| 872 } | |
| 873 | |
| 874 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { | 854 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { |
| 875 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); | 855 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); |
| 876 } | 856 } |
| 877 | 857 |
| 878 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { | 858 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { |
| 879 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, | 859 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, |
| 880 bounds_.x() + location.x(), bounds_.y() + location.y()); | 860 bounds_.x() + location.x(), bounds_.y() + location.y()); |
| 881 } | 861 } |
| 882 | 862 |
| 883 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { | 863 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 if (linux_ui) { | 1597 if (linux_ui) { |
| 1618 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1598 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
| 1619 if (native_theme) | 1599 if (native_theme) |
| 1620 return native_theme; | 1600 return native_theme; |
| 1621 } | 1601 } |
| 1622 | 1602 |
| 1623 return ui::NativeTheme::instance(); | 1603 return ui::NativeTheme::instance(); |
| 1624 } | 1604 } |
| 1625 | 1605 |
| 1626 } // namespace views | 1606 } // namespace views |
| OLD | NEW |