OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/window_tree_host_manager.h" | 5 #include "ash/display/window_tree_host_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 display_manager->FindDisplayContainingPoint(target_location_in_screen); | 508 display_manager->FindDisplayContainingPoint(target_location_in_screen); |
509 // If the original location isn't on any of new display, let ozone move | 509 // If the original location isn't on any of new display, let ozone move |
510 // the cursor. | 510 // the cursor. |
511 if (!target_display.is_valid()) | 511 if (!target_display.is_valid()) |
512 return; | 512 return; |
513 int64_t target_display_id = target_display.id(); | 513 int64_t target_display_id = target_display.id(); |
514 | 514 |
515 // Do not move the cursor if the cursor's location did not change. This avoids | 515 // Do not move the cursor if the cursor's location did not change. This avoids |
516 // moving (and showing) the cursor: | 516 // moving (and showing) the cursor: |
517 // - At startup. | 517 // - At startup. |
518 // - When the device is rotated in maximized mode. | 518 // - When the device is rotated in tablet mode. |
519 // |cursor_display_id_for_restore_| is checked to ensure that the cursor is | 519 // |cursor_display_id_for_restore_| is checked to ensure that the cursor is |
520 // moved when the cursor's native position does not change but the display | 520 // moved when the cursor's native position does not change but the display |
521 // that it is on has changed. This occurs when swapping the primary display. | 521 // that it is on has changed. This occurs when swapping the primary display. |
522 if (target_location_in_native != | 522 if (target_location_in_native != |
523 cursor_location_in_native_coords_for_restore_ || | 523 cursor_location_in_native_coords_for_restore_ || |
524 target_display_id != cursor_display_id_for_restore_) { | 524 target_display_id != cursor_display_id_for_restore_) { |
525 dst_root_window->MoveCursorTo(target_location_in_root); | 525 dst_root_window->MoveCursorTo(target_location_in_root); |
526 } else if (target_location_in_screen != | 526 } else if (target_location_in_screen != |
527 cursor_location_in_screen_coords_for_restore_) { | 527 cursor_location_in_screen_coords_for_restore_) { |
528 // The cursor's native position did not change but its screen position did | 528 // The cursor's native position did not change but its screen position did |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 857 |
858 window_tree_hosts_[display.id()] = ash_host; | 858 window_tree_hosts_[display.id()] = ash_host; |
859 SetDisplayPropertiesOnHost(ash_host, display); | 859 SetDisplayPropertiesOnHost(ash_host, display); |
860 | 860 |
861 if (switches::ConstrainPointerToRoot()) | 861 if (switches::ConstrainPointerToRoot()) |
862 ash_host->ConfineCursorToRootWindow(); | 862 ash_host->ConfineCursorToRootWindow(); |
863 return ash_host; | 863 return ash_host; |
864 } | 864 } |
865 | 865 |
866 } // namespace ash | 866 } // namespace ash |
OLD | NEW |