| 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_manager.h" | 9 #include "ash/display/display_manager.h" |
| 10 #include "ash/display/display_util.h" | 10 #include "ash/display/display_util.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return b_indicator_bounds_; | 98 return b_indicator_bounds_; |
| 99 } | 99 } |
| 100 | 100 |
| 101 ExtendedMouseWarpController::ExtendedMouseWarpController( | 101 ExtendedMouseWarpController::ExtendedMouseWarpController( |
| 102 aura::Window* drag_source) | 102 aura::Window* drag_source) |
| 103 : drag_source_root_(drag_source), allow_non_native_event_(false) { | 103 : drag_source_root_(drag_source), allow_non_native_event_(false) { |
| 104 ash::DisplayManager* display_manager = | 104 ash::DisplayManager* display_manager = |
| 105 Shell::GetInstance()->display_manager(); | 105 Shell::GetInstance()->display_manager(); |
| 106 int64_t drag_source_id = drag_source ? GetDisplayIdFromWindow(drag_source) | 106 int64_t drag_source_id = drag_source ? GetDisplayIdFromWindow(drag_source) |
| 107 : display::Display::kInvalidDisplayID; | 107 : display::Display::kInvalidDisplayID; |
| 108 display::DisplayList display_list = display_manager->active_display_list(); | 108 display::Displays display_list = display_manager->active_display_list(); |
| 109 // Try to create a Warp region for all possible two displays combination. | 109 // Try to create a Warp region for all possible two displays combination. |
| 110 // The following code does it by poping the last element in the list | 110 // The following code does it by poping the last element in the list |
| 111 // and then pairing with remaining displays in the list, until the list | 111 // and then pairing with remaining displays in the list, until the list |
| 112 // becomes single element. | 112 // becomes single element. |
| 113 while (display_list.size() > 1) { | 113 while (display_list.size() > 1) { |
| 114 display::Display display = display_list.back(); | 114 display::Display display = display_list.back(); |
| 115 display_list.pop_back(); | 115 display_list.pop_back(); |
| 116 for (const display::Display& peer : display_list) { | 116 for (const display::Display& peer : display_list) { |
| 117 std::unique_ptr<WarpRegion> region = | 117 std::unique_ptr<WarpRegion> region = |
| 118 CreateWarpRegion(display, peer, drag_source_id); | 118 CreateWarpRegion(display, peer, drag_source_id); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 if (drag_source_id == a.id()) | 218 if (drag_source_id == a.id()) |
| 219 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge); | 219 AdjustSourceEdgeBounds(a.bounds(), snap_barrier, &a_edge); |
| 220 else if (drag_source_id == b.id()) | 220 else if (drag_source_id == b.id()) |
| 221 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); | 221 AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); |
| 222 } | 222 } |
| 223 | 223 |
| 224 return base::MakeUnique<WarpRegion>(a.id(), b.id(), a_edge, b_edge); | 224 return base::MakeUnique<WarpRegion>(a.id(), b.id(), a_edge, b_edge); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace ash | 227 } // namespace ash |
| OLD | NEW |