| 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/extended_mouse_warp_controller.h" | 5 #include "ash/display/extended_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/shared_display_edge_indicator.h" | 10 #include "ash/display/shared_display_edge_indicator.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 146 } |
| 147 | 147 |
| 148 gfx::Point point_in_native = | 148 gfx::Point point_in_native = |
| 149 ui::EventSystemLocationFromNative(event->native_event()); | 149 ui::EventSystemLocationFromNative(event->native_event()); |
| 150 | 150 |
| 151 #if defined(USE_OZONE) | 151 #if defined(USE_OZONE) |
| 152 // TODO(dnicoara): crbug.com/415680 Move cursor warping into Ozone once Ozone | 152 // TODO(dnicoara): crbug.com/415680 Move cursor warping into Ozone once Ozone |
| 153 // has access to the logical display layout. | 153 // has access to the logical display layout. |
| 154 // Native events in Ozone are in the native window coordinate system. We need | 154 // Native events in Ozone are in the native window coordinate system. We need |
| 155 // to translate them to get the global position. | 155 // to translate them to get the global position. |
| 156 point_in_native.Offset(target->GetHost()->GetBounds().x(), | 156 point_in_native.Offset(target->GetHost()->GetBoundsInPixels().x(), |
| 157 target->GetHost()->GetBounds().y()); | 157 target->GetHost()->GetBoundsInPixels().y()); |
| 158 #endif | 158 #endif |
| 159 | 159 |
| 160 return WarpMouseCursorInNativeCoords(point_in_native, point_in_screen, false); | 160 return WarpMouseCursorInNativeCoords(point_in_native, point_in_screen, false); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void ExtendedMouseWarpController::SetEnabled(bool enabled) { | 163 void ExtendedMouseWarpController::SetEnabled(bool enabled) { |
| 164 enabled_ = enabled; | 164 enabled_ = enabled; |
| 165 } | 165 } |
| 166 | 166 |
| 167 void ExtendedMouseWarpController::AddWarpRegion( | 167 void ExtendedMouseWarpController::AddWarpRegion( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 if (drag_source_id == a.id()) | 217 if (drag_source_id == a.id()) |
| 218 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge); | 218 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge); |
| 219 else if (drag_source_id == b.id()) | 219 else if (drag_source_id == b.id()) |
| 220 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); | 220 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); |
| 221 } | 221 } |
| 222 | 222 |
| 223 return base::MakeUnique<WarpRegion>(a.id(), b.id(), a_edge, b_edge); | 223 return base::MakeUnique<WarpRegion>(a.id(), b.id(), a_edge, b_edge); |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace ash | 226 } // namespace ash |
| OLD | NEW |