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

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

Issue 1133323002: Close mirroring window only when necessary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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
« no previous file with comments | « ash/display/display_manager.h ('k') | ash/display/mirror_window_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 ": Multiple display test does not work on Windows bots. Please " 666 ": Multiple display test does not work on Windows bots. Please "
667 "skip (don't disable) the test using SupportsMultipleDisplays()"; 667 "skip (don't disable) the test using SupportsMultipleDisplays()";
668 #endif 668 #endif
669 669
670 DisplayInfoList new_display_info_list = updated_display_info_list; 670 DisplayInfoList new_display_info_list = updated_display_info_list;
671 std::sort(active_display_list_.begin(), active_display_list_.end(), 671 std::sort(active_display_list_.begin(), active_display_list_.end(),
672 DisplaySortFunctor()); 672 DisplaySortFunctor());
673 std::sort(new_display_info_list.begin(), 673 std::sort(new_display_info_list.begin(),
674 new_display_info_list.end(), 674 new_display_info_list.end(),
675 DisplayInfoSortFunctor()); 675 DisplayInfoSortFunctor());
676
677 CreateSoftwareMirroringDisplayInfo(&new_display_info_list);
678
676 // Close the mirroring window if any here to avoid creating two compositor on 679 // Close the mirroring window if any here to avoid creating two compositor on
677 // one display. 680 // one display.
678 if (delegate_) 681 if (delegate_)
679 delegate_->CloseMirroringDisplay(); 682 delegate_->CloseMirroringDisplayIfNotNecessary();
680
681 CreateSoftwareMirroringDisplay(&new_display_info_list);
682 683
683 DisplayList new_displays; 684 DisplayList new_displays;
684 DisplayList removed_displays; 685 DisplayList removed_displays;
685 std::map<size_t, uint32_t> display_changes; 686 std::map<size_t, uint32_t> display_changes;
686 std::vector<size_t> added_display_indices; 687 std::vector<size_t> added_display_indices;
687 688
688 DisplayList::iterator curr_iter = active_display_list_.begin(); 689 DisplayList::iterator curr_iter = active_display_list_.begin();
689 DisplayInfoList::const_iterator new_info_iter = new_display_info_list.begin(); 690 DisplayInfoList::const_iterator new_info_iter = new_display_info_list.begin();
690 691
691 while (curr_iter != active_display_list_.end() || 692 while (curr_iter != active_display_list_.end() ||
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 } 1077 }
1077 } 1078 }
1078 1079
1079 void DisplayManager::UpdateInternalDisplayModeListForTest() { 1080 void DisplayManager::UpdateInternalDisplayModeListForTest() {
1080 if (display_info_.count(gfx::Display::InternalDisplayId()) == 0) 1081 if (display_info_.count(gfx::Display::InternalDisplayId()) == 0)
1081 return; 1082 return;
1082 DisplayInfo* info = &display_info_[gfx::Display::InternalDisplayId()]; 1083 DisplayInfo* info = &display_info_[gfx::Display::InternalDisplayId()];
1083 SetInternalDisplayModeList(info); 1084 SetInternalDisplayModeList(info);
1084 } 1085 }
1085 1086
1086 void DisplayManager::CreateSoftwareMirroringDisplay( 1087 void DisplayManager::CreateSoftwareMirroringDisplayInfo(
1087 DisplayInfoList* display_info_list) { 1088 DisplayInfoList* display_info_list) {
1088 // Use the internal display or 1st as the mirror source, then scale 1089 // Use the internal display or 1st as the mirror source, then scale
1089 // the root window so that it matches the external display's 1090 // the root window so that it matches the external display's
1090 // resolution. This is necessary in order for scaling to work while 1091 // resolution. This is necessary in order for scaling to work while
1091 // mirrored. 1092 // mirrored.
1092 if (display_info_list->size() == 2) { 1093 if (display_info_list->size() == 2) {
1093 switch (multi_display_mode_) { 1094 switch (multi_display_mode_) {
1094 case MIRRORING: { 1095 case MIRRORING: {
1095 bool zero_is_source = 1096 bool zero_is_source =
1096 first_display_id_ == (*display_info_list)[0].id() || 1097 first_display_id_ == (*display_info_list)[0].id() ||
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 gfx::Rect(new_secondary_origin, secondary_bounds.size())); 1315 gfx::Rect(new_secondary_origin, secondary_bounds.size()));
1315 secondary_display->UpdateWorkAreaFromInsets(insets); 1316 secondary_display->UpdateWorkAreaFromInsets(insets);
1316 } 1317 }
1317 1318
1318 void DisplayManager::RunPendingTasksForTest() { 1319 void DisplayManager::RunPendingTasksForTest() {
1319 if (!software_mirroring_display_list_.empty()) 1320 if (!software_mirroring_display_list_.empty())
1320 base::RunLoop().RunUntilIdle(); 1321 base::RunLoop().RunUntilIdle();
1321 } 1322 }
1322 1323
1323 } // namespace ash 1324 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.h ('k') | ash/display/mirror_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698