Chromium Code Reviews| 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/display_controller.h" | 5 #include "ash/display/display_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 std::vector<DisplayInfo> display_info_list; | 529 std::vector<DisplayInfo> display_info_list; |
| 530 display_info_list.push_back(display_manager->GetDisplayInfo( | 530 display_info_list.push_back(display_manager->GetDisplayInfo( |
| 531 primary_display_id)); | 531 primary_display_id)); |
| 532 display_info_list.push_back(display_manager->GetDisplayInfo( | 532 display_info_list.push_back(display_manager->GetDisplayInfo( |
| 533 ScreenUtil::GetSecondaryDisplay().id())); | 533 ScreenUtil::GetSecondaryDisplay().id())); |
| 534 GetDisplayManager()->set_force_bounds_changed(true); | 534 GetDisplayManager()->set_force_bounds_changed(true); |
| 535 GetDisplayManager()->UpdateDisplays(display_info_list); | 535 GetDisplayManager()->UpdateDisplays(display_info_list); |
| 536 GetDisplayManager()->set_force_bounds_changed(false); | 536 GetDisplayManager()->set_force_bounds_changed(false); |
| 537 } | 537 } |
| 538 | 538 |
| 539 void DisplayController::EnsurePointerInDisplays() { | 539 void DisplayController::UpdateMouseLocationAfterDisplayChange() { |
|
pkotwicz
2015/02/24 18:38:08
I renamed this method because you mentioned in htt
| |
| 540 // If the mouse is currently on a display in native location, | 540 // If the mouse is currently on a display in native location, |
| 541 // use the same native location. Otherwise find the display closest | 541 // use the same native location. Otherwise find the display closest |
| 542 // to the current cursor location in screen coordinates. | 542 // to the current cursor location in screen coordinates. |
| 543 | 543 |
| 544 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); | 544 gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); |
| 545 gfx::Point target_location_in_native; | 545 gfx::Point target_location_in_native; |
| 546 int64 closest_distance_squared = -1; | 546 int64 closest_distance_squared = -1; |
| 547 DisplayManager* display_manager = GetDisplayManager(); | 547 DisplayManager* display_manager = GetDisplayManager(); |
| 548 | 548 |
| 549 aura::Window* dst_root_window = NULL; | 549 aura::Window* dst_root_window = NULL; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 // Update the primary_id in case the above call is | 744 // Update the primary_id in case the above call is |
| 745 // ignored. Happens when a) default layout's primary id | 745 // ignored. Happens when a) default layout's primary id |
| 746 // doesn't exist, or b) the primary_id has already been | 746 // doesn't exist, or b) the primary_id has already been |
| 747 // set to the same and didn't update it. | 747 // set to the same and didn't update it. |
| 748 layout_store->UpdatePrimaryDisplayId( | 748 layout_store->UpdatePrimaryDisplayId( |
| 749 pair, Shell::GetScreen()->GetPrimaryDisplay().id()); | 749 pair, Shell::GetScreen()->GetPrimaryDisplay().id()); |
| 750 } | 750 } |
| 751 } | 751 } |
| 752 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); | 752 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); |
| 753 UpdateHostWindowNames(); | 753 UpdateHostWindowNames(); |
| 754 EnsurePointerInDisplays(); | 754 UpdateMouseLocationAfterDisplayChange(); |
| 755 } | 755 } |
| 756 | 756 |
| 757 AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay( | 757 AshWindowTreeHost* DisplayController::AddWindowTreeHostForDisplay( |
| 758 const gfx::Display& display, | 758 const gfx::Display& display, |
| 759 const AshWindowTreeHostInitParams& init_params) { | 759 const AshWindowTreeHostInitParams& init_params) { |
| 760 static int host_count = 0; | 760 static int host_count = 0; |
| 761 const DisplayInfo& display_info = | 761 const DisplayInfo& display_info = |
| 762 GetDisplayManager()->GetDisplayInfo(display.id()); | 762 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 763 AshWindowTreeHostInitParams params_with_bounds(init_params); | 763 AshWindowTreeHostInitParams params_with_bounds(init_params); |
| 764 params_with_bounds.initial_bounds = display_info.bounds_in_native(); | 764 params_with_bounds.initial_bounds = display_info.bounds_in_native(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 810 std::string name = | 810 std::string name = |
| 811 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 811 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
| 812 gfx::AcceleratedWidget xwindow = | 812 gfx::AcceleratedWidget xwindow = |
| 813 root_windows[i]->GetHost()->GetAcceleratedWidget(); | 813 root_windows[i]->GetHost()->GetAcceleratedWidget(); |
| 814 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 814 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
| 815 } | 815 } |
| 816 #endif | 816 #endif |
| 817 } | 817 } |
| 818 | 818 |
| 819 } // namespace ash | 819 } // namespace ash |
| OLD | NEW |