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

Unified Diff: ui/display/manager/display_manager.cc

Issue 2573673003: Detect and fix overlapping displays (Closed)
Patch Set: Nits Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/display/manager/display_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/manager/display_manager.cc
diff --git a/ui/display/manager/display_manager.cc b/ui/display/manager/display_manager.cc
index ed785262305214a58cba544e1bb72136782411d3..68b7abf0427134e5ce1e66c160347380af3767cd 100644
--- a/ui/display/manager/display_manager.cc
+++ b/ui/display/manager/display_manager.cc
@@ -208,6 +208,11 @@ const DisplayLayout& DisplayManager::GetCurrentDisplayLayout() const {
return layout;
}
+const DisplayLayout& DisplayManager::GetCurrentResolvedDisplayLayout() const {
+ return current_resolved_layout_ ? *current_resolved_layout_
+ : GetCurrentDisplayLayout();
+}
+
DisplayIdList DisplayManager::GetCurrentDisplayIdList() const {
if (IsInUnifiedMode()) {
return CreateDisplayIdList(software_mirroring_display_list_);
@@ -246,7 +251,8 @@ void DisplayManager::SetLayoutForCurrentDisplays(
// TODO(oshima): Call UpdateDisplays instead.
std::vector<int64_t> updated_ids;
- ApplyDisplayLayout(GetCurrentDisplayLayout(), &active_display_list_,
+ current_resolved_layout_ = GetCurrentDisplayLayout().Copy();
+ ApplyDisplayLayout(current_resolved_layout_.get(), &active_display_list_,
&updated_ids);
for (int64_t id : updated_ids) {
NotifyMetricsChanged(GetDisplayForId(id),
@@ -1380,7 +1386,8 @@ void DisplayManager::UpdateNonPrimaryDisplayBoundsForLayout(
// display_list does not have translation set, so ApplyDisplayLayout cannot
// provide accurate change information. We'll find the changes after the call.
- ApplyDisplayLayout(layout, display_list, nullptr);
+ current_resolved_layout_ = layout.Copy();
+ ApplyDisplayLayout(current_resolved_layout_.get(), display_list, nullptr);
size_t num_displays = display_list->size();
for (size_t index = 0; index < num_displays; ++index) {
const Display& display = (*display_list)[index];
@@ -1400,11 +1407,17 @@ void DisplayManager::CreateMirrorWindowIfAny() {
delegate_->CreateOrUpdateMirroringDisplay(list);
}
-void DisplayManager::ApplyDisplayLayout(const DisplayLayout& layout,
+void DisplayManager::ApplyDisplayLayout(DisplayLayout* layout,
Displays* display_list,
std::vector<int64_t>* updated_ids) {
- layout.ApplyToDisplayList(display_list, updated_ids,
- kMinimumOverlapForInvalidOffset);
+ if (multi_display_mode_ == UNIFIED) {
+ // Applying the layout in unified mode doesn't make sense, since there's no
+ // layout.
+ return;
+ }
+
+ layout->ApplyToDisplayList(display_list, updated_ids,
+ kMinimumOverlapForInvalidOffset);
}
void DisplayManager::RunPendingTasksForTest() {
« no previous file with comments | « ui/display/manager/display_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698