diff options
author | Dave Airlie <airlied@redhat.com> | 2015-03-31 10:55:10 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-05-19 09:34:54 +1000 |
commit | ceace3830749651ae08a12cc6e358233e732a59a (patch) | |
tree | 465fa74d24f2cd72dced595b1dc3ea32654b827e /src/backends/meta-monitor-config.c | |
parent | fc3b675098da8d716bff368d9afebeca62f7bca2 (diff) |
monitors: change find_primary to return an index
This will make it easier to add tiling support.
Diffstat (limited to 'src/backends/meta-monitor-config.c')
-rw-r--r-- | src/backends/meta-monitor-config.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c index c067bd26..56c9eb04 100644 --- a/src/backends/meta-monitor-config.c +++ b/src/backends/meta-monitor-config.c @@ -1079,12 +1079,12 @@ meta_monitor_config_apply_stored (MetaMonitorConfig *self, * which are internal monitors), or failing that, the one with the * best resolution */ -static MetaOutput * +static int find_primary_output (MetaOutput *outputs, unsigned n_outputs) { unsigned i; - MetaOutput *best; + int best; int best_width, best_height; g_assert (n_outputs >= 1); @@ -1092,23 +1092,23 @@ find_primary_output (MetaOutput *outputs, for (i = 0; i < n_outputs; i++) { if (outputs[i].is_primary) - return &outputs[i]; + return i; } for (i = 0; i < n_outputs; i++) { if (output_is_laptop (&outputs[i])) - return &outputs[i]; + return i; } - best = NULL; + best = -1; best_width = 0; best_height = 0; for (i = 0; i < n_outputs; i++) { if (outputs[i].preferred_mode->width * outputs[i].preferred_mode->height > best_width * best_height) { - best = &outputs[i]; + best = i; best_width = outputs[i].preferred_mode->width; best_height = outputs[i].preferred_mode->height; } @@ -1146,7 +1146,7 @@ make_suggested_config (MetaMonitorConfig *self, MetaConfiguration *config) { unsigned int i; - MetaOutput *primary; + int primary; GList *region = NULL; g_return_val_if_fail (config != NULL, FALSE); @@ -1154,7 +1154,7 @@ make_suggested_config (MetaMonitorConfig *self, for (i = 0; i < n_outputs; i++) { - gboolean is_primary = (&outputs[i] == primary); + gboolean is_primary = ((int)i == primary); if (outputs[i].suggested_x < 0 || outputs[i].suggested_y < 0) return FALSE; @@ -1189,7 +1189,7 @@ make_linear_config (MetaMonitorConfig *self, int max_height, MetaConfiguration *config) { - MetaOutput *primary; + int primary; unsigned i; int x; @@ -1197,10 +1197,10 @@ make_linear_config (MetaMonitorConfig *self, primary = find_primary_output (outputs, n_outputs); - x = primary->preferred_mode->width; + x = outputs[primary].preferred_mode->width; for (i = 0; i < n_outputs; i++) { - gboolean is_primary = (&outputs[i] == primary); + gboolean is_primary = ((int)i == primary); init_config_from_preferred_mode (&config->outputs[i], &outputs[i]); config->outputs[i].is_primary = is_primary; @@ -1337,7 +1337,7 @@ ensure_at_least_one_output (MetaMonitorConfig *self, unsigned n_outputs) { MetaConfiguration *config; - MetaOutput *primary; + int primary; unsigned i; /* Check that we have at least one active output */ @@ -1355,7 +1355,7 @@ ensure_at_least_one_output (MetaMonitorConfig *self, for (i = 0; i < n_outputs; i++) { - gboolean is_primary = (&outputs[i] == primary); + gboolean is_primary = ((int)i == primary); if (is_primary) { |