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

Unified Diff: ash/display/display_manager.cc

Issue 21297003: Add ability to set resolution on external display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adraddressed comment, adjusted test Created 7 years, 5 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.h ('k') | ash/display/display_util_x11.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 48fb914d0f9de50b1228b3a8467502d72539366a..5943f99b189657af4882dc9d3b7ddaa1e4059bcf 100644
--- a/ash/display/display_manager.cc
+++ b/ash/display/display_manager.cc
@@ -321,11 +321,24 @@ void DisplayManager::SetDisplayUIScale(int64 display_id,
UpdateDisplays(display_info_list);
}
+void DisplayManager::SetDisplayResolution(int64 display_id,
+ const gfx::Size& resolution) {
+ DCHECK_NE(gfx::Display::InternalDisplayId(), display_id);
+ if (gfx::Display::InternalDisplayId() == display_id)
+ return;
+ resolutions_[display_id] = resolution;
+#if defined(OS_CHROMEOS) && defined(USE_X11)
+ if (base::chromeos::IsRunningOnChromeOS())
+ Shell::GetInstance()->output_configurator()->ScheduleConfigureOutputs();
+#endif
+}
+
void DisplayManager::RegisterDisplayProperty(
int64 display_id,
gfx::Display::Rotation rotation,
float ui_scale,
- const gfx::Insets* overscan_insets) {
+ const gfx::Insets* overscan_insets,
+ const gfx::Size& resolution_in_pixels) {
if (display_info_.find(display_id) == display_info_.end()) {
display_info_[display_id] =
DisplayInfo(display_id, std::string(""), false);
@@ -337,6 +350,19 @@ void DisplayManager::RegisterDisplayProperty(
display_info_[display_id].set_ui_scale(ui_scale);
if (overscan_insets)
display_info_[display_id].SetOverscanInsets(*overscan_insets);
+ if (!resolution_in_pixels.IsEmpty())
+ resolutions_[display_id] = resolution_in_pixels;
+}
+
+bool DisplayManager::GetSelectedResolutionForDisplayId(
+ int64 id,
+ gfx::Size* resolution_out) const {
+ std::map<int64, gfx::Size>::const_iterator iter =
+ resolutions_.find(id);
+ if (iter == resolutions_.end())
+ return false;
+ *resolution_out = iter->second;
+ return true;
}
bool DisplayManager::IsDisplayRotationEnabled() const {
« no previous file with comments | « ash/display/display_manager.h ('k') | ash/display/display_util_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698