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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 ::wm::ConvertPointToScreen(target, &point_in_screen); | 133 ::wm::ConvertPointToScreen(target, &point_in_screen); |
134 | 134 |
135 // A native event may not exist in unit test. Generate the native point | 135 // A native event may not exist in unit test. Generate the native point |
136 // from the screen point instead. | 136 // from the screen point instead. |
137 if (!event->HasNativeEvent()) { | 137 if (!event->HasNativeEvent()) { |
138 if (!allow_non_native_event_) | 138 if (!allow_non_native_event_) |
139 return false; | 139 return false; |
140 aura::Window* target_root = target->GetRootWindow(); | 140 aura::Window* target_root = target->GetRootWindow(); |
141 gfx::Point point_in_native = point_in_screen; | 141 gfx::Point point_in_native = point_in_screen; |
142 ::wm::ConvertPointFromScreen(target_root, &point_in_native); | 142 ::wm::ConvertPointFromScreen(target_root, &point_in_native); |
143 target_root->GetHost()->ConvertPointToNativeScreen(&point_in_native); | 143 target_root->GetHost()->ConvertDIPToScreenInPixels(&point_in_native); |
144 return WarpMouseCursorInNativeCoords(point_in_native, point_in_screen, | 144 return WarpMouseCursorInNativeCoords(point_in_native, point_in_screen, |
145 true); | 145 true); |
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. |
(...skipping 63 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 |