diff options
-rw-r--r-- | ash/display/screen_position_controller.cc | 27 | ||||
-rw-r--r-- | ash/display/screen_position_controller.h | 3 | ||||
-rw-r--r-- | ash/extended_desktop_unittest.cc | 29 | ||||
-rw-r--r-- | ash/test/ash_test_base.cc | 15 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer.cc | 45 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer.h | 3 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer_unittest.cc | 120 | ||||
-rw-r--r-- | ui/aura/client/screen_position_client.h | 5 | ||||
-rw-r--r-- | ui/aura/window.cc | 5 | ||||
-rw-r--r-- | ui/aura/window.h | 7 | ||||
-rw-r--r-- | ui/views/widget/desktop_native_widget_helper_aura.cc | 4 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 3 |
12 files changed, 221 insertions, 45 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)) diff --git a/ash/display/screen_position_controller.h b/ash/display/screen_position_controller.h index 0d39480..f83affb 100644 --- a/ash/display/screen_position_controller.h +++ b/ash/display/screen_position_controller.h @@ -22,7 +22,8 @@ class ScreenPositionController : public aura::client::ScreenPositionClient { virtual void ConvertPointFromScreen(const aura::Window* window, gfx::Point* point) OVERRIDE; virtual void SetBounds(aura::Window* window, - const gfx::Rect& bounds) OVERRIDE; + const gfx::Rect& bounds, + const gfx::Display& display) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ScreenPositionController); diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index 2b1108d..572bb68 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc @@ -383,6 +383,35 @@ TEST_F(ExtendedDesktopTest, MoveWindow) { EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); } +TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { + UpdateDisplay("1000x1000,1000x1000"); + Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); + + gfx::Display display0 = + gfx::Screen::GetDisplayMatching(root_windows[0]->GetBoundsInScreen()); + gfx::Display display1 = + gfx::Screen::GetDisplayMatching(root_windows[1]->GetBoundsInScreen()); + EXPECT_NE(display0.id(), display1.id()); + + views::Widget* d1 = CreateTestWidget(gfx::Rect(10, 10, 1000, 100)); + EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); + + // Move the window where the window spans both root windows. Since the second + // parameter is |display1|, the window should be shown on the secondary root. + d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), + display1); + EXPECT_EQ("500,10 1000x100", + d1->GetWindowBoundsInScreen().ToString()); + EXPECT_EQ(root_windows[1], d1->GetNativeView()->GetRootWindow()); + + // Move to the primary root. + d1->GetNativeWindow()->SetBoundsInScreen(gfx::Rect(500, 10, 1000, 100), + display0); + EXPECT_EQ("500,10 1000x100", + d1->GetWindowBoundsInScreen().ToString()); + EXPECT_EQ(root_windows[0], d1->GetNativeView()->GetRootWindow()); +} + TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) { UpdateDisplay("1000x600,600x400"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 07f93d0..e559833 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -7,6 +7,7 @@ #include <string> #include <vector> +#include "ash/display/display_controller.h" #include "ash/shell.h" #include "ash/test/test_shell_delegate.h" #include "base/run_loop.h" @@ -87,6 +88,20 @@ void AshTestBase::UpdateDisplay(const std::string& display_specs) { std::vector<gfx::Display> displays = CreateDisplaysFromString(display_specs); aura::Env::GetInstance()->display_manager()-> OnNativeDisplaysChanged(displays); + + // On non-testing environment, when a secondary display is connected, a new + // native (i.e. X) window for the display is always created below the previous + // one for GPU performance reasons. Try to emulate the behavior. + if (internal::DisplayController::IsExtendedDesktopEnabled()) { + Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); + DCHECK_EQ(displays.size(), root_windows.size()); + size_t next_y = 0; + for (size_t i = 0; i < root_windows.size(); ++i) { + const gfx::Size size = root_windows[i]->GetHostSize(); + root_windows[i]->SetHostBounds(gfx::Rect(gfx::Point(0, next_y), size)); + next_y += size.height(); + } + } } void AshTestBase::RunAllPendingInMessageLoop() { diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index fe37687..ddbe81f 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -17,7 +17,6 @@ #include "ash/wm/workspace/phantom_window_controller.h" #include "ash/wm/workspace/snap_sizer.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/env.h" #include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" @@ -91,6 +90,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) { aura::Window::ConvertPointToTarget(current_root, window()->parent(), &location_in_parent); + last_mouse_location_ = location_in_parent; // Do not use |location| below this point, use |location_in_parent| instead. // When the pointer is on |window()->GetRootWindow()|, |location| and @@ -147,11 +147,24 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) { int grid_size = event_flags & ui::EF_CONTROL_DOWN ? 0 : ash::Shell::GetInstance()->GetGridSize(); - if (grid_size <= 1) + gfx::Rect bounds(GetFinalBounds(details_.window->bounds(), grid_size)); + + // Check if the destination is another display. + gfx::Point last_mouse_location_in_screen = last_mouse_location_; + wm::ConvertPointToScreen(window()->parent(), &last_mouse_location_in_screen); + const gfx::Display dst_display = + gfx::Screen::GetDisplayNearestPoint(last_mouse_location_in_screen); + + if (dst_display.id() != + gfx::Screen::GetDisplayNearestWindow(window()->GetRootWindow()).id()) { + // Don't animate when moving to another display. + const gfx::Rect dst_bounds = + ScreenAsh::ConvertRectToScreen(details_.window->parent(), bounds); + details_.window->SetBoundsInScreen(dst_bounds, dst_display); return; + } - gfx::Rect bounds(GetFinalBounds(details_.window->bounds(), grid_size)); - if (bounds == details_.window->bounds()) + if (grid_size <= 1 || bounds == details_.window->bounds()) return; if (bounds.size() != details_.window->bounds().size()) { @@ -159,23 +172,13 @@ void WorkspaceWindowResizer::CompleteDrag(int event_flags) { details_.window->SetBounds(bounds); return; } - // TODO(oshima|yusukes): This is temporary solution until better drag & move - // is implemented. (crbug.com/136816). - gfx::Rect dst_bounds = - ScreenAsh::ConvertRectToScreen(details_.window->parent(), bounds); - gfx::Display dst_display = gfx::Screen::GetDisplayMatching(dst_bounds); - if (dst_display.id() != - gfx::Screen::GetDisplayNearestWindow(details_.window).id()) { - // Don't animate when moving to another display. - details_.window->SetBoundsInScreen(dst_bounds); - } else { - ui::ScopedLayerAnimationSettings scoped_setter( - details_.window->layer()->GetAnimator()); - // Use a small duration since the grid is small. - scoped_setter.SetTransitionDuration( - base::TimeDelta::FromMilliseconds(kSnapDurationMS)); - details_.window->SetBounds(bounds); - } + + ui::ScopedLayerAnimationSettings scoped_setter( + details_.window->layer()->GetAnimator()); + // Use a small duration since the grid is small. + scoped_setter.SetTransitionDuration( + base::TimeDelta::FromMilliseconds(kSnapDurationMS)); + details_.window->SetBounds(bounds); } void WorkspaceWindowResizer::RevertDrag() { diff --git a/ash/wm/workspace/workspace_window_resizer.h b/ash/wm/workspace/workspace_window_resizer.h index 258d89c..51e06ab 100644 --- a/ash/wm/workspace/workspace_window_resizer.h +++ b/ash/wm/workspace/workspace_window_resizer.h @@ -181,6 +181,9 @@ class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { // the screen. int num_mouse_moves_since_bounds_change_; + // The mouse location passed to Drag(). + gfx::Point last_mouse_location_; + DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); }; diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index 8d7da31..8291dfc 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -6,6 +6,7 @@ #include "ash/screen_ash.h" #include "ash/shell.h" +#include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" #include "ash/wm/property_util.h" #include "ash/wm/workspace_controller.h" @@ -14,6 +15,7 @@ #include "ui/aura/test/test_window_delegate.h" #include "ui/base/hit_test.h" #include "ui/gfx/insets.h" +#include "ui/gfx/screen.h" namespace ash { namespace internal { @@ -53,22 +55,25 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { aura::RootWindow* root = Shell::GetPrimaryRootWindow(); root->SetHostSize(gfx::Size(800, kRootHeight)); + aura::Window* default_container = + Shell::GetContainer(root, kShellWindowId_DefaultContainer); + gfx::Rect root_bounds(root->bounds()); EXPECT_EQ(kRootHeight, root_bounds.height()); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); window_.reset(new aura::Window(&delegate_)); window_->Init(ui::LAYER_NOT_DRAWN); - window_->SetParent(root); + window_->SetParent(default_container); window_->set_id(1); window2_.reset(new aura::Window(&delegate2_)); window2_->Init(ui::LAYER_NOT_DRAWN); - window2_->SetParent(root); + window2_->SetParent(default_container); window2_->set_id(2); window3_.reset(new aura::Window(&delegate3_)); window3_->Init(ui::LAYER_NOT_DRAWN); - window3_->SetParent(root); + window3_->SetParent(default_container); window3_->set_id(3); } @@ -84,8 +89,9 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { // from topmost to bottomost windows. std::string WindowOrderAsString() const { std::string result; - const aura::Window::Windows& windows = - Shell::GetPrimaryRootWindow()->children(); + aura::Window* default_container = Shell::GetContainer( + Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer); + const aura::Window::Windows& windows = default_container->children(); for (aura::Window::Windows::const_reverse_iterator i = windows.rbegin(); i != windows.rend(); ++i) { if (*i == window_.get() || *i == window2_.get() || *i == window3_.get()) { @@ -102,6 +108,7 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { Shell::TestApi shell_test(Shell::GetInstance()); shell_test.workspace_controller()->SetGridSize(grid_size); } + gfx::Point CalculateDragPoint(const WorkspaceWindowResizer& resizer, int delta_x, int delta_y) const { @@ -126,6 +133,19 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizerTest); }; +// Fails on win_aura since wm::GetRootWindowRelativeToWindow is not implemented +// yet for the platform. +#if defined(OS_WIN) +#define MAYBE_WindowDragWithMultiMonitors \ + DISABLED_WindowDragWithMultiMonitors +#define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ + DISABLED_WindowDragWithMultiMonitorsRightToLeft +#else +#define MAYBE_WindowDragWithMultiMonitors WindowDragWithMultiMonitors +#define MAYBE_WindowDragWithMultiMonitorsRightToLeft \ + WindowDragWithMultiMonitorsRightToLeft +#endif + // Assertions around attached window resize dragging from the right with 2 // windows. TEST_F(WorkspaceWindowResizerTest, AttachedResize_RIGHT_2) { @@ -459,6 +479,96 @@ TEST_F(WorkspaceWindowResizerTest, Edge) { EXPECT_EQ("20,30 50x60", GetRestoreBoundsInScreen(window_.get())->ToString()); } +// Verifies a window can be moved from the primary display to another. +TEST_F(WorkspaceWindowResizerTest, MAYBE_WindowDragWithMultiMonitors) { + // The secondary display is logically on the right, but on the system (e.g. X) + // layer, it's below the primary one. See UpdateDisplay() in ash_test_base.cc. + UpdateDisplay("800x600,800x600"); + Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); + ASSERT_EQ(2U, root_windows.size()); + + window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), + gfx::Screen::GetPrimaryDisplay()); + EXPECT_EQ(root_windows[0], window_->GetRootWindow()); + { + SetGridSize(0); + // Grab (0, 0) of the window. + scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( + window_.get(), gfx::Point(), HTCAPTION, empty_windows())); + ASSERT_TRUE(resizer.get()); + // Drag the pointer to the right. Once it reaches the right edge of the + // primary display, it warps to the secondary. Since the secondary root + // window's native origin held by aura::RootWindowHost is (0, 600), and a + // mouse drag event has a location in the primary root window's coordinates, + // (0, 610) below means (0, 10) in the second root window's coordinates. + resizer->Drag(CalculateDragPoint(*resizer, 0, 610), 0); + resizer->CompleteDrag(0); + // The whole window is on the secondary display now. The parent should be + // changed. + EXPECT_EQ(root_windows[1], window_->GetRootWindow()); + EXPECT_EQ("0,10 50x60", window_->bounds().ToString()); + } + + window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), + gfx::Screen::GetPrimaryDisplay()); + EXPECT_EQ(root_windows[0], window_->GetRootWindow()); + { + // Grab (0, 0) of the window and move the pointer to (790, 10). + scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( + window_.get(), gfx::Point(), HTCAPTION, empty_windows())); + ASSERT_TRUE(resizer.get()); + resizer->Drag(CalculateDragPoint(*resizer, 790, 10), 0); + resizer->CompleteDrag(0); + // Since the pointer is still on the primary root window, the parent should + // not be changed. + EXPECT_EQ(root_windows[0], window_->GetRootWindow()); + EXPECT_EQ("790,10 50x60", window_->bounds().ToString()); + } + + window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), + gfx::Screen::GetPrimaryDisplay()); + EXPECT_EQ(root_windows[0], window_->GetRootWindow()); + { + // Grab the top-right edge of the window and move the pointer to (0, 10) + // in the secondary root window's coordinates. + scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( + window_.get(), gfx::Point(49, 0), HTCAPTION, empty_windows())); + ASSERT_TRUE(resizer.get()); + resizer->Drag(CalculateDragPoint(*resizer, -49, 610), 0); + resizer->CompleteDrag(0); + // Since the pointer is on the secondary, the parent should not be changed + // even though only small fraction of the window is within the secondary + // root window's bounds. + EXPECT_EQ(root_windows[1], window_->GetRootWindow()); + EXPECT_EQ("-49,10 50x60", window_->bounds().ToString()); + } +} + +// Verifies a window can be moved from the secondary display to primary. +TEST_F(WorkspaceWindowResizerTest, + MAYBE_WindowDragWithMultiMonitorsRightToLeft) { + UpdateDisplay("800x600,800x600"); + Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); + ASSERT_EQ(2U, root_windows.size()); + + window_->SetBoundsInScreen( + gfx::Rect(800, 00, 50, 60), + gfx::Screen::GetDisplayNearestWindow(root_windows[1])); + EXPECT_EQ(root_windows[1], window_->GetRootWindow()); + { + SetGridSize(0); + // Grab (0, 0) of the window. + scoped_ptr<WorkspaceWindowResizer> resizer(WorkspaceWindowResizer::Create( + window_.get(), gfx::Point(), HTCAPTION, empty_windows())); + ASSERT_TRUE(resizer.get()); + // Move the mouse near the right edge, (798, 0), of the primary display. + resizer->Drag(CalculateDragPoint(*resizer, 798, -600), 0); + resizer->CompleteDrag(0); + EXPECT_EQ(root_windows[0], window_->GetRootWindow()); + EXPECT_EQ("798,0 50x60", window_->bounds().ToString()); + } +} + // Verifies windows are correctly restacked when reordering multiple windows. TEST_F(WorkspaceWindowResizerTest, RestackAttached) { window_->SetBounds(gfx::Rect( 0, 0, 200, 300)); diff --git a/ui/aura/client/screen_position_client.h b/ui/aura/client/screen_position_client.h index 3384c44..17e73d8 100644 --- a/ui/aura/client/screen_position_client.h +++ b/ui/aura/client/screen_position_client.h @@ -9,6 +9,7 @@ #include "ui/aura/window.h" namespace gfx { +class Display; class Rect; } @@ -32,7 +33,9 @@ class AURA_EXPORT ScreenPositionClient { gfx::Point* point) = 0; // Sets the bounds of the window. The implementation is responsible // for finding out and translating the right coordinates for the |window|. - virtual void SetBounds(Window* window, const gfx::Rect& bounds) = 0; + virtual void SetBounds(Window* window, + const gfx::Rect& bounds, + const gfx::Display& display) = 0; virtual ~ScreenPositionClient() {} }; diff --git a/ui/aura/window.cc b/ui/aura/window.cc index d125da1..822723b 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -291,13 +291,14 @@ void Window::SetBounds(const gfx::Rect& new_bounds) { SetBoundsInternal(new_bounds); } -void Window::SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen) { +void Window::SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen, + const gfx::Display& dst_display) { RootWindow* root = GetRootWindow(); if (root) { gfx::Point origin = new_bounds_in_screen.origin(); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root); - screen_position_client->SetBounds(this, new_bounds_in_screen); + screen_position_client->SetBounds(this, new_bounds_in_screen, dst_display); return; } SetBounds(new_bounds_in_screen); diff --git a/ui/aura/window.h b/ui/aura/window.h index 58a0f53..c49e073 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -28,6 +28,10 @@ class SkCanvas; +namespace gfx { +class Display; +} + namespace ui { class Layer; class Texture; @@ -154,7 +158,8 @@ class AURA_EXPORT Window : public ui::LayerDelegate, // Changes the bounds of the window in the screen coordintates. // If present, the window's parent's LayoutManager may adjust the bounds. - void SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen_coords); + void SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen_coords, + const gfx::Display& dst_display); // Returns the target bounds of the window. If the window's layer is // not animating, it simply returns the current bounds. diff --git a/ui/views/widget/desktop_native_widget_helper_aura.cc b/ui/views/widget/desktop_native_widget_helper_aura.cc index 3c12720..ee4fb13 100644 --- a/ui/views/widget/desktop_native_widget_helper_aura.cc +++ b/ui/views/widget/desktop_native_widget_helper_aura.cc @@ -60,7 +60,9 @@ class DesktopScreenPositionClient } virtual void SetBounds(aura::Window* window, - const gfx::Rect& bounds) OVERRIDE { + const gfx::Rect& bounds, + const gfx::Display& display) OVERRIDE { + // TODO: Use the 3rd parameter, |display|. gfx::Point origin = bounds.origin(); aura::RootWindow* root = window->GetRootWindow(); aura::Window::ConvertPointToTarget(window->parent(), root, &origin); diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index a26e75d..6861e0e 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -457,7 +457,8 @@ void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root); if (screen_position_client) { - screen_position_client->SetBounds(window_, bounds); + gfx::Display dst_display = gfx::Screen::GetDisplayMatching(bounds); + screen_position_client->SetBounds(window_, bounds, dst_display); return; } } |