Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: ash/wm/toplevel_window_event_filter.cc

Issue 10835047: Allow the cursor to warp even when a window is dragged (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: do not move modal windows to another display Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/toplevel_window_event_filter.cc
diff --git a/ash/wm/toplevel_window_event_filter.cc b/ash/wm/toplevel_window_event_filter.cc
index 8d0ee8d38a220e00acce834ab668794968431b25..3a328e4897452abb3a1b745770871da5ed4e77ea 100644
--- a/ash/wm/toplevel_window_event_filter.cc
+++ b/ash/wm/toplevel_window_event_filter.cc
@@ -14,6 +14,7 @@
#include "base/message_loop.h"
#include "base/run_loop.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/event.h"
#include "ui/aura/root_window.h"
@@ -43,7 +44,7 @@ gfx::Point ConvertPointToParent(aura::Window* window,
return result;
}
-}
+} // namespace
ToplevelWindowEventFilter::ToplevelWindowEventFilter(aura::Window* owner)
: in_move_loop_(false),
@@ -270,8 +271,20 @@ bool ToplevelWindowEventFilter::HandleDrag(aura::Window* target,
if (!window_resizer_.get())
return false;
- window_resizer_->Drag(ConvertPointToParent(target, event->location()),
- event->flags());
+
+ gfx::Point location_in_root(event->location());
+ aura::Window::ConvertPointToWindow(
+ target, target->GetRootWindow(), &location_in_root);
+
+ // Get the root window where the cursor is currently on, then pass the cursor
+ // location in the screen coordinates to |window_resizer_|.
+ std::pair<aura::RootWindow*, gfx::Point> actual_location =
+ Shell::GetInstance()->NormalizeLocationInDragEvent(
+ target->GetRootWindow(), location_in_root);
+ aura::client::GetScreenPositionClient(actual_location.first)->
+ ConvertPointToScreen(actual_location.first, &actual_location.second);
+
+ window_resizer_->Drag(actual_location.second, event->flags());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698