diff --git a/capplets/display/ChangeLog b/capplets/display/ChangeLog index bb1b832c1..93135069a 100644 --- a/capplets/display/ChangeLog +++ b/capplets/display/ChangeLog @@ -1,3 +1,12 @@ +2008-12-12 Federico Mena Quintero + + * 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 * xrandr-capplet.c (rebuild_rotation_combo): Pass a NULL error diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index a23bb000c..bce2d3800 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -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); }