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

Unified Diff: ash/drag_drop/drag_drop_tracker.cc

Issue 10948020: Convert native mouse locations to the locations in screen coordinate in RootWindowHostLinux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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
« no previous file with comments | « ash/display/mouse_cursor_event_filter_unittest.cc ('k') | ash/drag_drop/drag_drop_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/drag_drop/drag_drop_tracker.cc
diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc
index d71c6984428f47ddee7c35430a5bd36d7bd33fb8..0de110ae9d5f28c6a81ad19c5adfcb40b5d7c4aa 100644
--- a/ash/drag_drop/drag_drop_tracker.cc
+++ b/ash/drag_drop/drag_drop_tracker.cc
@@ -40,27 +40,34 @@ DragDropTracker::~DragDropTracker() {
}
aura::Window* DragDropTracker::GetTarget(const ui::LocatedEvent& event) {
- std::pair<aura::RootWindow*, gfx::Point> pair =
- ash::wm::GetRootWindowRelativeToWindow(capture_window_.get(),
- event.location());
- return pair.first->GetEventHandlerForPoint(pair.second);
+ DCHECK(capture_window_.get());
+ gfx::Point location_in_screen = event.location();
+ wm::ConvertPointToScreen(capture_window_.get(),
+ &location_in_screen);
+ aura::RootWindow* root_window_at_point =
+ wm::GetRootWindowAt(location_in_screen);
+ gfx::Point location_in_root = location_in_screen;
+ wm::ConvertPointFromScreen(root_window_at_point, &location_in_root);
+ return root_window_at_point->GetEventHandlerForPoint(location_in_root);
}
ui::MouseEvent* DragDropTracker::ConvertMouseEvent(
aura::Window* target,
const ui::MouseEvent& event) {
DCHECK(capture_window_.get());
- std::pair<aura::RootWindow*, gfx::Point> location_pair =
- ash::wm::GetRootWindowRelativeToWindow(capture_window_.get(),
- event.location());
- aura::Window::ConvertPointToTarget(location_pair.first, target,
- &location_pair.second);
- std::pair<aura::RootWindow*, gfx::Point> root_location_pair =
- ash::wm::GetRootWindowRelativeToWindow(capture_window_->GetRootWindow(),
- event.root_location());
+ gfx::Point target_location = event.location();
+ aura::Window::ConvertPointToTarget(capture_window_.get(), target,
+ &target_location);
+ gfx::Point location_in_screen = event.location();
+ ash::wm::ConvertPointToScreen(capture_window_.get(), &location_in_screen);
+ gfx::Point target_root_location = event.root_location();
+ aura::Window::ConvertPointToTarget(
+ capture_window_->GetRootWindow(),
+ ash::wm::GetRootWindowAt(location_in_screen),
+ &target_root_location);
return new ui::MouseEvent(event.type(),
- location_pair.second,
- root_location_pair.second,
+ target_location,
+ target_root_location,
event.flags());
}
« no previous file with comments | « ash/display/mouse_cursor_event_filter_unittest.cc ('k') | ash/drag_drop/drag_drop_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698