| 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 <utility> | 10 #include <utility> |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 window_tree_hosts_[new_primary_display.id()] = primary_host; | 444 window_tree_hosts_[new_primary_display.id()] = primary_host; |
| 445 GetRootWindowSettings(GetWindow(primary_host))->display_id = | 445 GetRootWindowSettings(GetWindow(primary_host))->display_id = |
| 446 new_primary_display.id(); | 446 new_primary_display.id(); |
| 447 | 447 |
| 448 window_tree_hosts_[old_primary_display.id()] = non_primary_host; | 448 window_tree_hosts_[old_primary_display.id()] = non_primary_host; |
| 449 GetRootWindowSettings(GetWindow(non_primary_host))->display_id = | 449 GetRootWindowSettings(GetWindow(non_primary_host))->display_id = |
| 450 old_primary_display.id(); | 450 old_primary_display.id(); |
| 451 | 451 |
| 452 primary_display_id = new_primary_display.id(); | 452 primary_display_id = new_primary_display.id(); |
| 453 GetDisplayManager()->layout_store()->UpdatePrimaryDisplayId( | 453 GetDisplayManager()->layout_store()->UpdatePrimaryDisplayId( |
| 454 display_manager->GetCurrentDisplayIdPair(), primary_display_id); | 454 display_manager->GetCurrentDisplayIdList(), primary_display_id); |
| 455 | 455 |
| 456 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host), | 456 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host), |
| 457 old_primary_display.GetWorkAreaInsets()); | 457 old_primary_display.GetWorkAreaInsets()); |
| 458 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(non_primary_host), | 458 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(non_primary_host), |
| 459 new_primary_display.GetWorkAreaInsets()); | 459 new_primary_display.GetWorkAreaInsets()); |
| 460 | 460 |
| 461 // Update the dispay manager with new display info. | 461 // Update the dispay manager with new display info. |
| 462 GetDisplayManager()->set_force_bounds_changed(true); | 462 GetDisplayManager()->set_force_bounds_changed(true); |
| 463 GetDisplayManager()->UpdateDisplays(); | 463 GetDisplayManager()->UpdateDisplays(); |
| 464 GetDisplayManager()->set_force_bounds_changed(false); | 464 GetDisplayManager()->set_force_bounds_changed(false); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 root_window->GetHost()->ConvertPointToNativeScreen(&point_in_native); | 756 root_window->GetHost()->ConvertPointToNativeScreen(&point_in_native); |
| 757 cursor_location_in_native_coords_for_restore_ = point_in_native; | 757 cursor_location_in_native_coords_for_restore_ = point_in_native; |
| 758 } | 758 } |
| 759 | 759 |
| 760 void WindowTreeHostManager::PostDisplayConfigurationChange() { | 760 void WindowTreeHostManager::PostDisplayConfigurationChange() { |
| 761 focus_activation_store_->Restore(); | 761 focus_activation_store_->Restore(); |
| 762 | 762 |
| 763 DisplayManager* display_manager = GetDisplayManager(); | 763 DisplayManager* display_manager = GetDisplayManager(); |
| 764 DisplayLayoutStore* layout_store = display_manager->layout_store(); | 764 DisplayLayoutStore* layout_store = display_manager->layout_store(); |
| 765 if (display_manager->num_connected_displays() > 1) { | 765 if (display_manager->num_connected_displays() > 1) { |
| 766 DisplayIdPair pair = display_manager->GetCurrentDisplayIdPair(); | 766 DisplayIdList list = display_manager->GetCurrentDisplayIdList(); |
| 767 DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(pair); | 767 DisplayLayout layout = layout_store->GetRegisteredDisplayLayout(list); |
| 768 layout_store->UpdateMultiDisplayState( | 768 layout_store->UpdateMultiDisplayState( |
| 769 pair, display_manager->IsInMirrorMode(), layout.default_unified); | 769 list, display_manager->IsInMirrorMode(), layout.default_unified); |
| 770 | 770 |
| 771 if (gfx::Screen::GetScreen()->GetNumDisplays() > 1) { | 771 if (gfx::Screen::GetScreen()->GetNumDisplays() > 1) { |
| 772 int64_t primary_id = layout.primary_id; | 772 int64_t primary_id = layout.primary_id; |
| 773 SetPrimaryDisplayId(primary_id == gfx::Display::kInvalidDisplayID | 773 SetPrimaryDisplayId( |
| 774 ? pair.first | 774 primary_id == gfx::Display::kInvalidDisplayID ? list[0] : primary_id); |
| 775 : primary_id); | |
| 776 // Update the primary_id in case the above call is | 775 // Update the primary_id in case the above call is |
| 777 // ignored. Happens when a) default layout's primary id | 776 // ignored. Happens when a) default layout's primary id |
| 778 // doesn't exist, or b) the primary_id has already been | 777 // doesn't exist, or b) the primary_id has already been |
| 779 // set to the same and didn't update it. | 778 // set to the same and didn't update it. |
| 780 layout_store->UpdatePrimaryDisplayId( | 779 layout_store->UpdatePrimaryDisplayId( |
| 781 pair, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); | 780 list, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); |
| 782 } | 781 } |
| 783 } | 782 } |
| 784 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); | 783 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); |
| 785 UpdateMouseLocationAfterDisplayChange(); | 784 UpdateMouseLocationAfterDisplayChange(); |
| 786 } | 785 } |
| 787 | 786 |
| 788 ui::EventDispatchDetails WindowTreeHostManager::DispatchKeyEventPostIME( | 787 ui::EventDispatchDetails WindowTreeHostManager::DispatchKeyEventPostIME( |
| 789 ui::KeyEvent* event) { | 788 ui::KeyEvent* event) { |
| 790 // Getting the active root window to dispatch the event. This isn't | 789 // Getting the active root window to dispatch the event. This isn't |
| 791 // significant as the event will be sent to the window resolved by | 790 // significant as the event will be sent to the window resolved by |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 SetDisplayPropertiesOnHost(ash_host, display); | 834 SetDisplayPropertiesOnHost(ash_host, display); |
| 836 | 835 |
| 837 #if defined(OS_CHROMEOS) | 836 #if defined(OS_CHROMEOS) |
| 838 if (switches::ConstrainPointerToRoot()) | 837 if (switches::ConstrainPointerToRoot()) |
| 839 ash_host->ConfineCursorToRootWindow(); | 838 ash_host->ConfineCursorToRootWindow(); |
| 840 #endif | 839 #endif |
| 841 return ash_host; | 840 return ash_host; |
| 842 } | 841 } |
| 843 | 842 |
| 844 } // namespace ash | 843 } // namespace ash |
| OLD | NEW |