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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 93873013: Make sure the dragged window is smaller than work area in the target display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
OLDNEW
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 "ash/wm/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded( 251 void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded(
252 wm::WindowState* window_state) { 252 wm::WindowState* window_state) {
253 // Don't adjust window bounds if the bounds are empty as this 253 // Don't adjust window bounds if the bounds are empty as this
254 // happens when a new views::Widget is created. 254 // happens when a new views::Widget is created.
255 // When a window is dragged and dropped onto a different 255 // When a window is dragged and dropped onto a different
256 // root window, the bounds will be updated after they are added 256 // root window, the bounds will be updated after they are added
257 // to the root window. 257 // to the root window.
258 if (window_state->window()->bounds().IsEmpty()) 258 if (window_state->window()->bounds().IsEmpty())
259 return; 259 return;
260 260
261 if (window_state->is_dragged())
262 return;
263
264 if (SetMaximizedOrFullscreenBounds(window_state))
265 return;
266
267 Window* window = window_state->window(); 261 Window* window = window_state->window();
268 gfx::Rect bounds = window->bounds(); 262 gfx::Rect bounds = window->bounds();
269 int min_width = bounds.width() * kMinimumPercentOnScreenArea; 263
270 int min_height = bounds.height() * kMinimumPercentOnScreenArea;
271 // Use entire display instead of workarea because the workarea can 264 // Use entire display instead of workarea because the workarea can
272 // be further shrunk by the docked area. The logic ensures 30% 265 // be further shrunk by the docked area. The logic ensures 30%
273 // visibility which should be enough to see where the window gets 266 // visibility which should be enough to see where the window gets
274 // moved. 267 // moved.
275 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); 268 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window);
276 269
270 if (window_state->is_dragged()) {
271 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility(
272 display_area, &bounds);
273 if (window->bounds() != bounds)
274 window->SetBounds(bounds);
275 return;
276 }
277
278 if (SetMaximizedOrFullscreenBounds(window_state))
279 return;
280
281 int min_width = bounds.width() * kMinimumPercentOnScreenArea;
282 int min_height = bounds.height() * kMinimumPercentOnScreenArea;
277 ash::wm::AdjustBoundsToEnsureWindowVisibility( 283 ash::wm::AdjustBoundsToEnsureWindowVisibility(
278 display_area, min_width, min_height, &bounds); 284 display_area, min_width, min_height, &bounds);
279 AdjustSnappedBounds(window_state, &bounds); 285 AdjustSnappedBounds(window_state, &bounds);
280 if (window->bounds() != bounds) 286 if (window->bounds() != bounds)
281 window->SetBounds(bounds); 287 window->SetBounds(bounds);
282 } 288 }
283 289
284 void WorkspaceLayoutManager::UpdateDesktopVisibility() { 290 void WorkspaceLayoutManager::UpdateDesktopVisibility() {
285 if (shelf_) 291 if (shelf_)
286 shelf_->UpdateVisibilityState(); 292 shelf_->UpdateVisibilityState();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); 417 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator());
412 slide_settings.SetPreemptionStrategy( 418 slide_settings.SetPreemptionStrategy(
413 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 419 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
414 slide_settings.SetTransitionDuration( 420 slide_settings.SetTransitionDuration(
415 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); 421 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs));
416 SetChildBoundsDirect(child, bounds); 422 SetChildBoundsDirect(child, bounds);
417 } 423 }
418 424
419 } // namespace internal 425 } // namespace internal
420 } // namespace ash 426 } // namespace ash
OLDNEW
« ash/wm/drag_window_resizer_unittest.cc ('K') | « ash/wm/drag_window_resizer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698