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

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

Issue 2799963003: Fix errors in display resolution change notifications (Closed)
Patch Set: Update commit message Created 3 years, 8 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 | « chrome/browser/ui/webui/options/chromeos/display_options_handler.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 (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 "ui/display/manager/display_manager.h" 5 #include "ui/display/manager/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 return false; 370 return false;
371 } 371 }
372 372
373 if (change_ui_scale) { 373 if (change_ui_scale) {
374 if (info.configured_ui_scale() == display_mode->ui_scale()) 374 if (info.configured_ui_scale() == display_mode->ui_scale())
375 return true; 375 return true;
376 info.set_configured_ui_scale(display_mode->ui_scale()); 376 info.set_configured_ui_scale(display_mode->ui_scale());
377 display_property_changed = true; 377 display_property_changed = true;
378 } else { 378 } else {
379 display_modes_[display_id] = *iter; 379 display_modes_[display_id] = *iter;
380 if (info.bounds_in_native().size() != display_mode->size()) 380 if (info.bounds_in_native().size() != display_mode->size()) {
381 // If resolution changes, then we can break right here. No need to
382 // continue to fill |display_info_list|, since we won't be
383 // synchronously updating the displays here.
381 resolution_changed = true; 384 resolution_changed = true;
385 break;
386 }
382 if (info.device_scale_factor() != display_mode->device_scale_factor()) { 387 if (info.device_scale_factor() != display_mode->device_scale_factor()) {
383 info.set_device_scale_factor(display_mode->device_scale_factor()); 388 info.set_device_scale_factor(display_mode->device_scale_factor());
384 display_property_changed = true; 389 display_property_changed = true;
385 } 390 }
386 } 391 }
387 } 392 }
388 display_info_list.push_back(info); 393 display_info_list.emplace_back(info);
389 } 394 }
390 if (display_property_changed) { 395
396 if (display_property_changed && !resolution_changed) {
397 // We shouldn't synchronously update the displays here if the resolution
398 // changed. This should happen asynchronously when configuration is
399 // triggered.
391 AddMirrorDisplayInfoIfAny(&display_info_list); 400 AddMirrorDisplayInfoIfAny(&display_info_list);
392 UpdateDisplaysWith(display_info_list); 401 UpdateDisplaysWith(display_info_list);
393 } 402 }
394 if (resolution_changed && IsInUnifiedMode()) { 403
404 if (resolution_changed && IsInUnifiedMode())
395 ReconfigureDisplays(); 405 ReconfigureDisplays();
396 #if defined(OS_CHROMEOS) 406 #if defined(OS_CHROMEOS)
397 } else if (resolution_changed && configure_displays_) { 407 else if (resolution_changed && configure_displays_)
398 delegate_->display_configurator()->OnConfigurationChanged(); 408 delegate_->display_configurator()->OnConfigurationChanged();
399 #endif 409 #endif // defined(OS_CHROMEOS)
400 } 410
401 return resolution_changed || display_property_changed; 411 return resolution_changed || display_property_changed;
402 } 412 }
403 413
404 void DisplayManager::RegisterDisplayProperty( 414 void DisplayManager::RegisterDisplayProperty(
405 int64_t display_id, 415 int64_t display_id,
406 Display::Rotation rotation, 416 Display::Rotation rotation,
407 float ui_scale, 417 float ui_scale,
408 const gfx::Insets* overscan_insets, 418 const gfx::Insets* overscan_insets,
409 const gfx::Size& resolution_in_pixels, 419 const gfx::Size& resolution_in_pixels,
410 float device_scale_factor, 420 float device_scale_factor,
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 } 1490 }
1481 1491
1482 const Display& DisplayManager::GetSecondaryDisplay() const { 1492 const Display& DisplayManager::GetSecondaryDisplay() const {
1483 CHECK_LE(2U, GetNumDisplays()); 1493 CHECK_LE(2U, GetNumDisplays());
1484 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id() 1494 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id()
1485 ? GetDisplayAt(1) 1495 ? GetDisplayAt(1)
1486 : GetDisplayAt(0); 1496 : GetDisplayAt(0);
1487 } 1497 }
1488 1498
1489 } // namespace display 1499 } // namespace display
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/chromeos/display_options_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698