Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Side by Side Diff: components/exo/shell_surface.cc

Issue 2176293002: exo: Convert widget bounds to screen coordinates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
23 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
24 #include "ui/aura/window_event_dispatcher.h" 24 #include "ui/aura/window_event_dispatcher.h"
25 #include "ui/aura/window_property.h" 25 #include "ui/aura/window_property.h"
26 #include "ui/aura/window_targeter.h" 26 #include "ui/aura/window_targeter.h"
27 #include "ui/aura/window_tree_host.h" 27 #include "ui/aura/window_tree_host.h"
28 #include "ui/base/accelerators/accelerator.h" 28 #include "ui/base/accelerators/accelerator.h"
29 #include "ui/gfx/path.h" 29 #include "ui/gfx/path.h"
30 #include "ui/views/widget/widget.h" 30 #include "ui/views/widget/widget.h"
31 #include "ui/views/widget/widget_observer.h" 31 #include "ui/views/widget/widget_observer.h"
32 #include "ui/wm/core/coordinate_conversion.h"
32 #include "ui/wm/core/shadow.h" 33 #include "ui/wm/core/shadow.h"
33 #include "ui/wm/core/shadow_controller.h" 34 #include "ui/wm/core/shadow_controller.h"
34 #include "ui/wm/core/shadow_types.h" 35 #include "ui/wm/core/shadow_types.h"
35 #include "ui/wm/core/window_util.h" 36 #include "ui/wm/core/window_util.h"
36 #include "ui/wm/public/activation_client.h" 37 #include "ui/wm/public/activation_client.h"
37 38
38 DECLARE_WINDOW_PROPERTY_TYPE(std::string*) 39 DECLARE_WINDOW_PROPERTY_TYPE(std::string*)
39 40
40 namespace exo { 41 namespace exo {
41 namespace { 42 namespace {
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 if (widget_->IsMaximized() || widget_->IsFullscreen() || IsResizing()) 1141 if (widget_->IsMaximized() || widget_->IsFullscreen() || IsResizing())
1141 return; 1142 return;
1142 1143
1143 // Return early if there is pending configure requests. 1144 // Return early if there is pending configure requests.
1144 if (!pending_configs_.empty() || scoped_configure_) 1145 if (!pending_configs_.empty() || scoped_configure_)
1145 return; 1146 return;
1146 1147
1147 gfx::Rect visible_bounds = GetVisibleBounds(); 1148 gfx::Rect visible_bounds = GetVisibleBounds();
1148 gfx::Rect new_widget_bounds = visible_bounds; 1149 gfx::Rect new_widget_bounds = visible_bounds;
1149 1150
1150 // Avoid changing widget origin unless initial bounds were specificed and 1151 // Avoid changing widget origin unless initial bounds were specified and
1151 // widget origin is always relative to it. 1152 // widget origin is always relative to it.
1152 if (initial_bounds_.IsEmpty()) 1153 if (initial_bounds_.IsEmpty())
1153 new_widget_bounds.set_origin(widget_->GetNativeWindow()->bounds().origin()); 1154 new_widget_bounds.set_origin(widget_->GetWindowBoundsInScreen().origin());
1154 1155
1155 // Update widget origin using the surface origin if the current location of 1156 // Update widget origin using the surface origin if the current location of
1156 // surface is being anchored to one side of the widget as a result of a 1157 // surface is being anchored to one side of the widget as a result of a
1157 // resize operation. 1158 // resize operation.
1158 if (resize_component_ != HTCAPTION) { 1159 if (resize_component_ != HTCAPTION) {
1159 gfx::Point new_widget_origin = 1160 gfx::Point new_widget_origin =
1160 GetSurfaceOrigin() + visible_bounds.OffsetFromOrigin(); 1161 GetSurfaceOrigin() + visible_bounds.OffsetFromOrigin();
1161 aura::Window::ConvertPointToTarget(widget_->GetNativeWindow(), 1162 wm::ConvertPointToScreen(widget_->GetNativeWindow(), &new_widget_origin);
1162 widget_->GetNativeWindow()->parent(),
1163 &new_widget_origin);
1164 new_widget_bounds.set_origin(new_widget_origin); 1163 new_widget_bounds.set_origin(new_widget_origin);
1165 } 1164 }
1166 1165
1167 // Set |ignore_window_bounds_changes_| as this change to window bounds 1166 // Set |ignore_window_bounds_changes_| as this change to window bounds
1168 // should not result in a configure request. 1167 // should not result in a configure request.
1169 DCHECK(!ignore_window_bounds_changes_); 1168 DCHECK(!ignore_window_bounds_changes_);
1170 ignore_window_bounds_changes_ = true; 1169 ignore_window_bounds_changes_ = true;
1171 if (widget_->GetNativeWindow()->bounds() != new_widget_bounds) 1170 if (widget_->GetWindowBoundsInScreen() != new_widget_bounds)
1172 widget_->SetBounds(new_widget_bounds); 1171 widget_->SetBounds(new_widget_bounds);
1173 ignore_window_bounds_changes_ = false; 1172 ignore_window_bounds_changes_ = false;
1174 1173
1175 // A change to the widget size requires surface bounds to be re-adjusted. 1174 // A change to the widget size requires surface bounds to be re-adjusted.
1176 surface_->window()->SetBounds( 1175 surface_->window()->SetBounds(
1177 gfx::Rect(GetSurfaceOrigin(), surface_->window()->layer()->size())); 1176 gfx::Rect(GetSurfaceOrigin(), surface_->window()->layer()->size()));
1178 } 1177 }
1179 1178
1180 void ShellSurface::UpdateShadow() { 1179 void ShellSurface::UpdateShadow() {
1181 if (!widget_) 1180 if (!widget_)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 shadow_origin -= origin.OffsetFromOrigin(); 1223 shadow_origin -= origin.OffsetFromOrigin();
1225 gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size()); 1224 gfx::Rect shadow_bounds(shadow_origin, shadow_content_bounds_.size());
1226 1225
1227 shadow_overlay_->SetBounds(shadow_bounds); 1226 shadow_overlay_->SetBounds(shadow_bounds);
1228 shadow_underlay_->SetBounds(shadow_bounds); 1227 shadow_underlay_->SetBounds(shadow_bounds);
1229 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1228 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1230 } 1229 }
1231 } 1230 }
1232 1231
1233 } // namespace exo 1232 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698