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

Unified Diff: chromeos/display/output_configurator.cc

Issue 10989084: Handles the failures of output state change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « chromeos/display/output_configurator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/display/output_configurator.cc
diff --git a/chromeos/display/output_configurator.cc b/chromeos/display/output_configurator.cc
index 66a5b17601dbbe6e411cd19e90dd68635b581add..710575eb9ab0f0c6f2d6a866fc7e4865fbce0d44 100644
--- a/chromeos/display/output_configurator.cc
+++ b/chromeos/display/output_configurator.cc
@@ -661,6 +661,9 @@ bool OutputConfigurator::CycleDisplayMode() {
XRRFreeScreenResources(screen);
XUngrabServer(display);
+
+ if (!did_change)
+ FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChangeFailed());
return did_change;
}
@@ -737,6 +740,9 @@ bool OutputConfigurator::SetDisplayMode(OutputState new_state) {
output_state_ == STATE_SINGLE)
return false;
+ if (output_state_ == new_state)
+ return true;
+
Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay();
CHECK(display != NULL);
XGrabServer(display);
@@ -744,6 +750,7 @@ bool OutputConfigurator::SetDisplayMode(OutputState new_state) {
XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window);
CHECK(screen != NULL);
+ bool did_change = false;
OutputSnapshot outputs[2] = { {0}, {0} };
connected_output_count_ =
GetDualOutputs(display, screen, &outputs[0], &outputs[1]);
@@ -754,10 +761,14 @@ bool OutputConfigurator::SetDisplayMode(OutputState new_state) {
outputs,
connected_output_count_)) {
output_state_ = new_state;
+ did_change = true;
}
XRRFreeScreenResources(screen);
XUngrabServer(display);
+
+ if (!did_change)
oshima 2012/10/02 07:53:02 if (output_state_ != new_state)
Jun Mukai 2012/10/02 20:55:00 Done.
+ FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChangeFailed());
return true;
}
« no previous file with comments | « chromeos/display/output_configurator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698