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

Unified Diff: ash/wm/window_resizer.cc

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock on left or right edge Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/window_resizer.cc
diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc
index 3773d0735099072ee932d1ffc915df274181a16b..b5aa3d8a9dd9f9a03e66b935af01276e5a619cdc 100644
--- a/ash/wm/window_resizer.cc
+++ b/ash/wm/window_resizer.cc
@@ -6,6 +6,7 @@
#include "ash/screen_ash.h"
#include "ash/shell.h"
+#include "ash/wm/dock/dock_edge_types.h"
#include "ash/wm/property_util.h"
#include "ash/wm/window_util.h"
#include "ui/aura/client/aura_constants.h"
@@ -176,7 +177,9 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
gfx::Point location = passed_location;
gfx::Rect work_area =
- ScreenAsh::GetDisplayWorkAreaBoundsInParent(details.window);
+ (GetDockEdges(details.window) == DOCK_EDGE_NONE) ?
+ ScreenAsh::GetDisplayWorkAreaBoundsInParent(details.window) :
+ ScreenAsh::GetDisplayBoundsInParent(details.window);
int delta_x = location.x() - details.initial_location_in_parent.x();
int delta_y = location.y() - details.initial_location_in_parent.y();
@@ -248,7 +251,11 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag(
ScreenAsh::ConvertRectToScreen(parent, new_bounds);
const gfx::Display& display =
Shell::GetScreen()->GetDisplayMatching(new_bounds_in_screen);
- gfx::Rect screen_work_area = display.work_area();
+ gfx::Rect screen_work_area;
+ if (GetDockEdges(details.window) == DOCK_EDGE_NONE)
+ screen_work_area = display.work_area();
+ else
+ screen_work_area = display.bounds();
screen_work_area.Inset(kMinimumOnScreenArea, 0);
if (!screen_work_area.Intersects(new_bounds_in_screen)) {
// Make sure that the x origin does not leave the current display.

Powered by Google App Engine
This is Rietveld 408576698