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

Unified Diff: ash/display/display_manager.cc

Issue 12438016: Save display preference when all display configuration changes has been completed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: replace dcheck Created 7 years, 9 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 | « ash/display/display_controller_unittest.cc ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_manager.cc
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
index 257e62b6215eeabf55a5ec8e9a779287cfbe1699..5d821170dda03ea3946a3b0a2f5115683e8ab992 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -179,8 +179,11 @@ void DisplayManager::SetDisplayRotation(int64 display_id,
for (DisplayList::const_iterator iter = displays_.begin();
iter != displays_.end(); ++iter) {
DisplayInfo info = GetDisplayInfo(*iter);
- if (info.id() == display_id)
+ if (info.id() == display_id) {
+ if (info.rotation() == rotation)
+ return;
info.set_rotation(rotation);
+ }
display_info_list.push_back(info);
}
UpdateDisplays(display_info_list);
@@ -194,8 +197,11 @@ void DisplayManager::SetDisplayUIScale(int64 display_id,
for (DisplayList::const_iterator iter = displays_.begin();
iter != displays_.end(); ++iter) {
DisplayInfo info = GetDisplayInfo(*iter);
- if (info.id() == display_id)
+ if (info.id() == display_id) {
+ if (info.ui_scale() == ui_scale)
+ return;
info.set_ui_scale(ui_scale);
+ }
display_info_list.push_back(info);
}
UpdateDisplays(display_info_list);
@@ -217,9 +223,12 @@ bool DisplayManager::IsDisplayUIScalingEnabled() const {
// 2x density (currently Pixel).
int64 display_id = gfx::Display::InternalDisplayId();
#if defined(OS_CHROMEOS)
- // On linux desktop, allow ui scaling on the first dislpay.
- if (!base::chromeos::IsRunningOnChromeOS())
+ // On linux desktop, allow ui scaling on the first dislpay if an internal
+ // display isn't specified.
+ if (display_id == gfx::Display::kInvalidDisplayID &&
+ !base::chromeos::IsRunningOnChromeOS()) {
display_id = Shell::GetInstance()->display_manager()->first_display_id();
+ }
#endif
return GetDisplayForId(display_id).device_scale_factor() == 2.0f;
}
@@ -371,6 +380,12 @@ void DisplayManager::UpdateDisplays(
// being removed are accessed during shutting down the root.
displays_.insert(displays_.end(), removed_displays.begin(),
removed_displays.end());
+ DisplayController* display_controller =
+ Shell::GetInstance()->display_controller();
+ // |display_controller| is NULL during the bootstrap.
+ if (display_controller)
+ display_controller->NotifyDisplayConfigurationChanging();
+
for (DisplayList::const_reverse_iterator iter = removed_displays.rbegin();
iter != removed_displays.rend(); ++iter) {
Shell::GetInstance()->screen()->NotifyDisplayRemoved(displays_.back());
@@ -384,8 +399,10 @@ void DisplayManager::UpdateDisplays(
iter != changed_display_indices.end(); ++iter) {
Shell::GetInstance()->screen()->NotifyBoundsChanged(displays_[*iter]);
}
- EnsurePointerInDisplays();
+ if (display_controller)
+ display_controller->NotifyDisplayConfigurationChanged();
+ EnsurePointerInDisplays();
#if defined(USE_X11) && defined(OS_CHROMEOS)
if (!changed_display_indices.empty() && base::chromeos::IsRunningOnChromeOS())
ui::ClearX11DefaultRootWindow();
« no previous file with comments | « ash/display/display_controller_unittest.cc ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698