diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 09:00:47 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 09:00:47 +0000 |
commit | b885a70783f397c78e6da8b11eb58ba10e28af86 (patch) | |
tree | c02db3b38bd5bf6d7668e48555143196cc6bcbe1 /ash/display | |
parent | 9fbbdded24b1045ae57bb97ed8fd3e510f58b3ab (diff) | |
download | chromium_src-b885a70783f397c78e6da8b11eb58ba10e28af86.zip chromium_src-b885a70783f397c78e6da8b11eb58ba10e28af86.tar.gz chromium_src-b885a70783f397c78e6da8b11eb58ba10e28af86.tar.bz2 |
Fix AdjustBoundsToEnsureWindowVisibility to work with non primary display bounds
This was asssuming that the visibile area has 0,0 origin.
Move the code to ensure minimum visibility when added, from
WorkspaceLayoutManager to DragWindowResizer.
BUG=none
TEST=WindowUtilTest.AdjustBoundsToEnsureWindowVisibility.
This also fixes the test that was failing.
TBR=oshima@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=243986
Review URL: https://codereview.chromium.org/106303005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display')
-rw-r--r-- | ash/display/screen_position_controller.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc index 5b45b7c..0e11a29 100644 --- a/ash/display/screen_position_controller.cc +++ b/ash/display/screen_position_controller.cc @@ -11,6 +11,7 @@ #include "ash/wm/coordinate_conversion.h" #include "ash/wm/system_modal_container_layout_manager.h" #include "ash/wm/window_properties.h" +#include "ash/wm/window_state.h" #include "ui/aura/client/activation_client.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/client/focus_client.h" @@ -193,6 +194,15 @@ void ScreenPositionController::SetBounds(aura::Window* window, if (active && focused != active) tracker.Add(active); + // Set new bounds now so that the container's layout manager + // can adjust the bounds if necessary. + gfx::Point origin = bounds.origin(); + const gfx::Point display_origin = display.bounds().origin(); + origin.Offset(-display_origin.x(), -display_origin.y()); + gfx::Rect new_bounds = gfx::Rect(origin, bounds.size()); + + window->SetBounds(new_bounds); + dst_container->AddChild(window); MoveAllTransientChildrenToNewRoot(display, window); @@ -206,9 +216,13 @@ void ScreenPositionController::SetBounds(aura::Window* window, } else if (tracker.Contains(active)) { activation_client->ActivateWindow(active); } + // TODO(oshima): We should not have to update the bounds again + // below in theory, but we currently do need as there is a code + // that assumes that the bounds will never be overridden by the + // layout mananger. We should have more explicit control how + // constraints are applied by the layout manager. } } - gfx::Point origin(bounds.origin()); const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( window).bounds().origin(); |