Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: monitor_reconfigure.h

Issue 6854002: Merge monitor_reconfigure into powerd. (Closed) Base URL: ssh://gitrw.chromium.org:9222/power_manager.git@master
Patch Set: Address second round of comments. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef POWER_MANAGER_MONITOR_RECONFIGURE_MAIN_H_
6 #define POWER_MANAGER_MONITOR_RECONFIGURE_MAIN_H_
7
8 #include <map>
9 #include <string>
10 #include <vector>
11
12 #include <X11/Xlib.h>
13 #include <X11/extensions/Xrandr.h>
14
15 #include "power_manager/backlight_controller.h"
16 #include "power_manager/resolution_selector.h"
17 #include "power_manager/udev_listener.h"
18
19 namespace power_manager {
20
21 class MonitorReconfigureMain;
22
23 // Callback class for udev events.
24 class MonitorReconfigureCallback : public UdevCallback {
25 public:
26 MonitorReconfigureCallback(MonitorReconfigureMain* monitor_reconfigure)
27 : monitor_reconfigure_(monitor_reconfigure) {}
28
29 void Run(GIOChannel* source, GIOCondition condition);
30 private:
31 MonitorReconfigureMain* monitor_reconfigure_;
32 };
tfarina 2011/04/14 15:11:41 DISALLOW_COPY_ ?
33
34 // MonitorReconfigureMain is the class responsible for setting the external
35 // monitor to the max resolution based on the modes supported by the native
36 // monitor and the external monitor.
37 class MonitorReconfigureMain {
38 public:
39 // We need a default constructor for unit tests.
40 MonitorReconfigureMain();
41 // |backlight_ctl| is a pointer to the backlight controller for the
42 // internal screen.
43 MonitorReconfigureMain(BacklightController* backlight_ctl);
44 ~MonitorReconfigureMain();
45
46 // Initialization.
47 bool Init();
48
49 // Main entry point.
50 void Run();
51
52 private:
53 // Initializes the |lcd_output_| and |external_output_| members.
54 void DetermineOutputs();
55
56 // Returns whether an external monitor is connected.
57 bool IsExternalMonitorConnected();
58
59 // Sorts |output_info|'s modes by decreasing number of pixels, storing the
60 // results in |modes_out|.
61 void SortModesByResolution(RROutput output,
62 std::vector<ResolutionSelector::Mode>* modes_out);
63
64 // Set the resolution for a particular device or for the screen.
65 bool SetDeviceResolution(RROutput output,
66 const XRROutputInfo* output_info,
67 const ResolutionSelector::Mode& resolution);
68 bool SetScreenResolution(const ResolutionSelector::Mode& resolution);
69
70 // Disable output to a device.
71 bool DisableDevice(const XRROutputInfo* output_info);
72
73 // Mapping between mode XIDs and mode information structures.
74 std::map<int, XRRModeInfo*> mode_map_;
75
76 // X Resources needed between functions.
77 Display* display_;
78 Window window_;
79 XRRScreenResources* screen_info_;
80
81 RROutput lcd_output_;
82 XRROutputInfo* lcd_output_info_;
83
84 RROutput external_output_;
85 XRROutputInfo* external_output_info_;
86
87 // Not owned.
88 BacklightController* backlight_ctl_;
89
90 // Callback for the Udev listener.
91 MonitorReconfigureCallback* callback_;
92
93 // Udev linstener.
94 UdevListener* listener_;
95
tfarina 2011/04/14 15:11:41 DISALLOW_COPY_AND_ASSING? If not, remove this empt
96 };
97
98 } // namespace power_manager
99
100 #endif // POWER_MANAGER_MONITOR_RECONFIGURE_MAIN_H_
OLDNEW
« no previous file with comments | « drm-tool.cc ('k') | monitor_reconfigure.cc » ('j') | monitor_reconfigure.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698