| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/unified_mouse_warp_controller.h" | 5 #include "ash/display/unified_mouse_warp_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/display/display_util.h" | 10 #include "ash/display/display_util.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 const gfx::Point& point_in_screen) { | 40 const gfx::Point& point_in_screen) { |
| 41 display::DisplayList mirroring_display_list = | 41 display::DisplayList mirroring_display_list = |
| 42 Shell::GetInstance() | 42 Shell::GetInstance() |
| 43 ->display_manager() | 43 ->display_manager() |
| 44 ->software_mirroring_display_list(); | 44 ->software_mirroring_display_list(); |
| 45 int index = | 45 int index = |
| 46 FindDisplayIndexContainingPoint(mirroring_display_list, point_in_screen); | 46 FindDisplayIndexContainingPoint(mirroring_display_list, point_in_screen); |
| 47 if (index < 0) | 47 if (index < 0) |
| 48 return nullptr; | 48 return nullptr; |
| 49 return GetMirroringAshWindowTreeHostForDisplayId( | 49 return GetMirroringAshWindowTreeHostForDisplayId( |
| 50 mirroring_display_list[index].id())->AsWindowTreeHost(); | 50 mirroring_display_list[index].id()) |
| 51 ->AsWindowTreeHost(); |
| 51 } | 52 } |
| 52 #endif | 53 #endif |
| 53 | 54 |
| 54 } // namespace | 55 } // namespace |
| 55 | 56 |
| 56 UnifiedMouseWarpController::UnifiedMouseWarpController() | 57 UnifiedMouseWarpController::UnifiedMouseWarpController() |
| 57 : current_cursor_display_id_(display::Display::kInvalidDisplayID), | 58 : current_cursor_display_id_(display::Display::kInvalidDisplayID), |
| 58 update_location_for_test_(false) {} | 59 update_location_for_test_(false) {} |
| 59 | 60 |
| 60 UnifiedMouseWarpController::~UnifiedMouseWarpController() { | 61 UnifiedMouseWarpController::~UnifiedMouseWarpController() {} |
| 61 } | |
| 62 | 62 |
| 63 bool UnifiedMouseWarpController::WarpMouseCursor(ui::MouseEvent* event) { | 63 bool UnifiedMouseWarpController::WarpMouseCursor(ui::MouseEvent* event) { |
| 64 // Mirroring windows are created asynchronously, so compute the edge | 64 // Mirroring windows are created asynchronously, so compute the edge |
| 65 // beounds when we received an event instead of in constructor. | 65 // beounds when we received an event instead of in constructor. |
| 66 if (first_edge_bounds_in_native_.IsEmpty()) | 66 if (first_edge_bounds_in_native_.IsEmpty()) |
| 67 ComputeBounds(); | 67 ComputeBounds(); |
| 68 | 68 |
| 69 aura::Window* target = static_cast<aura::Window*>(event->target()); | 69 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 70 gfx::Point point_in_unified_host = event->location(); | 70 gfx::Point point_in_unified_host = event->location(); |
| 71 ::wm::ConvertPointToScreen(target, &point_in_unified_host); | 71 ::wm::ConvertPointToScreen(target, &point_in_unified_host); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 in_first_edge ? display_list[0].id() : display_list[1].id(); | 163 in_first_edge ? display_list[0].id() : display_list[1].id(); |
| 164 AshWindowTreeHost* target_ash_host = | 164 AshWindowTreeHost* target_ash_host = |
| 165 GetMirroringAshWindowTreeHostForDisplayId( | 165 GetMirroringAshWindowTreeHostForDisplayId( |
| 166 in_first_edge ? display_list[1].id() : display_list[0].id()); | 166 in_first_edge ? display_list[1].id() : display_list[0].id()); |
| 167 MoveCursorTo(target_ash_host, point_in_unified_host, | 167 MoveCursorTo(target_ash_host, point_in_unified_host, |
| 168 update_mouse_location_now); | 168 update_mouse_location_now); |
| 169 return true; | 169 return true; |
| 170 } | 170 } |
| 171 | 171 |
| 172 } // namespace ash | 172 } // namespace ash |
| OLD | NEW |