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

Side by Side Diff: src/platform/monitor_reconfig/monitor_reconfigure_main.h

Issue 1619018: monitor_reconfigure: Clean up build and style. (Closed)
Patch Set: update header guard name Created 10 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
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 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_MAIN_H_ 5 #ifndef MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_
6 #define MONITOR_RECONFIGURE_MAIN_H_ 6 #define MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_
7
8 #include <map>
7 9
8 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
9 #include <X11/extensions/Xrandr.h> 11 #include <X11/extensions/Xrandr.h>
10 #include <stdlib.h>
11 #include <string>
12 #include <cstring>
13 #include <iostream>
14 #include <cstdio>
15 #include <map>
16 12
17 namespace chromeos_monitor_reconfig { 13 namespace monitor_reconfig {
18 14
19 // MonitorReconfigureMain is the class responsible for setting the external 15 // MonitorReconfigureMain is the class responsible for setting the external
20 // monitor to the max resolution based on the modes supported by the native 16 // monitor to the max resolution based on the modes supported by the native
21 // monitor and the external monitor 17 // monitor and the external monitor
22 class MonitorReconfigureMain { 18 class MonitorReconfigureMain {
23 public: 19 public:
24 MonitorReconfigureMain(Display* display, XRRScreenResources* screen_info); 20 MonitorReconfigureMain(Display* display, XRRScreenResources* screen_info);
25 virtual ~MonitorReconfigureMain() {} 21 virtual ~MonitorReconfigureMain() {}
22
26 // Main entry point 23 // Main entry point
27 void Run(); 24 void Run();
25
28 // Returns whether an external monitor is connected 26 // Returns whether an external monitor is connected
29 bool IsExternalMonitorConnected(); 27 bool IsExternalMonitorConnected();
28
30 private: 29 private:
31 // Finds the max resolution mode for the given |output| 30 // Finds the max resolution mode for the given |output|
32 XRRModeInfo* FindMaxResolution(XRROutputInfo* output); 31 XRRModeInfo* FindMaxResolution(XRROutputInfo* output);
32
33 // Finds the best matching resolution as compared to the |matching_mode| 33 // Finds the best matching resolution as compared to the |matching_mode|
34 XRRModeInfo* FindBestMatchingResolution(XRRModeInfo* matching_mode); 34 XRRModeInfo* FindBestMatchingResolution(XRRModeInfo* matching_mode);
35
35 // Initializes the |notebook_output_| and |external_output_| fields 36 // Initializes the |notebook_output_| and |external_output_| fields
36 void DetermineOutputs(); 37 void DetermineOutputs();
37 // Sets the resolution of the notebook's screen, the external monitors screen 38
38 // and the overall virtual screen to the gives sizes 39 // Sets the resolution of the notebook's screen, the external monitor's
40 // screen, and the overall virtual screen to the given size.
39 void SetResolutions(XRRModeInfo* notebook_mode, 41 void SetResolutions(XRRModeInfo* notebook_mode,
40 XRRModeInfo* external_mode, 42 XRRModeInfo* external_mode,
41 XRRModeInfo* overall_screen_size); 43 XRRModeInfo* overall_screen_size);
44
42 // Inline helper functions for FindBestMatchingResolution 45 // Inline helper functions for FindBestMatchingResolution
43 inline bool IsEqual(XRRModeInfo*, XRRModeInfo*); 46 inline bool IsEqual(XRRModeInfo*, XRRModeInfo*);
44 inline bool IsBiggerOrEqual(XRRModeInfo*, XRRModeInfo*); 47 inline bool IsBiggerOrEqual(XRRModeInfo*, XRRModeInfo*);
45 inline bool IsBetterMatching(XRRModeInfo* target, XRRModeInfo* to_match, 48 inline bool IsBetterMatching(XRRModeInfo* target, XRRModeInfo* to_match,
46 XRRModeInfo* previous_best); 49 XRRModeInfo* previous_best);
50
47 // Mapping between mode XID's and mode information structures 51 // Mapping between mode XID's and mode information structures
48 std::map <int, XRRModeInfo*> mode_map_; 52 std::map<int, XRRModeInfo*> mode_map_;
53
49 // X Resources needed between functions 54 // X Resources needed between functions
50 Display* display_; 55 Display* display_;
51 XRRScreenResources* screen_info_; 56 XRRScreenResources* screen_info_;
52 XRROutputInfo* notebook_output_; 57 XRROutputInfo* notebook_output_;
53 XRROutputInfo* external_output_; 58 XRROutputInfo* external_output_;
54 }; 59 };
55 }
56 60
57 #endif /* MONITOR_RECONFIGURE_MAIN_H_ */ 61 } // namespace monitor_reconfig
62
63 #endif // MONITOR_RECONFIGURE_MONITOR_RECONFIGURE_MAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698