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_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 5 #ifndef CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
6 #define CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 6 #define CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/event_types.h" | 13 #include "base/event_types.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "base/timer.h" | 17 #include "base/timer.h" |
17 #include "chromeos/chromeos_export.h" | 18 #include "chromeos/chromeos_export.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 19 #include "third_party/cros_system_api/dbus/service_constants.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 RRMode mirror_mode; | 64 RRMode mirror_mode; |
64 | 65 |
65 int y; | 66 int y; |
66 int height; | 67 int height; |
67 | 68 |
68 bool is_internal; | 69 bool is_internal; |
69 bool is_aspect_preserving_scaling; | 70 bool is_aspect_preserving_scaling; |
70 | 71 |
71 // XInput device ID or 0 if this output isn't a touchscreen. | 72 // XInput device ID or 0 if this output isn't a touchscreen. |
72 int touch_device_id; | 73 int touch_device_id; |
| 74 |
| 75 // Display id for this output. |
| 76 int64 display_id; |
73 }; | 77 }; |
74 | 78 |
75 struct CoordinateTransformation { | 79 struct CoordinateTransformation { |
76 // Initialized to the identity transformation. | 80 // Initialized to the identity transformation. |
77 CoordinateTransformation(); | 81 CoordinateTransformation(); |
78 | 82 |
79 float x_scale; | 83 float x_scale; |
80 float x_offset; | 84 float x_offset; |
81 float y_scale; | 85 float y_scale; |
82 float y_offset; | 86 float y_offset; |
(...skipping 23 matching lines...) Expand all Loading... |
106 virtual void OnDisplayModeChangeFailed(OutputState failed_new_state) {} | 110 virtual void OnDisplayModeChangeFailed(OutputState failed_new_state) {} |
107 }; | 111 }; |
108 | 112 |
109 // Interface for classes that make decisions about which output state | 113 // Interface for classes that make decisions about which output state |
110 // should be used. | 114 // should be used. |
111 class StateController { | 115 class StateController { |
112 public: | 116 public: |
113 virtual ~StateController() {} | 117 virtual ~StateController() {} |
114 | 118 |
115 // Called when displays are detected. | 119 // Called when displays are detected. |
116 virtual OutputState GetStateForOutputs( | 120 virtual OutputState GetStateForDisplayIds( |
117 const std::vector<OutputInfo>& outputs) const = 0; | 121 const std::vector<int64>& display_ids) const = 0; |
118 }; | 122 }; |
119 | 123 |
120 // Interface for classes that perform actions on behalf of OutputController. | 124 // Interface for classes that perform actions on behalf of OutputController. |
121 class Delegate { | 125 class Delegate { |
122 public: | 126 public: |
123 virtual ~Delegate() {} | 127 virtual ~Delegate() {} |
124 | 128 |
125 virtual void SetPanelFittingEnabled(bool enabled) = 0; | 129 virtual void SetPanelFittingEnabled(bool enabled) = 0; |
126 | 130 |
127 // Initializes the XRandR extension, saving the base event ID to | 131 // Initializes the XRandR extension, saving the base event ID to |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 218 |
215 // Gap between screens so cursor at bottom of active display doesn't | 219 // Gap between screens so cursor at bottom of active display doesn't |
216 // partially appear on top of inactive display. Higher numbers guard | 220 // partially appear on top of inactive display. Higher numbers guard |
217 // against larger cursors, but also waste more memory. | 221 // against larger cursors, but also waste more memory. |
218 // For simplicity, this is hard-coded to avoid the complexity of always | 222 // For simplicity, this is hard-coded to avoid the complexity of always |
219 // determining the DPI of the screen and rationalizing which screen we | 223 // determining the DPI of the screen and rationalizing which screen we |
220 // need to use for the DPI calculation. | 224 // need to use for the DPI calculation. |
221 // See crbug.com/130188 for initial discussion. | 225 // See crbug.com/130188 for initial discussion. |
222 static const int kVerticalGap = 60; | 226 static const int kVerticalGap = 60; |
223 | 227 |
224 // Returns true if an output named |name| is an internal display. | |
225 static bool IsInternalOutputName(const std::string& name); | |
226 | |
227 OutputConfigurator(); | 228 OutputConfigurator(); |
228 virtual ~OutputConfigurator(); | 229 virtual ~OutputConfigurator(); |
229 | 230 |
230 OutputState output_state() const { return output_state_; } | 231 OutputState output_state() const { return output_state_; } |
231 DisplayPowerState power_state() const { return power_state_; } | 232 DisplayPowerState power_state() const { return power_state_; } |
232 | 233 |
233 void set_state_controller(StateController* controller) { | 234 void set_state_controller(StateController* controller) { |
234 state_controller_ = controller; | 235 state_controller_ = controller; |
235 } | 236 } |
236 | 237 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // The timer to delay configuring outputs. See also the comments in | 351 // The timer to delay configuring outputs. See also the comments in |
351 // Dispatch(). | 352 // Dispatch(). |
352 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; | 353 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; |
353 | 354 |
354 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); | 355 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
355 }; | 356 }; |
356 | 357 |
357 } // namespace chromeos | 358 } // namespace chromeos |
358 | 359 |
359 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 360 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
OLD | NEW |