Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_ | 5 #ifndef MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_ |
| 6 #define MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_ | 6 #define MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include <X11/Xlib.h> | 12 #include <X11/Xlib.h> |
| 13 #include <X11/extensions/Xrandr.h> | 13 #include <X11/extensions/Xrandr.h> |
| 14 | 14 |
| 15 #include "monitor_reconfig/resolution_selector.h" | 15 #include "monitor_reconfig/resolution_selector.h" |
| 16 | 16 |
| 17 namespace monitor_reconfig { | 17 namespace monitor_reconfig { |
| 18 | 18 |
| 19 // MonitorReconfigureMain is the class responsible for setting the external | 19 // MonitorReconfigureMain is the class responsible for setting the external |
| 20 // monitor to the max resolution based on the modes supported by the native | 20 // monitor to the max resolution based on the modes supported by the native |
| 21 // monitor and the external monitor | 21 // monitor and the external monitor. |
| 22 class MonitorReconfigureMain { | 22 class MonitorReconfigureMain { |
| 23 public: | 23 public: |
| 24 MonitorReconfigureMain(Display* display, XRRScreenResources* screen_info); | 24 MonitorReconfigureMain(Display* display, Window window, |
|
Daniel Erat
2011/03/24 23:02:11
nit: one argument per line
| |
| 25 XRRScreenResources* screen_info); | |
| 25 virtual ~MonitorReconfigureMain() {} | 26 virtual ~MonitorReconfigureMain() {} |
| 26 | 27 |
| 27 // Main entry point | 28 // Main entry point. |
| 28 void Run(); | 29 void Run(); |
| 29 | 30 |
| 30 private: | 31 private: |
| 31 // Initializes the |lcd_output_| and |external_output_| members. | 32 // Initializes the |lcd_output_| and |external_output_| members. |
| 32 void DetermineOutputs(); | 33 void DetermineOutputs(); |
| 33 | 34 |
| 34 // Returns whether an external monitor is connected | 35 // Returns whether an external monitor is connected. |
| 35 bool IsExternalMonitorConnected(); | 36 bool IsExternalMonitorConnected(); |
| 36 | 37 |
| 37 // Sorts |output_info|'s modes by decreasing number of pixels, storing the | 38 // Sorts |output_info|'s modes by decreasing number of pixels, storing the |
| 38 // results in |modes_out|. | 39 // results in |modes_out|. |
| 39 void SortModesByResolution(const XRROutputInfo& output_info, | 40 void SortModesByResolution(const RROutput output, |
|
Daniel Erat
2011/03/24 23:02:11
make RROutput a const reference instead of passing
marcheu
2011/03/24 23:17:53
It's an int, do we care?
Daniel Erat
2011/03/24 23:39:46
Okay, please remove the 'const' then.
| |
| 40 std::vector<ResolutionSelector::Mode>* modes_out); | 41 std::vector<ResolutionSelector::Mode>* modes_out); |
| 41 | 42 |
| 42 // Set the resolution for a particular device or for the screen. | 43 // Set the resolution for a particular device or for the screen. |
| 43 bool SetDeviceResolution(const std::string& device_name, | 44 bool SetDeviceResolution(const RROutput output, |
| 44 const std::string& resolution); | 45 const XRROutputInfo* output_info, |
| 45 bool SetScreenResolution(const std::string& resolution); | 46 const ResolutionSelector::Mode); |
|
Daniel Erat
2011/03/24 23:02:11
make the first and last arguments be const referen
| |
| 47 bool SetScreenResolution(const ResolutionSelector::Mode resolution); | |
|
Daniel Erat
2011/03/24 23:02:11
make this into a reference
| |
| 46 | 48 |
| 47 // Disable output to a device. | 49 // Disable output to a device. |
| 48 bool DisableDevice(const std::string& device_name); | 50 bool DisableDevice(const RROutput output, |
| 51 const XRROutputInfo* output_info); | |
|
Daniel Erat
2011/03/24 23:02:11
make these be references too (sorry for the repeti
| |
| 49 | 52 |
| 50 // Mapping between mode XIDs and mode information structures. | 53 // Mapping between mode XIDs and mode information structures. |
| 51 std::map<int, XRRModeInfo*> mode_map_; | 54 std::map<int, XRRModeInfo*> mode_map_; |
| 52 | 55 |
| 53 // X Resources needed between functions | 56 // X Resources needed between functions. |
| 54 Display* display_; | 57 Display* display_; |
| 58 Window window_; | |
| 55 XRRScreenResources* screen_info_; | 59 XRRScreenResources* screen_info_; |
| 56 XRROutputInfo* lcd_output_; | 60 |
| 57 XRROutputInfo* external_output_; | 61 RROutput lcd_output_; |
| 62 XRROutputInfo* lcd_output_info_; | |
| 63 | |
| 64 RROutput external_output_; | |
| 65 XRROutputInfo* external_output_info_; | |
| 58 }; | 66 }; |
| 59 | 67 |
| 60 } // namespace monitor_reconfig | 68 } // namespace monitor_reconfig |
| 61 | 69 |
| 62 #endif // MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_ | 70 #endif // MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_ |
| OLD | NEW |