| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/display/mouse_cursor_event_filter.h" | 5 #include "ash/display/mouse_cursor_event_filter.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/display/cursor_window_controller.h" | 9 #include "ash/display/cursor_window_controller.h" |
| 10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 aura::Window** dst_root) { | 462 aura::Window** dst_root) { |
| 463 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 463 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 464 *src_root = drag_source_root_ ? drag_source_root_ | 464 *src_root = drag_source_root_ ? drag_source_root_ |
| 465 : Shell::GetInstance()->GetPrimaryRootWindow(); | 465 : Shell::GetInstance()->GetPrimaryRootWindow(); |
| 466 *dst_root = root_windows[0] == *src_root ? root_windows[1] : root_windows[0]; | 466 *dst_root = root_windows[0] == *src_root ? root_windows[1] : root_windows[0]; |
| 467 } | 467 } |
| 468 | 468 |
| 469 bool MouseCursorEventFilter::WarpMouseCursorIfNecessaryForTest( | 469 bool MouseCursorEventFilter::WarpMouseCursorIfNecessaryForTest( |
| 470 aura::Window* target_root, | 470 aura::Window* target_root, |
| 471 const gfx::Point& point_in_screen) { | 471 const gfx::Point& point_in_screen) { |
| 472 if (enable_mouse_warp_in_native_coords) { | 472 if (!enable_mouse_warp_in_native_coords) |
| 473 gfx::Point native = point_in_screen; | |
| 474 wm::ConvertPointFromScreen(target_root, &native); | |
| 475 target_root->GetHost()->ConvertPointToNativeScreen(&native); | |
| 476 return WarpMouseCursorInNativeCoords(native, point_in_screen); | |
| 477 } else { | |
| 478 return WarpMouseCursorInScreenCoords(target_root, point_in_screen); | 473 return WarpMouseCursorInScreenCoords(target_root, point_in_screen); |
| 479 } | 474 gfx::Point native = point_in_screen; |
| 480 return true; | 475 wm::ConvertPointFromScreen(target_root, &native); |
| 476 target_root->GetHost()->ConvertPointToNativeScreen(&native); |
| 477 return WarpMouseCursorInNativeCoords(native, point_in_screen); |
| 481 } | 478 } |
| 482 | 479 |
| 483 } // namespace ash | 480 } // namespace ash |
| OLD | NEW |