diff options
Diffstat (limited to 'ash/wm/window_util.cc')
-rw-r--r-- | ash/wm/window_util.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index 632d1d3..6f591a4 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -171,23 +171,31 @@ void SetPreAutoManageWindowBounds(aura::Window* window, new gfx::Rect(bounds)); } -void AdjustBoundsToEnsureWindowVisibility(gfx::Rect* bounds, - const gfx::Rect& work_area) { +void AdjustBoundsToEnsureMinimumWindowVisibility(const gfx::Rect& work_area, + gfx::Rect* bounds) { + AdjustBoundsToEnsureWindowVisibility( + work_area, kMinimumOnScreenArea, kMinimumOnScreenArea, bounds); +} + +void AdjustBoundsToEnsureWindowVisibility(const gfx::Rect& work_area, + int min_width, + int min_height, + gfx::Rect* bounds) { bounds->set_width(std::min(bounds->width(), work_area.width())); bounds->set_height(std::min(bounds->height(), work_area.height())); if (!work_area.Intersects(*bounds)) { int y_offset = 0; if (work_area.bottom() < bounds->y()) { - y_offset = work_area.bottom() - bounds->y() - kMinimumOnScreenArea; + y_offset = work_area.bottom() - bounds->y() - min_height; } else if (bounds->bottom() < work_area.y()) { - y_offset = work_area.y() - bounds->bottom() + kMinimumOnScreenArea; + y_offset = work_area.y() - bounds->bottom() + min_height; } int x_offset = 0; if (work_area.right() < bounds->x()) { - x_offset = work_area.right() - bounds->x() - kMinimumOnScreenArea; + x_offset = work_area.right() - bounds->x() - min_width; } else if (bounds->right() < work_area.x()) { - x_offset = work_area.x() - bounds->right() + kMinimumOnScreenArea; + x_offset = work_area.x() - bounds->right() + min_width; } bounds->Offset(x_offset, y_offset); } |