| 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_util.h" | 9 #include "ash/display/display_util.h" |
| 10 #include "ash/display/mirror_window_controller.h" | 10 #include "ash/display/mirror_window_controller.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 #if defined(USE_OZONE) | 104 #if defined(USE_OZONE) |
| 105 // TODO(dnicoara): crbug.com/415680 Move cursor warping into Ozone once Ozone | 105 // TODO(dnicoara): crbug.com/415680 Move cursor warping into Ozone once Ozone |
| 106 // has access to the logical display layout. | 106 // has access to the logical display layout. |
| 107 // Native events in Ozone are in the native window coordinate system. We need | 107 // Native events in Ozone are in the native window coordinate system. We need |
| 108 // to translate them to get the global position. | 108 // to translate them to get the global position. |
| 109 aura::WindowTreeHost* host = | 109 aura::WindowTreeHost* host = |
| 110 FindMirroringWindowTreeHostFromScreenPoint(point_in_unified_host); | 110 FindMirroringWindowTreeHostFromScreenPoint(point_in_unified_host); |
| 111 if (!host) | 111 if (!host) |
| 112 return false; | 112 return false; |
| 113 point_in_native.Offset(host->GetBounds().x(), host->GetBounds().y()); | 113 point_in_native.Offset(host->GetBoundsInPixels().x(), |
| 114 host->GetBoundsInPixels().y()); |
| 114 #endif | 115 #endif |
| 115 | 116 |
| 116 return WarpMouseCursorInNativeCoords(point_in_native, point_in_unified_host, | 117 return WarpMouseCursorInNativeCoords(point_in_native, point_in_unified_host, |
| 117 update_location_for_test_); | 118 update_location_for_test_); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void UnifiedMouseWarpController::SetEnabled(bool enabled) { | 121 void UnifiedMouseWarpController::SetEnabled(bool enabled) { |
| 121 // Mouse warp shuld be always on in Unified mode. | 122 // Mouse warp shuld be always on in Unified mode. |
| 122 } | 123 } |
| 123 | 124 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 in_first_edge ? display_list[0].id() : display_list[1].id(); | 166 in_first_edge ? display_list[0].id() : display_list[1].id(); |
| 166 AshWindowTreeHost* target_ash_host = | 167 AshWindowTreeHost* target_ash_host = |
| 167 GetMirroringAshWindowTreeHostForDisplayId( | 168 GetMirroringAshWindowTreeHostForDisplayId( |
| 168 in_first_edge ? display_list[1].id() : display_list[0].id()); | 169 in_first_edge ? display_list[1].id() : display_list[0].id()); |
| 169 MoveCursorTo(target_ash_host, point_in_unified_host, | 170 MoveCursorTo(target_ash_host, point_in_unified_host, |
| 170 update_mouse_location_now); | 171 update_mouse_location_now); |
| 171 return true; | 172 return true; |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace ash | 175 } // namespace ash |
| OLD | NEW |