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 #ifndef CHROMEOS_MONITOR_OUTPUT_CONFIGURATOR_H_ | 5 #ifndef CHROMEOS_MONITOR_OUTPUT_CONFIGURATOR_H_ |
6 #define CHROMEOS_MONITOR_OUTPUT_CONFIGURATOR_H_ | 6 #define CHROMEOS_MONITOR_OUTPUT_CONFIGURATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 #include <X11/extensions/dpms.h> | 10 #include <X11/extensions/dpms.h> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // A helper to re-cache instance variable state and transition into the | 96 // A helper to re-cache instance variable state and transition into the |
97 // appropriate default state for the observed displays. | 97 // appropriate default state for the observed displays. |
98 bool RecacheAndUseDefaultState(); | 98 bool RecacheAndUseDefaultState(); |
99 | 99 |
100 // Checks the |primary_output_index_|, |secondary_output_index_|, and | 100 // Checks the |primary_output_index_|, |secondary_output_index_|, and |
101 // |mirror_supported_| to see how many displays are currently connected and | 101 // |mirror_supported_| to see how many displays are currently connected and |
102 // returns the state which is most appropriate as a default state for those | 102 // returns the state which is most appropriate as a default state for those |
103 // displays. | 103 // displays. |
104 State GetDefaultState() const; | 104 State GetDefaultState() const; |
105 | 105 |
| 106 // Called during start-up to determine what the current state of the displays |
| 107 // appears to be, by investigating how the outputs compare to the data stored |
| 108 // in |output_cache_|. Returns STATE_INVALID if the current display state |
| 109 // doesn't match any supported state. |output_cache_| must be up-to-date with |
| 110 // regards to the state of X or this method may return incorrect results. |
| 111 State InferCurrentState(Display* display, XRRScreenResources* screen) const; |
| 112 |
106 // This is detected by the constructor to determine whether or not we should | 113 // This is detected by the constructor to determine whether or not we should |
107 // be enabled. If we aren't running on ChromeOS, we can't assume that the | 114 // be enabled. If we aren't running on ChromeOS, we can't assume that the |
108 // Xrandr X11 extension is supported. | 115 // Xrandr X11 extension is supported. |
109 // If this flag is set to false, any attempts to change the output | 116 // If this flag is set to false, any attempts to change the output |
110 // configuration to immediately fail without changing the state. | 117 // configuration to immediately fail without changing the state. |
111 bool is_running_on_chrome_os_; | 118 bool is_running_on_chrome_os_; |
112 | 119 |
113 // The number of outputs in the output_cache_ array. | 120 // The number of outputs in the output_cache_ array. |
114 int output_count_; | 121 int output_count_; |
115 | 122 |
(...skipping 20 matching lines...) Expand all Loading... |
136 // The display state as derived from the outputs observed in |output_cache_|. | 143 // The display state as derived from the outputs observed in |output_cache_|. |
137 // This is used for rotating display modes. | 144 // This is used for rotating display modes. |
138 State output_state_; | 145 State output_state_; |
139 | 146 |
140 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); | 147 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
141 }; | 148 }; |
142 | 149 |
143 } // namespace chromeos | 150 } // namespace chromeos |
144 | 151 |
145 #endif // CHROMEOS_MONITOR_OUTPUT_CONFIGURATOR_H_ | 152 #endif // CHROMEOS_MONITOR_OUTPUT_CONFIGURATOR_H_ |
OLD | NEW |