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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 | 733 |
734 return success; | 734 return success; |
735 } | 735 } |
736 | 736 |
737 bool OutputConfigurator::SetDisplayMode(OutputState new_state) { | 737 bool OutputConfigurator::SetDisplayMode(OutputState new_state) { |
738 if (output_state_ == STATE_INVALID || | 738 if (output_state_ == STATE_INVALID || |
739 output_state_ == STATE_HEADLESS || | 739 output_state_ == STATE_HEADLESS || |
740 output_state_ == STATE_SINGLE) | 740 output_state_ == STATE_SINGLE) |
741 return false; | 741 return false; |
742 | 742 |
743 if (output_state_ == new_state) | |
744 return true; | |
745 | |
746 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 743 Display* display = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
747 CHECK(display != NULL); | 744 CHECK(display != NULL); |
748 XGrabServer(display); | 745 XGrabServer(display); |
749 Window window = DefaultRootWindow(display); | 746 Window window = DefaultRootWindow(display); |
750 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); | 747 XRRScreenResources* screen = GetScreenResourcesAndRecordUMA(display, window); |
751 CHECK(screen != NULL); | 748 CHECK(screen != NULL); |
752 | 749 |
753 bool did_change = false; | 750 bool did_change = false; |
754 OutputSnapshot outputs[2] = { {0}, {0} }; | 751 OutputSnapshot outputs[2] = { {0}, {0} }; |
755 connected_output_count_ = | 752 connected_output_count_ = |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 // distinguish internal display. | 853 // distinguish internal display. |
857 return false; | 854 return false; |
858 } | 855 } |
859 | 856 |
860 void OutputConfigurator::NotifyOnDisplayChanged() { | 857 void OutputConfigurator::NotifyOnDisplayChanged() { |
861 notification_timer_.reset(); | 858 notification_timer_.reset(); |
862 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged()); | 859 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayModeChanged()); |
863 } | 860 } |
864 | 861 |
865 } // namespace chromeos | 862 } // namespace chromeos |
OLD | NEW |