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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } | 755 } |
756 | 756 |
757 void DesktopWindowTreeHostX11::Hide() { | 757 void DesktopWindowTreeHostX11::Hide() { |
758 if (window_mapped_) { | 758 if (window_mapped_) { |
759 XWithdrawWindow(xdisplay_, xwindow_, 0); | 759 XWithdrawWindow(xdisplay_, xwindow_, 0); |
760 window_mapped_ = false; | 760 window_mapped_ = false; |
761 } | 761 } |
762 native_widget_delegate_->OnNativeWidgetVisibilityChanged(false); | 762 native_widget_delegate_->OnNativeWidgetVisibilityChanged(false); |
763 } | 763 } |
764 | 764 |
765 void DesktopWindowTreeHostX11::ToggleFullScreen() { | |
766 NOTIMPLEMENTED(); | |
767 } | |
768 | |
769 gfx::Rect DesktopWindowTreeHostX11::GetBounds() const { | 765 gfx::Rect DesktopWindowTreeHostX11::GetBounds() const { |
770 return bounds_; | 766 return bounds_; |
771 } | 767 } |
772 | 768 |
773 void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { | 769 void DesktopWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) { |
774 bool origin_changed = bounds_.origin() != bounds.origin(); | 770 bool origin_changed = bounds_.origin() != bounds.origin(); |
775 bool size_changed = bounds_.size() != bounds.size(); | 771 bool size_changed = bounds_.size() != bounds.size(); |
776 XWindowChanges changes = {0}; | 772 XWindowChanges changes = {0}; |
777 unsigned value_mask = 0; | 773 unsigned value_mask = 0; |
778 | 774 |
(...skipping 23 matching lines...) Expand all Loading... |
802 bounds_ = bounds; | 798 bounds_ = bounds; |
803 | 799 |
804 if (origin_changed) | 800 if (origin_changed) |
805 native_widget_delegate_->AsWidget()->OnNativeWidgetMove(); | 801 native_widget_delegate_->AsWidget()->OnNativeWidgetMove(); |
806 if (size_changed) | 802 if (size_changed) |
807 OnHostResized(bounds.size()); | 803 OnHostResized(bounds.size()); |
808 else | 804 else |
809 compositor()->ScheduleRedrawRect(gfx::Rect(bounds.size())); | 805 compositor()->ScheduleRedrawRect(gfx::Rect(bounds.size())); |
810 } | 806 } |
811 | 807 |
812 gfx::Insets DesktopWindowTreeHostX11::GetInsets() const { | |
813 return gfx::Insets(); | |
814 } | |
815 | |
816 void DesktopWindowTreeHostX11::SetInsets(const gfx::Insets& insets) { | |
817 } | |
818 | |
819 gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { | 808 gfx::Point DesktopWindowTreeHostX11::GetLocationOnNativeScreen() const { |
820 return bounds_.origin(); | 809 return bounds_.origin(); |
821 } | 810 } |
822 | 811 |
823 void DesktopWindowTreeHostX11::SetCapture() { | 812 void DesktopWindowTreeHostX11::SetCapture() { |
824 // This is vaguely based on the old NativeWidgetGtk implementation. | 813 // This is vaguely based on the old NativeWidgetGtk implementation. |
825 // | 814 // |
826 // X11's XPointerGrab() shouldn't be used for everything; it doesn't map | 815 // X11's XPointerGrab() shouldn't be used for everything; it doesn't map |
827 // cleanly to Windows' SetCapture(). GTK only provides a separate concept of | 816 // cleanly to Windows' SetCapture(). GTK only provides a separate concept of |
828 // a grab that wasn't the X11 pointer grab, but was instead a manual | 817 // 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... |
860 &root_x_return, &root_y_return, | 849 &root_x_return, &root_y_return, |
861 &win_x_return, &win_y_return, | 850 &win_x_return, &win_y_return, |
862 &mask_return); | 851 &mask_return); |
863 *location_return = gfx::Point( | 852 *location_return = gfx::Point( |
864 std::max(0, std::min(bounds_.width(), win_x_return)), | 853 std::max(0, std::min(bounds_.width(), win_x_return)), |
865 std::max(0, std::min(bounds_.height(), win_y_return))); | 854 std::max(0, std::min(bounds_.height(), win_y_return))); |
866 return (win_x_return >= 0 && win_x_return < bounds_.width() && | 855 return (win_x_return >= 0 && win_x_return < bounds_.width() && |
867 win_y_return >= 0 && win_y_return < bounds_.height()); | 856 win_y_return >= 0 && win_y_return < bounds_.height()); |
868 } | 857 } |
869 | 858 |
870 bool DesktopWindowTreeHostX11::ConfineCursorToRootWindow() { | |
871 NOTIMPLEMENTED(); | |
872 return false; | |
873 } | |
874 | |
875 void DesktopWindowTreeHostX11::UnConfineCursor() { | |
876 NOTIMPLEMENTED(); | |
877 } | |
878 | |
879 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { | 859 void DesktopWindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { |
880 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); | 860 XDefineCursor(xdisplay_, xwindow_, cursor.platform()); |
881 } | 861 } |
882 | 862 |
883 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { | 863 void DesktopWindowTreeHostX11::MoveCursorToNative(const gfx::Point& location) { |
884 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, | 864 XWarpPointer(xdisplay_, None, x_root_window_, 0, 0, 0, 0, |
885 bounds_.x() + location.x(), bounds_.y() + location.y()); | 865 bounds_.x() + location.x(), bounds_.y() + location.y()); |
886 } | 866 } |
887 | 867 |
888 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { | 868 void DesktopWindowTreeHostX11::OnCursorVisibilityChangedNative(bool show) { |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 if (linux_ui) { | 1613 if (linux_ui) { |
1634 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); | 1614 ui::NativeTheme* native_theme = linux_ui->GetNativeTheme(); |
1635 if (native_theme) | 1615 if (native_theme) |
1636 return native_theme; | 1616 return native_theme; |
1637 } | 1617 } |
1638 | 1618 |
1639 return ui::NativeTheme::instance(); | 1619 return ui::NativeTheme::instance(); |
1640 } | 1620 } |
1641 | 1621 |
1642 } // namespace views | 1622 } // namespace views |
OLD | NEW |