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

Unified Diff: resolution_selector.h

Issue 6732013: Refactor monitor_reconfigure to stop using system("xrandr"). (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/monitor_reconfig.git@master
Patch Set: Fix comment Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « monitor_reconfigure_main.cc ('k') | resolution_selector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: resolution_selector.h
diff --git a/resolution_selector.h b/resolution_selector.h
index e2920902020876da559aab372434809235ad867d..54e69bec715d2f681d58212ab2fda4729169d6cb 100644
--- a/resolution_selector.h
+++ b/resolution_selector.h
@@ -20,12 +20,19 @@ class ResolutionSelector {
// A single mode supported by a device, equivalent to the XRRModeInfo
// struct.
struct Mode {
- Mode(int width, int height, std::string name)
+ Mode(int width, int height, std::string name, int id)
: width(width),
height(height),
- name(name) {
+ name(name),
+ id(id) {
}
+ Mode()
+ : width(0),
+ height(0),
+ name(""),
+ id(0) {
+ }
// Mode's dimensions.
int width;
int height;
@@ -33,6 +40,9 @@ class ResolutionSelector {
// Mode's name from XRandR. This uniquely describes the mode and can
// be used to set the devices's resolution later.
std::string name;
+
+ // The mode id, used for setting this mode.
+ unsigned id;
};
// Maximum screen size for the external output at which we assume that
@@ -55,13 +65,13 @@ class ResolutionSelector {
};
// Find the "best" resolutions for various outputs.
- // The returned strings contain |name| values from the passed-in modes.
+ // Returns the modes for both screens and the total screen resolution.
bool FindBestResolutions(
const std::vector<Mode>& lcd_modes,
const std::vector<Mode>& external_modes,
- std::string* lcd_resolution,
- std::string* external_resolution,
- std::string* screen_resolution);
+ Mode* lcd_resolution,
+ Mode* external_resolution,
+ Mode* screen_resolution);
private:
// Find resolutions to use that are reasonably close together.
@@ -73,9 +83,9 @@ class ResolutionSelector {
bool FindNearestResolutions(
const std::vector<Mode>& larger_device_modes,
const std::vector<Mode>& smaller_device_modes,
- std::string* larger_resolution,
- std::string* smaller_resolution,
- std::string* screen_resolution);
+ Mode* larger_resolution,
+ Mode* smaller_resolution,
+ Mode* screen_resolution);
DISALLOW_COPY_AND_ASSIGN(ResolutionSelector);
};
« no previous file with comments | « monitor_reconfigure_main.cc ('k') | resolution_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698