Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: ash/display/window_tree_host_manager.cc

Issue 2525113002: Rename WindowTreeHost functions to indicate pixels/dips. (Closed)
Patch Set: DIP + rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 // exactly "closest" display, but good enough to pick one 522 // exactly "closest" display, but good enough to pick one
523 // appropriate (and there are at most two displays). 523 // appropriate (and there are at most two displays).
524 // We don't care about actual distance, only relative to other displays, so 524 // We don't care about actual distance, only relative to other displays, so
525 // using the LengthSquared() is cheaper than Length(). 525 // using the LengthSquared() is cheaper than Length().
526 526
527 int64_t distance_squared = (center - point_in_screen).LengthSquared(); 527 int64_t distance_squared = (center - point_in_screen).LengthSquared();
528 if (closest_distance_squared < 0 || 528 if (closest_distance_squared < 0 ||
529 closest_distance_squared > distance_squared) { 529 closest_distance_squared > distance_squared) {
530 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); 530 aura::Window* root_window = GetRootWindowForDisplayId(display.id());
531 ::wm::ConvertPointFromScreen(root_window, &center); 531 ::wm::ConvertPointFromScreen(root_window, &center);
532 root_window->GetHost()->ConvertPointToNativeScreen(&center); 532 root_window->GetHost()->ConvertPointFromDIPToNativeScreen(&center);
533 dst_root_window = root_window; 533 dst_root_window = root_window;
534 target_location_in_native = center; 534 target_location_in_native = center;
535 closest_distance_squared = distance_squared; 535 closest_distance_squared = distance_squared;
536 } 536 }
537 } 537 }
538 538
539 gfx::Point target_location_in_root = target_location_in_native; 539 gfx::Point target_location_in_root = target_location_in_native;
540 dst_root_window->GetHost()->ConvertPointFromNativeScreen( 540 dst_root_window->GetHost()->ConvertPointFromNativeScreenToDIP(
541 &target_location_in_root); 541 &target_location_in_root);
542 542
543 #if defined(USE_OZONE) 543 #if defined(USE_OZONE)
544 gfx::Point target_location_in_screen = target_location_in_root; 544 gfx::Point target_location_in_screen = target_location_in_root;
545 ::wm::ConvertPointToScreen(dst_root_window, &target_location_in_screen); 545 ::wm::ConvertPointToScreen(dst_root_window, &target_location_in_screen);
546 const display::Display& target_display = 546 const display::Display& target_display =
547 display_manager->FindDisplayContainingPoint(target_location_in_screen); 547 display_manager->FindDisplayContainingPoint(target_location_in_screen);
548 // If the original location isn't on any of new display, let ozone move 548 // If the original location isn't on any of new display, let ozone move
549 // the cursor. 549 // the cursor.
550 if (!target_display.is_valid()) 550 if (!target_display.is_valid())
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 display::Screen* screen = display::Screen::GetScreen(); 781 display::Screen* screen = display::Screen::GetScreen();
782 gfx::Point point_in_screen = screen->GetCursorScreenPoint(); 782 gfx::Point point_in_screen = screen->GetCursorScreenPoint();
783 cursor_location_in_screen_coords_for_restore_ = point_in_screen; 783 cursor_location_in_screen_coords_for_restore_ = point_in_screen;
784 784
785 display::Display display = screen->GetDisplayNearestPoint(point_in_screen); 785 display::Display display = screen->GetDisplayNearestPoint(point_in_screen);
786 cursor_display_id_for_restore_ = display.id(); 786 cursor_display_id_for_restore_ = display.id();
787 787
788 gfx::Point point_in_native = point_in_screen; 788 gfx::Point point_in_native = point_in_screen;
789 aura::Window* root_window = GetRootWindowForDisplayId(display.id()); 789 aura::Window* root_window = GetRootWindowForDisplayId(display.id());
790 ::wm::ConvertPointFromScreen(root_window, &point_in_native); 790 ::wm::ConvertPointFromScreen(root_window, &point_in_native);
791 root_window->GetHost()->ConvertPointToNativeScreen(&point_in_native); 791 root_window->GetHost()->ConvertPointFromDIPToNativeScreen(&point_in_native);
792 cursor_location_in_native_coords_for_restore_ = point_in_native; 792 cursor_location_in_native_coords_for_restore_ = point_in_native;
793 } 793 }
794 794
795 void WindowTreeHostManager::PostDisplayConfigurationChange( 795 void WindowTreeHostManager::PostDisplayConfigurationChange(
796 bool must_clear_window) { 796 bool must_clear_window) {
797 focus_activation_store_->Restore(); 797 focus_activation_store_->Restore();
798 798
799 display::DisplayManager* display_manager = GetDisplayManager(); 799 display::DisplayManager* display_manager = GetDisplayManager();
800 display::DisplayLayoutStore* layout_store = display_manager->layout_store(); 800 display::DisplayLayoutStore* layout_store = display_manager->layout_store();
801 if (display_manager->num_connected_displays() > 1) { 801 if (display_manager->num_connected_displays() > 1) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 SetDisplayPropertiesOnHost(ash_host, display); 895 SetDisplayPropertiesOnHost(ash_host, display);
896 896
897 #if defined(OS_CHROMEOS) 897 #if defined(OS_CHROMEOS)
898 if (switches::ConstrainPointerToRoot()) 898 if (switches::ConstrainPointerToRoot())
899 ash_host->ConfineCursorToRootWindow(); 899 ash_host->ConfineCursorToRootWindow();
900 #endif 900 #endif
901 return ash_host; 901 return ash_host;
902 } 902 }
903 903
904 } // namespace ash 904 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698