OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/shell_surface.h" | 5 #include "components/exo/shell_surface.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/shell_window_ids.h" | 8 #include "ash/common/shell_window_ids.h" |
9 #include "ash/common/wm/window_resizer.h" | 9 #include "ash/common/wm/window_resizer.h" |
10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 return resizer_->details().bounds_change & | 890 return resizer_->details().bounds_change & |
891 ash::WindowResizer::kBoundsChange_Resizes; | 891 ash::WindowResizer::kBoundsChange_Resizes; |
892 } | 892 } |
893 | 893 |
894 gfx::Rect ShellSurface::GetVisibleBounds() const { | 894 gfx::Rect ShellSurface::GetVisibleBounds() const { |
895 // Use |geometry_| if set, otherwise use the visual bounds of the surface. | 895 // Use |geometry_| if set, otherwise use the visual bounds of the surface. |
896 return geometry_.IsEmpty() ? gfx::Rect(surface_->layer()->size()) : geometry_; | 896 return geometry_.IsEmpty() ? gfx::Rect(surface_->layer()->size()) : geometry_; |
897 } | 897 } |
898 | 898 |
899 gfx::Point ShellSurface::GetSurfaceOrigin() const { | 899 gfx::Point ShellSurface::GetSurfaceOrigin() const { |
900 gfx::Rect window_bounds = widget_->GetWindowBoundsInScreen(); | 900 gfx::Rect window_bounds = widget_->GetNativeWindow()->bounds(); |
901 | 901 |
902 // If initial bounds were specified then surface origin is always relative | 902 // If initial bounds were specified then surface origin is always relative |
903 // to those bounds. | 903 // to those bounds. |
904 if (!initial_bounds_.IsEmpty()) | 904 if (!initial_bounds_.IsEmpty()) |
905 return initial_bounds_.origin() - window_bounds.OffsetFromOrigin(); | 905 return initial_bounds_.origin() - window_bounds.OffsetFromOrigin(); |
906 | 906 |
907 gfx::Rect visible_bounds = GetVisibleBounds(); | 907 gfx::Rect visible_bounds = GetVisibleBounds(); |
908 switch (resize_component_) { | 908 switch (resize_component_) { |
909 case HTCAPTION: | 909 case HTCAPTION: |
910 return origin_ - visible_bounds.OffsetFromOrigin(); | 910 return origin_ - visible_bounds.OffsetFromOrigin(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 DCHECK(!ignore_window_bounds_changes_); | 963 DCHECK(!ignore_window_bounds_changes_); |
964 ignore_window_bounds_changes_ = true; | 964 ignore_window_bounds_changes_ = true; |
965 widget_->SetBounds(new_widget_bounds); | 965 widget_->SetBounds(new_widget_bounds); |
966 ignore_window_bounds_changes_ = false; | 966 ignore_window_bounds_changes_ = false; |
967 | 967 |
968 // A change to the widget size requires surface bounds to be re-adjusted. | 968 // A change to the widget size requires surface bounds to be re-adjusted. |
969 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size())); | 969 surface_->SetBounds(gfx::Rect(GetSurfaceOrigin(), surface_->layer()->size())); |
970 } | 970 } |
971 | 971 |
972 } // namespace exo | 972 } // namespace exo |
OLD | NEW |