OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/display/output_configurator.h" | 5 #include "chromeos/display/output_configurator.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 #include <X11/extensions/dpms.h> | 8 #include <X11/extensions/dpms.h> |
9 #include <X11/extensions/Xrandr.h> | 9 #include <X11/extensions/Xrandr.h> |
10 | 10 |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 // Primary is tiled first. | 652 // Primary is tiled first. |
653 state = STATE_DUAL_PRIMARY_ONLY; | 653 state = STATE_DUAL_PRIMARY_ONLY; |
654 } | 654 } |
655 } | 655 } |
656 } | 656 } |
657 } | 657 } |
658 | 658 |
659 return state; | 659 return state; |
660 } | 660 } |
661 | 661 |
662 bool OutputConfigurator::CycleDisplayMode() { | 662 bool OutputConfigurator::CycleDisplayMode(bool extended_desktop_enabled) { |
663 VLOG(1) << "CycleDisplayMode"; | 663 VLOG(1) << "CycleDisplayMode"; |
664 bool did_change = false; | 664 bool did_change = false; |
| 665 |
665 if (is_running_on_chrome_os_) { | 666 if (is_running_on_chrome_os_) { |
666 // Rules: | 667 // Rules: |
667 // - if there are 0 or 1 displays, do nothing and return false. | 668 // - if there are 0 or 1 displays, do nothing and return false. |
668 // - use y-coord of CRTCs to determine if we are mirror, primary-first, or | 669 // - use y-coord of CRTCs to determine if we are mirror, primary-first, or |
669 // secondary-first. The cycle order is: | 670 // secondary-first. The cycle order is: |
670 // mirror->primary->secondary->mirror. | 671 // mirror->primary->secondary->mirror. |
| 672 // Note: If the extended desktop is enabled, the cycle order becomes, |
| 673 // mirror->extended->mirror |
671 State new_state = STATE_INVALID; | 674 State new_state = STATE_INVALID; |
672 switch (output_state_) { | 675 switch (output_state_) { |
673 case STATE_DUAL_MIRROR: | 676 case STATE_DUAL_MIRROR: |
674 new_state = STATE_DUAL_PRIMARY_ONLY; | 677 new_state = STATE_DUAL_PRIMARY_ONLY; |
675 break; | 678 break; |
676 case STATE_DUAL_PRIMARY_ONLY: | 679 case STATE_DUAL_PRIMARY_ONLY: |
677 new_state = STATE_DUAL_SECONDARY_ONLY; | 680 if (extended_desktop_enabled) { |
| 681 if (mirror_supported_) |
| 682 new_state = STATE_DUAL_MIRROR; |
| 683 else |
| 684 new_state = STATE_INVALID; |
| 685 } else { |
| 686 new_state = STATE_DUAL_SECONDARY_ONLY; |
| 687 } |
678 break; | 688 break; |
679 case STATE_DUAL_SECONDARY_ONLY: | 689 case STATE_DUAL_SECONDARY_ONLY: |
680 new_state = mirror_supported_ ? | 690 new_state = mirror_supported_ ? |
681 STATE_DUAL_MIRROR : | 691 STATE_DUAL_MIRROR : |
682 STATE_DUAL_PRIMARY_ONLY; | 692 STATE_DUAL_PRIMARY_ONLY; |
683 break; | 693 break; |
684 default: | 694 default: |
685 // Do nothing - we aren't in a mode which we can rotate. | 695 // Do nothing - we aren't in a mode which we can rotate. |
686 break; | 696 break; |
687 } | 697 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 power_manager::kSetIsProjectingMethod); | 828 power_manager::kSetIsProjectingMethod); |
819 dbus::MessageWriter writer(&method_call); | 829 dbus::MessageWriter writer(&method_call); |
820 writer.AppendBool(is_projecting); | 830 writer.AppendBool(is_projecting); |
821 power_manager_proxy->CallMethod( | 831 power_manager_proxy->CallMethod( |
822 &method_call, | 832 &method_call, |
823 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 833 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
824 dbus::ObjectProxy::EmptyResponseCallback()); | 834 dbus::ObjectProxy::EmptyResponseCallback()); |
825 } | 835 } |
826 | 836 |
827 } // namespace chromeos | 837 } // namespace chromeos |
OLD | NEW |