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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 56 |
56 int y; | 57 int y; |
57 int height; | 58 int height; |
58 | 59 |
59 bool is_internal; | 60 bool is_internal; |
60 bool is_aspect_preserving_scaling; | 61 bool is_aspect_preserving_scaling; |
61 | 62 |
62 // XInput device ID or 0 if this output isn't a touchscreen. | 63 // XInput device ID or 0 if this output isn't a touchscreen. |
63 int touch_device_id; | 64 int touch_device_id; |
64 | 65 |
65 // TODO(oshima): Move xrandr related functions to here | 66 // Display id for this output. |
66 // from ui/base/x and replace this with display id. | 67 int64 display_id; |
67 int index; | 68 |
| 69 bool has_display_id; |
68 }; | 70 }; |
69 | 71 |
70 struct CoordinateTransformation { | 72 struct CoordinateTransformation { |
71 // Initialized to the identity transformation. | 73 // Initialized to the identity transformation. |
72 CoordinateTransformation(); | 74 CoordinateTransformation(); |
73 | 75 |
74 float x_scale; | 76 float x_scale; |
75 float x_offset; | 77 float x_offset; |
76 float y_scale; | 78 float y_scale; |
77 float y_offset; | 79 float y_offset; |
(...skipping 23 matching lines...) Expand all Loading... |
101 virtual void OnDisplayModeChangeFailed(OutputState failed_new_state) {} | 103 virtual void OnDisplayModeChangeFailed(OutputState failed_new_state) {} |
102 }; | 104 }; |
103 | 105 |
104 // Interface for classes that make decisions about which output state | 106 // Interface for classes that make decisions about which output state |
105 // should be used. | 107 // should be used. |
106 class StateController { | 108 class StateController { |
107 public: | 109 public: |
108 virtual ~StateController() {} | 110 virtual ~StateController() {} |
109 | 111 |
110 // Called when displays are detected. | 112 // Called when displays are detected. |
111 virtual OutputState GetStateForOutputs( | 113 virtual OutputState GetStateForDisplayIds( |
112 const std::vector<OutputSnapshot>& outputs) const = 0; | 114 const std::vector<int64>& display_ids) const = 0; |
113 }; | 115 }; |
114 | 116 |
115 // Interface for classes that perform actions on behalf of OutputController. | 117 // Interface for classes that perform actions on behalf of OutputController. |
116 class Delegate { | 118 class Delegate { |
117 public: | 119 public: |
118 virtual ~Delegate() {} | 120 virtual ~Delegate() {} |
119 | 121 |
120 virtual void SetPanelFittingEnabled(bool enabled) = 0; | 122 virtual void SetPanelFittingEnabled(bool enabled) = 0; |
121 | 123 |
122 // Initializes the XRandR extension, saving the base event ID to | 124 // Initializes the XRandR extension, saving the base event ID to |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 211 |
210 // Gap between screens so cursor at bottom of active display doesn't | 212 // Gap between screens so cursor at bottom of active display doesn't |
211 // partially appear on top of inactive display. Higher numbers guard | 213 // partially appear on top of inactive display. Higher numbers guard |
212 // against larger cursors, but also waste more memory. | 214 // against larger cursors, but also waste more memory. |
213 // For simplicity, this is hard-coded to avoid the complexity of always | 215 // For simplicity, this is hard-coded to avoid the complexity of always |
214 // determining the DPI of the screen and rationalizing which screen we | 216 // determining the DPI of the screen and rationalizing which screen we |
215 // need to use for the DPI calculation. | 217 // need to use for the DPI calculation. |
216 // See crbug.com/130188 for initial discussion. | 218 // See crbug.com/130188 for initial discussion. |
217 static const int kVerticalGap = 60; | 219 static const int kVerticalGap = 60; |
218 | 220 |
219 // Returns true if an output named |name| is an internal display. | |
220 static bool IsInternalOutputName(const std::string& name); | |
221 | |
222 OutputConfigurator(); | 221 OutputConfigurator(); |
223 virtual ~OutputConfigurator(); | 222 virtual ~OutputConfigurator(); |
224 | 223 |
225 OutputState output_state() const { return output_state_; } | 224 OutputState output_state() const { return output_state_; } |
226 DisplayPowerState power_state() const { return power_state_; } | 225 DisplayPowerState power_state() const { return power_state_; } |
227 | 226 |
228 void set_state_controller(StateController* controller) { | 227 void set_state_controller(StateController* controller) { |
229 state_controller_ = controller; | 228 state_controller_ = controller; |
230 } | 229 } |
231 | 230 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; | 346 scoped_ptr<base::OneShotTimer<OutputConfigurator> > configure_timer_; |
348 | 347 |
349 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); | 348 DISALLOW_COPY_AND_ASSIGN(OutputConfigurator); |
350 }; | 349 }; |
351 | 350 |
352 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList; | 351 typedef std::vector<OutputConfigurator::OutputSnapshot> OutputSnapshotList; |
353 | 352 |
354 } // namespace chromeos | 353 } // namespace chromeos |
355 | 354 |
356 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ | 355 #endif // CHROMEOS_DISPLAY_OUTPUT_CONFIGURATOR_H_ |
OLD | NEW |