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

Side by Side Diff: ui/display/manager/display_layout.cc

Issue 2518233002: Enable setting primary display for 3+ displays (Closed)
Patch Set: Oshima's comment Created 4 years, 1 month 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/window_tree_host_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/display/manager/display_layout.h" 5 #include "ui/display/manager/display_layout.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 const DisplayLayout& layout) { 208 const DisplayLayout& layout) {
209 // The primary display should be in the list. 209 // The primary display should be in the list.
210 DCHECK(IsIdInList(layout.primary_id, list)); 210 DCHECK(IsIdInList(layout.primary_id, list));
211 211
212 // Unified mode, or mirror mode switched from unified mode, 212 // Unified mode, or mirror mode switched from unified mode,
213 // may not have the placement yet. 213 // may not have the placement yet.
214 if (layout.placement_list.size() == 0u) 214 if (layout.placement_list.size() == 0u)
215 return true; 215 return true;
216 216
217 bool has_primary_as_parent = false; 217 bool has_primary_as_parent = false;
218 int64_t id = 0; 218 int64_t prev_id = std::numeric_limits<int64_t>::min();
219
220 for (const auto& placement : layout.placement_list) { 219 for (const auto& placement : layout.placement_list) {
221 // Placements are sorted by display_id. 220 // Placements are sorted by display_id.
222 if (id >= placement.display_id) { 221 if (prev_id >= placement.display_id) {
223 LOG(ERROR) << "PlacementList must be sorted by display_id"; 222 LOG(ERROR) << "PlacementList must be sorted by display_id";
224 return false; 223 return false;
225 } 224 }
225 prev_id = placement.display_id;
226 if (placement.display_id == kInvalidDisplayId) { 226 if (placement.display_id == kInvalidDisplayId) {
227 LOG(ERROR) << "display_id is not initialized"; 227 LOG(ERROR) << "display_id is not initialized";
228 return false; 228 return false;
229 } 229 }
230 if (placement.parent_display_id == kInvalidDisplayId) { 230 if (placement.parent_display_id == kInvalidDisplayId) {
231 LOG(ERROR) << "display_parent_id is not initialized"; 231 LOG(ERROR) << "display_parent_id is not initialized";
232 return false; 232 return false;
233 } 233 }
234 if (placement.display_id == placement.parent_display_id) { 234 if (placement.display_id == placement.parent_display_id) {
235 LOG(ERROR) << "display_id must not be same as parent_display_id"; 235 LOG(ERROR) << "display_id must not be same as parent_display_id";
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 gfx::Insets insets = target_display->GetWorkAreaInsets(); 362 gfx::Insets insets = target_display->GetWorkAreaInsets();
363 target_display->set_bounds( 363 target_display->set_bounds(
364 gfx::Rect(new_target_origin, target_bounds.size())); 364 gfx::Rect(new_target_origin, target_bounds.size()));
365 target_display->UpdateWorkAreaFromInsets(insets); 365 target_display->UpdateWorkAreaFromInsets(insets);
366 366
367 return old_bounds != target_display->bounds(); 367 return old_bounds != target_display->bounds();
368 } 368 }
369 369
370 } // namespace display 370 } // namespace display
OLDNEW
« no previous file with comments | « ash/display/window_tree_host_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698