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

Unified Diff: monitor_reconfigure_main.cc

Issue 3410019: monitor_reconfig: Disable external output to avoid error. (Closed) Base URL: http://git.chromium.org/git/monitor_reconfig.git
Patch Set: Created 10 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 | « monitor_reconfigure_main.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: monitor_reconfigure_main.cc
diff --git a/monitor_reconfigure_main.cc b/monitor_reconfigure_main.cc
index b73e7eaa3ada95cef569f0a38d4c4f6b4dabe2fd..64c7058fdb4f9edb5b3362f808470728f57882ae 100644
--- a/monitor_reconfigure_main.cc
+++ b/monitor_reconfigure_main.cc
@@ -54,8 +54,16 @@ void MonitorReconfigureMain::Run() {
&screen_resolution));
SetDeviceResolution(lcd_output_->name, lcd_resolution);
+
+ // If there's no external output connected, disable the device before we try
+ // to set the screen resolution; otherwise xrandr will complain if we're
+ // trying to set the screen to a smaller size than what the now-unplugged
+ // device was using.
if (IsExternalMonitorConnected())
SetDeviceResolution(external_output_->name, external_resolution);
+ else
+ DisableDevice(external_output_->name);
+
SetScreenResolution(screen_resolution);
}
@@ -122,6 +130,13 @@ bool MonitorReconfigureMain::SetScreenResolution(
return system(command.c_str()) == 0;
}
+bool MonitorReconfigureMain::DisableDevice(const std::string& device_name) {
+ string command = StringPrintf("xrandr --output %s --off",
+ device_name.c_str());
+ LOG(INFO) << "Running " << command.c_str();
+ return system(command.c_str()) == 0;
+}
+
} // end namespace monitor_reconfig
int main(int argc, char** argv) {
« no previous file with comments | « monitor_reconfigure_main.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698