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/aura/root_window_host_linux.h" | 5 #include "ui/aura/root_window_host_linux.h" |
6 | 6 |
7 #include <X11/Xatom.h> | 7 #include <X11/Xatom.h> |
8 #include <X11/Xcursor/Xcursor.h> | 8 #include <X11/Xcursor/Xcursor.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/cursorfont.h> | 10 #include <X11/cursorfont.h> |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 813 |
814 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { | 814 void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { |
815 // Even if the host window's size doesn't change, aura's root window | 815 // Even if the host window's size doesn't change, aura's root window |
816 // size, which is in DIP, changes when the scale changes. | 816 // size, which is in DIP, changes when the scale changes. |
817 float current_scale = root_window_->compositor()->device_scale_factor(); | 817 float current_scale = root_window_->compositor()->device_scale_factor(); |
818 float new_scale = | 818 float new_scale = |
819 gfx::Screen::GetDisplayNearestWindow(root_window_).device_scale_factor(); | 819 gfx::Screen::GetDisplayNearestWindow(root_window_).device_scale_factor(); |
820 bool size_changed = bounds_.size() != bounds.size() || | 820 bool size_changed = bounds_.size() != bounds.size() || |
821 current_scale != new_scale; | 821 current_scale != new_scale; |
822 | 822 |
823 if (!size_changed) { | |
824 root_window_->SchedulePaintInRect(root_window_->bounds()); | |
825 return; | |
826 } | |
827 | |
828 if (bounds.size() != bounds_.size()) | 823 if (bounds.size() != bounds_.size()) |
829 XResizeWindow(xdisplay_, xwindow_, bounds.width(), bounds.height()); | 824 XResizeWindow(xdisplay_, xwindow_, bounds.width(), bounds.height()); |
830 | 825 |
831 if (bounds.origin() != bounds_.origin()) | 826 if (bounds.origin() != bounds_.origin()) |
832 XMoveWindow(xdisplay_, xwindow_, bounds.x(), bounds.y()); | 827 XMoveWindow(xdisplay_, xwindow_, bounds.x(), bounds.y()); |
833 | 828 |
834 // Assume that the resize will go through as requested, which should be the | 829 // Assume that the resize will go through as requested, which should be the |
835 // case if we're running without a window manager. If there's a window | 830 // case if we're running without a window manager. If there's a window |
836 // manager, it can modify or ignore the request, but (per ICCCM) we'll get a | 831 // manager, it can modify or ignore the request, but (per ICCCM) we'll get a |
837 // (possibly synthetic) ConfigureNotify about the actual size and correct | 832 // (possibly synthetic) ConfigureNotify about the actual size and correct |
838 // |bounds_| later. | 833 // |bounds_| later. |
839 bounds_ = bounds; | 834 bounds_ = bounds; |
840 if (size_changed) | 835 if (size_changed) |
841 root_window_->OnHostResized(bounds.size()); | 836 root_window_->OnHostResized(bounds.size()); |
| 837 else |
| 838 root_window_->SchedulePaintInRect(root_window_->bounds()); |
842 } | 839 } |
843 | 840 |
844 gfx::Point RootWindowHostLinux::GetLocationOnNativeScreen() const { | 841 gfx::Point RootWindowHostLinux::GetLocationOnNativeScreen() const { |
845 return bounds_.origin(); | 842 return bounds_.origin(); |
846 } | 843 } |
847 | 844 |
848 void RootWindowHostLinux::SetCapture() { | 845 void RootWindowHostLinux::SetCapture() { |
849 // TODO(oshima): Grab x input. | 846 // TODO(oshima): Grab x input. |
850 } | 847 } |
851 | 848 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); | 1060 ui::ViewProp::GetValue(accelerated_widget, kRootWindowHostLinuxKey)); |
1064 } | 1061 } |
1065 | 1062 |
1066 // static | 1063 // static |
1067 gfx::Size RootWindowHost::GetNativeScreenSize() { | 1064 gfx::Size RootWindowHost::GetNativeScreenSize() { |
1068 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 1065 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
1069 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 1066 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
1070 } | 1067 } |
1071 | 1068 |
1072 } // namespace aura | 1069 } // namespace aura |
OLD | NEW |