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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/drag_window_resizer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_layout_manager.cc
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index fe7d748d19b8c953c2c18530750ffb1c190d8f8e..f388632d19ec77cd9b843e6931ca8c26428ac98f 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -264,22 +264,28 @@ void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded(
if (window_state->window()->bounds().IsEmpty())
return;
- if (window_state->is_dragged())
- return;
-
- if (SetMaximizedOrFullscreenBounds(window_state))
- return;
-
Window* window = window_state->window();
gfx::Rect bounds = window->bounds();
- int min_width = bounds.width() * kMinimumPercentOnScreenArea;
- int min_height = bounds.height() * kMinimumPercentOnScreenArea;
+
// Use entire display instead of workarea because the workarea can
// be further shrunk by the docked area. The logic ensures 30%
// visibility which should be enough to see where the window gets
// moved.
gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window);
+ if (window_state->is_dragged()) {
+ ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility(
+ display_area, &bounds);
+ if (window->bounds() != bounds)
+ window->SetBounds(bounds);
+ return;
+ }
+
+ if (SetMaximizedOrFullscreenBounds(window_state))
+ return;
+
+ int min_width = bounds.width() * kMinimumPercentOnScreenArea;
+ int min_height = bounds.height() * kMinimumPercentOnScreenArea;
ash::wm::AdjustBoundsToEnsureWindowVisibility(
display_area, min_width, min_height, &bounds);
AdjustSnappedBounds(window_state, &bounds);
« no previous file with comments | « 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