diff options
author | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 07:12:48 +0000 |
---|---|---|
committer | yusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-09 07:12:48 +0000 |
commit | e79f26e79c7a547daea7ffb9fed3755b82641077 (patch) | |
tree | ab87a149931ec4161eb0f0acbdccae8e7be0631f /ash/display/screen_position_controller.cc | |
parent | 3b6bd997382b2a8a3d8bbfb3cf70a10f4e011de6 (diff) | |
download | chromium_src-e79f26e79c7a547daea7ffb9fed3755b82641077.zip chromium_src-e79f26e79c7a547daea7ffb9fed3755b82641077.tar.gz chromium_src-e79f26e79c7a547daea7ffb9fed3755b82641077.tar.bz2 |
Improve WorkspaceWindowResizer::CompleteDrag() so that the function moves the window to a root window where the cursor is currently on.
This CL depends on http://codereview.chromium.org/10834097/ .
BUG=136816
TEST=try
Review URL: https://chromiumcodereview.appspot.com/10836065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150762 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display/screen_position_controller.cc')
-rw-r--r-- | ash/display/screen_position_controller.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc index 124b6d2..1deb4e2 100644 --- a/ash/display/screen_position_controller.cc +++ b/ash/display/screen_position_controller.cc @@ -7,7 +7,6 @@ #include "ash/display/display_controller.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" -#include "ash/wm/coordinate_conversion.h" #include "ash/wm/system_modal_container_layout_manager.h" #include "ash/wm/window_properties.h" #include "ui/aura/client/activation_client.h" @@ -24,8 +23,10 @@ namespace { // Move all transient children to |dst_root|, including the ones in // the child windows and transient children of the transient children. -void MoveAllTransientChildrenToNewRoot(aura::RootWindow* dst_root, - aura::Window* window) { +void MoveAllTransientChildrenToNewRoot(const gfx::Display& display, + aura::Window* window) { + aura::RootWindow* dst_root = Shell::GetInstance()->display_controller()-> + GetRootWindowForDisplayId(display.id()); aura::Window::Windows transient_children = window->transient_children(); for (aura::Window::Windows::iterator iter = transient_children.begin(); iter != transient_children.end(); ++iter) { @@ -35,17 +36,16 @@ void MoveAllTransientChildrenToNewRoot(aura::RootWindow* dst_root, aura::Window* container = Shell::GetContainer(dst_root, container_id); gfx::Rect parent_bounds_in_screen = transient_child->GetBoundsInScreen(); container->AddChild(transient_child); - transient_child->SetBoundsInScreen(parent_bounds_in_screen); + transient_child->SetBoundsInScreen(parent_bounds_in_screen, display); // Transient children may have transient children. - MoveAllTransientChildrenToNewRoot(dst_root, - transient_child); + MoveAllTransientChildrenToNewRoot(display, transient_child); } // Move transient children of the child windows if any. aura::Window::Windows children = window->children(); for (aura::Window::Windows::iterator iter = children.begin(); iter != children.end(); ++iter) - MoveAllTransientChildrenToNewRoot(dst_root, *iter); + MoveAllTransientChildrenToNewRoot(display, *iter); } } // namespace @@ -78,9 +78,10 @@ void ScreenPositionController::ConvertPointFromScreen( aura::Window::ConvertPointToTarget(root, window, point); } -void ScreenPositionController::SetBounds( - aura::Window* window, - const gfx::Rect& bounds) { +void ScreenPositionController::SetBounds(aura::Window* window, + const gfx::Rect& bounds, + const gfx::Display& display) { + DCHECK_NE(-1, display.id()); if (!DisplayController::IsExtendedDesktopEnabled() || !window->parent()->GetProperty(internal::kUsesScreenCoordinatesKey)) { window->SetBounds(bounds); @@ -90,7 +91,9 @@ void ScreenPositionController::SetBounds( // Don't move a transient windows to other root window. // It moves when its transient_parent moves. if (!window->transient_parent()) { - aura::RootWindow* dst_root = wm::GetRootWindowMatching(bounds); + aura::RootWindow* dst_root = + Shell::GetInstance()->display_controller()->GetRootWindowForDisplayId( + display.id()); aura::Window* dst_container = NULL; if (dst_root != window->GetRootWindow()) { int container_id = window->parent()->id(); @@ -116,7 +119,7 @@ void ScreenPositionController::SetBounds( dst_container->AddChild(window); - MoveAllTransientChildrenToNewRoot(dst_root, window); + MoveAllTransientChildrenToNewRoot(display, window); // Restore focused/active window. if (tracker.Contains(focused)) |