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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // When the primary root window's display is removed, move the primary | 623 // When the primary root window's display is removed, move the primary |
624 // root to the other display. | 624 // root to the other display. |
625 if (primary_display_id == display.id()) { | 625 if (primary_display_id == display.id()) { |
626 // Temporarily store the primary root window in | 626 // Temporarily store the primary root window in |
627 // |primary_root_window_for_replace_| when replacing the display. | 627 // |primary_root_window_for_replace_| when replacing the display. |
628 if (window_tree_hosts_.size() == 0) { | 628 if (window_tree_hosts_.size() == 0) { |
629 primary_display_id = gfx::Display::kInvalidDisplayID; | 629 primary_display_id = gfx::Display::kInvalidDisplayID; |
630 primary_tree_host_for_replace_ = host_to_delete; | 630 primary_tree_host_for_replace_ = host_to_delete; |
631 return; | 631 return; |
632 } | 632 } |
633 DCHECK_EQ(1U, window_tree_hosts_.size()); | |
634 primary_display_id = ScreenUtil::GetSecondaryDisplay().id(); | 633 primary_display_id = ScreenUtil::GetSecondaryDisplay().id(); |
| 634 CHECK_NE(gfx::Display::kInvalidDisplayID, primary_display_id); |
| 635 |
| 636 CHECK_EQ(1U, window_tree_hosts_.count(primary_display_id)); |
| 637 |
635 AshWindowTreeHost* primary_host = host_to_delete; | 638 AshWindowTreeHost* primary_host = host_to_delete; |
636 | |
637 // Delete the other host instead. | 639 // Delete the other host instead. |
638 host_to_delete = window_tree_hosts_[primary_display_id]; | 640 host_to_delete = window_tree_hosts_[primary_display_id]; |
639 GetRootWindowSettings(GetWindow(host_to_delete))->display_id = display.id(); | 641 GetRootWindowSettings(GetWindow(host_to_delete))->display_id = display.id(); |
640 | 642 |
641 // Setup primary root. | 643 // Setup primary root. |
642 window_tree_hosts_[primary_display_id] = primary_host; | 644 window_tree_hosts_[primary_display_id] = primary_host; |
643 GetRootWindowSettings(GetWindow(primary_host))->display_id = | 645 GetRootWindowSettings(GetWindow(primary_host))->display_id = |
644 primary_display_id; | 646 primary_display_id; |
645 | 647 |
646 OnDisplayMetricsChanged( | 648 OnDisplayMetricsChanged( |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 std::string name = | 808 std::string name = |
807 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 809 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
808 gfx::AcceleratedWidget xwindow = | 810 gfx::AcceleratedWidget xwindow = |
809 root_windows[i]->GetHost()->GetAcceleratedWidget(); | 811 root_windows[i]->GetHost()->GetAcceleratedWidget(); |
810 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 812 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
811 } | 813 } |
812 #endif | 814 #endif |
813 } | 815 } |
814 | 816 |
815 } // namespace ash | 817 } // namespace ash |
OLD | NEW |