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 | |
666 // The next state to go into if the current state is dual primary. | |
667 State next_state_from_dual_primary = STATE_DUAL_SECONDARY_ONLY; | |
668 if (extended_desktop_enabled) { | |
669 if (mirror_supported_) { | |
670 next_state_from_dual_primary = STATE_DUAL_MIRROR; | |
671 } else { | |
672 // In case mirror is not supported, stay in the | |
673 // extended desktop primary display. | |
674 next_state_from_dual_primary = STATE_INVALID; | |
675 } | |
676 } | |
Josh Horwich
2012/07/26 00:18:26
Would this be easier to follow if you just put it
rkc
2012/07/26 00:32:52
The ?:'s seemed kinda ugly so I moved it in the sw
| |
677 | |
665 if (is_running_on_chrome_os_) { | 678 if (is_running_on_chrome_os_) { |
666 // Rules: | 679 // Rules: |
667 // - if there are 0 or 1 displays, do nothing and return false. | 680 // - 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 | 681 // - use y-coord of CRTCs to determine if we are mirror, primary-first, or |
669 // secondary-first. The cycle order is: | 682 // secondary-first. The cycle order is: |
670 // mirror->primary->secondary->mirror. | 683 // mirror->primary->secondary->mirror. |
oshima
2012/07/26 00:11:06
can you update the comment?
rkc
2012/07/26 00:12:48
Done.
| |
671 State new_state = STATE_INVALID; | 684 State new_state = STATE_INVALID; |
672 switch (output_state_) { | 685 switch (output_state_) { |
673 case STATE_DUAL_MIRROR: | 686 case STATE_DUAL_MIRROR: |
674 new_state = STATE_DUAL_PRIMARY_ONLY; | 687 new_state = STATE_DUAL_PRIMARY_ONLY; |
675 break; | 688 break; |
676 case STATE_DUAL_PRIMARY_ONLY: | 689 case STATE_DUAL_PRIMARY_ONLY: |
677 new_state = STATE_DUAL_SECONDARY_ONLY; | 690 new_state = next_state_from_dual_primary; |
678 break; | 691 break; |
679 case STATE_DUAL_SECONDARY_ONLY: | 692 case STATE_DUAL_SECONDARY_ONLY: |
680 new_state = mirror_supported_ ? | 693 new_state = mirror_supported_ ? |
681 STATE_DUAL_MIRROR : | 694 STATE_DUAL_MIRROR : |
682 STATE_DUAL_PRIMARY_ONLY; | 695 STATE_DUAL_PRIMARY_ONLY; |
683 break; | 696 break; |
684 default: | 697 default: |
685 // Do nothing - we aren't in a mode which we can rotate. | 698 // Do nothing - we aren't in a mode which we can rotate. |
686 break; | 699 break; |
687 } | 700 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
818 power_manager::kSetIsProjectingMethod); | 831 power_manager::kSetIsProjectingMethod); |
819 dbus::MessageWriter writer(&method_call); | 832 dbus::MessageWriter writer(&method_call); |
820 writer.AppendBool(is_projecting); | 833 writer.AppendBool(is_projecting); |
821 power_manager_proxy->CallMethod( | 834 power_manager_proxy->CallMethod( |
822 &method_call, | 835 &method_call, |
823 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 836 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
824 dbus::ObjectProxy::EmptyResponseCallback()); | 837 dbus::ObjectProxy::EmptyResponseCallback()); |
825 } | 838 } |
826 | 839 |
827 } // namespace chromeos | 840 } // namespace chromeos |
OLD | NEW |