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

Unified Diff: ash/display/display_util.cc

Issue 1361763003: Ignore UI scaling when internal display isn't active (in docked mode, for example) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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_manager_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_util.cc
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index 4c4bf7cdd747b05e9c0a6843a18ee4a52c09b2d8..7c887be819d27a0371a6cc025be66b9df7fcb033 100644
--- a/ash/display/display_util.cc
+++ b/ash/display/display_util.cc
@@ -173,8 +173,11 @@ bool GetDisplayModeForResolution(const DisplayInfo& info,
bool GetDisplayModeForNextUIScale(const DisplayInfo& info,
bool up,
DisplayMode* out) {
- if (!gfx::Display::IsInternalDisplayId(info.id()))
+ DisplayManager* display_manager = Shell::GetInstance()->display_manager();
+ if (!display_manager->IsActiveDisplayId(info.id()) ||
+ !gfx::Display::IsInternalDisplayId(info.id())) {
return false;
+ }
const std::vector<DisplayMode>& modes = info.display_modes();
ScaleComparator comparator(info.configured_ui_scale());
auto iter = std::find_if(modes.begin(), modes.end(), comparator);
@@ -201,6 +204,10 @@ bool GetDisplayModeForNextResolution(const DisplayInfo& info,
bool SetDisplayUIScale(int64 id, float ui_scale) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
+ if (!display_manager->IsActiveDisplayId(id) ||
+ !gfx::Display::IsInternalDisplayId(id)) {
+ return false;
+ }
const DisplayInfo& info = display_manager->GetDisplayInfo(id);
DisplayMode mode;
if (!GetDisplayModeForUIScale(info, ui_scale, &mode))
« no previous file with comments | « ash/display/display_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698