Chromium Code Reviews| 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 |
| 11 // Xlib defines Status as int which causes our include of dbus/bus.h to fail | 11 // Xlib defines Status as int which causes our include of dbus/bus.h to fail |
| 12 // when it tries to name an enum Status. Thus, we need to undefine it (note | 12 // when it tries to name an enum Status. Thus, we need to undefine it (note |
| 13 // that this will cause a problem if code needs to use the Status type). | 13 // that this will cause a problem if code needs to use the Status type). |
| 14 // RootWindow causes similar problems in that there is a Chromium type with that | 14 // RootWindow causes similar problems in that there is a Chromium type with that |
| 15 // name. | 15 // name. |
| 16 #undef Status | 16 #undef Status |
| 17 #undef RootWindow | 17 #undef RootWindow |
| 18 | 18 |
| 19 #include "ash/display/display_controller.h" | |
| 19 #include "base/chromeos/chromeos_version.h" | 20 #include "base/chromeos/chromeos_version.h" |
| 20 #include "base/logging.h" | 21 #include "base/logging.h" |
| 21 #include "base/message_pump_aurax11.h" | 22 #include "base/message_pump_aurax11.h" |
| 22 #include "base/metrics/histogram.h" | 23 #include "base/metrics/histogram.h" |
| 23 #include "base/perftimer.h" | 24 #include "base/perftimer.h" |
| 24 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
| 25 #include "dbus/bus.h" | 26 #include "dbus/bus.h" |
| 26 #include "dbus/exported_object.h" | 27 #include "dbus/exported_object.h" |
| 27 #include "dbus/message.h" | 28 #include "dbus/message.h" |
| 28 #include "dbus/object_path.h" | 29 #include "dbus/object_path.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 } | 656 } |
| 656 } | 657 } |
| 657 } | 658 } |
| 658 | 659 |
| 659 return state; | 660 return state; |
| 660 } | 661 } |
| 661 | 662 |
| 662 bool OutputConfigurator::CycleDisplayMode() { | 663 bool OutputConfigurator::CycleDisplayMode() { |
| 663 VLOG(1) << "CycleDisplayMode"; | 664 VLOG(1) << "CycleDisplayMode"; |
| 664 bool did_change = false; | 665 bool did_change = false; |
| 666 | |
| 667 // The next state to go into if the current state is dual primary. | |
| 668 State next_state_from_dual_primary = STATE_DUAL_SECONDARY_ONLY; | |
| 669 if (ash::internal::DisplayController::IsExtendedDesktopEnabled()) { | |
|
oshima
2012/07/25 23:44:20
/chromeos can't depend on /ash.Can you let ash swi
rkc
2012/07/25 23:59:37
Done.
| |
| 670 if (mirror_supported_) { | |
| 671 next_state_from_dual_primary = STATE_DUAL_MIRROR; | |
| 672 } else { | |
| 673 // In case mirror is not supported, stay in the | |
| 674 // extended desktop primary display. | |
| 675 next_state_from_dual_primary = STATE_INVALID; | |
| 676 } | |
| 677 } | |
| 678 | |
| 665 if (is_running_on_chrome_os_) { | 679 if (is_running_on_chrome_os_) { |
| 666 // Rules: | 680 // Rules: |
| 667 // - if there are 0 or 1 displays, do nothing and return false. | 681 // - 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 | 682 // - use y-coord of CRTCs to determine if we are mirror, primary-first, or |
| 669 // secondary-first. The cycle order is: | 683 // secondary-first. The cycle order is: |
| 670 // mirror->primary->secondary->mirror. | 684 // mirror->primary->secondary->mirror. |
| 671 State new_state = STATE_INVALID; | 685 State new_state = STATE_INVALID; |
| 672 switch (output_state_) { | 686 switch (output_state_) { |
| 673 case STATE_DUAL_MIRROR: | 687 case STATE_DUAL_MIRROR: |
| 674 new_state = STATE_DUAL_PRIMARY_ONLY; | 688 new_state = STATE_DUAL_PRIMARY_ONLY; |
| 675 break; | 689 break; |
| 676 case STATE_DUAL_PRIMARY_ONLY: | 690 case STATE_DUAL_PRIMARY_ONLY: |
| 677 new_state = STATE_DUAL_SECONDARY_ONLY; | 691 new_state = next_state_from_dual_primary; |
| 678 break; | 692 break; |
| 679 case STATE_DUAL_SECONDARY_ONLY: | 693 case STATE_DUAL_SECONDARY_ONLY: |
| 680 new_state = mirror_supported_ ? | 694 new_state = mirror_supported_ ? |
| 681 STATE_DUAL_MIRROR : | 695 STATE_DUAL_MIRROR : |
| 682 STATE_DUAL_PRIMARY_ONLY; | 696 STATE_DUAL_PRIMARY_ONLY; |
| 683 break; | 697 break; |
| 684 default: | 698 default: |
| 685 // Do nothing - we aren't in a mode which we can rotate. | 699 // Do nothing - we aren't in a mode which we can rotate. |
| 686 break; | 700 break; |
| 687 } | 701 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 power_manager::kSetIsProjectingMethod); | 832 power_manager::kSetIsProjectingMethod); |
| 819 dbus::MessageWriter writer(&method_call); | 833 dbus::MessageWriter writer(&method_call); |
| 820 writer.AppendBool(is_projecting); | 834 writer.AppendBool(is_projecting); |
| 821 power_manager_proxy->CallMethod( | 835 power_manager_proxy->CallMethod( |
| 822 &method_call, | 836 &method_call, |
| 823 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 837 dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 824 dbus::ObjectProxy::EmptyResponseCallback()); | 838 dbus::ObjectProxy::EmptyResponseCallback()); |
| 825 } | 839 } |
| 826 | 840 |
| 827 } // namespace chromeos | 841 } // namespace chromeos |
| OLD | NEW |