Index: ash/wm/default_window_resizer.cc |
diff --git a/ash/wm/default_window_resizer.cc b/ash/wm/default_window_resizer.cc |
index 4368c73b88ba14b3230441fe40d1b8a83ebc0d22..16f4db395f62477e8de40783bc9c55ebfd3ead69 100644 |
--- a/ash/wm/default_window_resizer.cc |
+++ b/ash/wm/default_window_resizer.cc |
@@ -7,6 +7,7 @@ |
#include "ash/shell.h" |
#include "ash/wm/cursor_manager.h" |
#include "ui/aura/client/aura_constants.h" |
+#include "ui/aura/client/screen_position_client.h" |
#include "ui/aura/env.h" |
#include "ui/aura/root_window.h" |
#include "ui/aura/window.h" |
@@ -32,10 +33,21 @@ DefaultWindowResizer::Create(aura::Window* window, |
return details.is_resizable ? new DefaultWindowResizer(details) : NULL; |
} |
-void DefaultWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
+void DefaultWindowResizer::Drag(const gfx::Point& location_in_screen, |
+ int event_flags) { |
+ // TODO(mazda|yusukes): Implement dragging an item from one display to another |
+ aura::RootWindow* current_root = Shell::GetRootWindowAt(location_in_screen); |
+ if (current_root != details_.window->GetRootWindow()) |
+ return; |
+ |
+ gfx::Point location_in_root = location_in_screen; |
+ aura::client::GetScreenPositionClient(current_root)-> |
+ ConvertPointFromScreen(current_root, &location_in_root); |
+ |
int grid_size = event_flags & ui::EF_CONTROL_DOWN ? |
0 : ash::Shell::GetInstance()->GetGridSize(); |
- gfx::Rect bounds(CalculateBoundsForDrag(details_, location, grid_size)); |
+ gfx::Rect bounds( |
+ CalculateBoundsForDrag(details_, location_in_root, grid_size)); |
if (bounds != details_.window->bounds()) { |
did_move_or_resize_ = true; |
details_.window->SetBounds(bounds); |