Un-overlap the monitors when turning off mirrored screens

Signed-off-by: Federico Mena Quintero <federico@novell.com>

svn path=/trunk/; revision=9166
This commit is contained in:
Federico Mena Quintero 2008-12-12 23:37:28 +00:00 committed by Federico Mena Quintero
parent fdca72c520
commit 4423ae56de
2 changed files with 56 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2008-12-12 Federico Mena Quintero <federico@novell.com>
* xrandr-capplet.c (on_clone_changed): If we turn off "mirror
screens", and if the monitors are still overlapping, lay out the
monitors from left to right so that the user will know that all
the monitors are present. Previously you had to know that you had
to un-overlap them by hand.
(lay_out_outputs_horizontally): New function.
2008-12-03 Federico Mena Quintero <federico@novell.com>
* xrandr-capplet.c (rebuild_rotation_combo): Pass a NULL error

View file

@ -62,6 +62,7 @@ struct App
static void rebuild_gui (App *app);
static void on_rate_changed (GtkComboBox *box, gpointer data);
static gboolean output_overlaps (GnomeOutputInfo *output, GnomeRRConfig *config);
static void
error_message (App *app, const char *primary_text, const char *secondary_text)
@ -648,6 +649,47 @@ on_resolution_changed (GtkComboBox *box, gpointer data)
foo_scroll_area_invalidate (FOO_SCROLL_AREA (app->area));
}
static void
lay_out_outputs_horizontally (App *app)
{
int i;
int x;
/* Lay out all the monitors horizontally when "mirror screens" is turned
* off, to avoid having all of them overlapped initially. We put the
* outputs turned off on the right-hand side.
*/
x = 0;
/* First pass, all "on" outputs */
for (i = 0; app->current_configuration->outputs[i]; ++i)
{
GnomeOutputInfo *output;
output = app->current_configuration->outputs[i];
if (output->connected && output->on)
output->x = x;
x += output->width;
}
/* Second pass, all the black screens */
for (i = 0; app->current_configuration->outputs[i]; ++i)
{
GnomeOutputInfo *output;
output = app->current_configuration->outputs[i];
if (!(output->connected && output->on))
output->x = x;
x += output->width;
}
}
static void
on_clone_changed (GtkWidget *box, gpointer data)
{
@ -669,6 +711,11 @@ on_clone_changed (GtkWidget *box, gpointer data)
}
}
}
else
{
if (output_overlaps (app->current_output, app->current_configuration))
lay_out_outputs_horizontally (app);
}
rebuild_gui (app);
}