mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 17:40:40 -05:00
monitors: change find_primary to return an index
This will make it easier to add tiling support.
This commit is contained in:
parent
2a8563ab23
commit
5c9846c53a
@ -1074,12 +1074,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);
|
||||
@ -1087,23 +1087,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;
|
||||
}
|
||||
@ -1141,7 +1141,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);
|
||||
@ -1149,7 +1149,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;
|
||||
@ -1184,7 +1184,7 @@ make_linear_config (MetaMonitorConfig *self,
|
||||
int max_height,
|
||||
MetaConfiguration *config)
|
||||
{
|
||||
MetaOutput *primary;
|
||||
int primary;
|
||||
unsigned i;
|
||||
int x;
|
||||
|
||||
@ -1192,10 +1192,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;
|
||||
@ -1332,7 +1332,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 */
|
||||
@ -1350,7 +1350,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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user