Commit fd2b1ad7 authored by rkc@chromium.org's avatar rkc@chromium.org

Fix display switching for extended displays.

Currently when we switch between displays with extended displays turned on, the sequence is,
Mirrored -> Extended -> Extended (reversed) -> Mirrorer.

Change this to switch only between extended and mirrored displays if the extended display flag is enabled,
i.e.,
Mirrorer -> Extended -> Mirrored.


R=oshima@chromium.org
BUG=137727
TEST=Tested on a ChromeOS device with a secondary display to confirm that the inteded sequence is followed on switching displays.


Review URL: https://chromiumcodereview.appspot.com/10829026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148842 0039d316-1c4b-4281-b951-d872f2087c98
parent 4c98e90e
...@@ -407,7 +407,8 @@ bool AcceleratorController::PerformAction(int action, ...@@ -407,7 +407,8 @@ bool AcceleratorController::PerformAction(int action,
case TOGGLE_SPOKEN_FEEDBACK: case TOGGLE_SPOKEN_FEEDBACK:
return HandleToggleSpokenFeedback(); return HandleToggleSpokenFeedback();
case CYCLE_DISPLAY_MODE: case CYCLE_DISPLAY_MODE:
ash::Shell::GetInstance()->output_configurator()->CycleDisplayMode(); ash::Shell::GetInstance()->output_configurator()->CycleDisplayMode(
internal::DisplayController::IsExtendedDesktopEnabled());
return true; return true;
#endif #endif
case OPEN_FEEDBACK_PAGE: case OPEN_FEEDBACK_PAGE:
......
...@@ -659,22 +659,32 @@ State OutputConfigurator::InferCurrentState(Display* display, ...@@ -659,22 +659,32 @@ State OutputConfigurator::InferCurrentState(Display* display,
return state; return state;
} }
bool OutputConfigurator::CycleDisplayMode() { bool OutputConfigurator::CycleDisplayMode(bool extended_desktop_enabled) {
VLOG(1) << "CycleDisplayMode"; VLOG(1) << "CycleDisplayMode";
bool did_change = false; bool did_change = false;
if (is_running_on_chrome_os_) { if (is_running_on_chrome_os_) {
// Rules: // Rules:
// - if there are 0 or 1 displays, do nothing and return false. // - if there are 0 or 1 displays, do nothing and return false.
// - use y-coord of CRTCs to determine if we are mirror, primary-first, or // - use y-coord of CRTCs to determine if we are mirror, primary-first, or
// secondary-first. The cycle order is: // secondary-first. The cycle order is:
// mirror->primary->secondary->mirror. // mirror->primary->secondary->mirror.
// Note: If the extended desktop is enabled, the cycle order becomes,
// mirror->extended->mirror
State new_state = STATE_INVALID; State new_state = STATE_INVALID;
switch (output_state_) { switch (output_state_) {
case STATE_DUAL_MIRROR: case STATE_DUAL_MIRROR:
new_state = STATE_DUAL_PRIMARY_ONLY; new_state = STATE_DUAL_PRIMARY_ONLY;
break; break;
case STATE_DUAL_PRIMARY_ONLY: case STATE_DUAL_PRIMARY_ONLY:
new_state = STATE_DUAL_SECONDARY_ONLY; if (extended_desktop_enabled) {
if (mirror_supported_)
new_state = STATE_DUAL_MIRROR;
else
new_state = STATE_INVALID;
} else {
new_state = STATE_DUAL_SECONDARY_ONLY;
}
break; break;
case STATE_DUAL_SECONDARY_ONLY: case STATE_DUAL_SECONDARY_ONLY:
new_state = mirror_supported_ ? new_state = mirror_supported_ ?
......
...@@ -65,7 +65,7 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher { ...@@ -65,7 +65,7 @@ class CHROMEOS_EXPORT OutputConfigurator : public MessageLoop::Dispatcher {
// Called when the user hits ctrl-F4 to request a display mode change. // Called when the user hits ctrl-F4 to request a display mode change.
// This method should only return false if it was called in a single-head or // This method should only return false if it was called in a single-head or
// headless mode. // headless mode.
bool CycleDisplayMode(); bool CycleDisplayMode(bool extended_desktop_enabled);
// Called when powerd notifies us that some set of displays should be turned // Called when powerd notifies us that some set of displays should be turned
// on or off. This requires enabling or disabling the CRTC associated with // on or off. This requires enabling or disabling the CRTC associated with
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment