Don't duplicate code to pick the current output
2008-12-15 Federico Mena Quintero <federico@novell.com> * xrandr-capplet.c (on_screen_changed): Use select_current_output_from_dialog_position() instead of selecting an output ourselves. Signed-off-by: Federico Mena Quintero <federico@novell.com> svn path=/trunk/; revision=9171
This commit is contained in:
parent
3545215c21
commit
e16c9d3715
2 changed files with 15 additions and 27 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2008-12-15 Federico Mena Quintero <federico@novell.com>
|
||||||
|
|
||||||
|
* xrandr-capplet.c (on_screen_changed): Use
|
||||||
|
select_current_output_from_dialog_position() instead of selecting
|
||||||
|
an output ourselves.
|
||||||
|
|
||||||
2008-12-15 Federico Mena Quintero <federico@novell.com>
|
2008-12-15 Federico Mena Quintero <federico@novell.com>
|
||||||
|
|
||||||
* xrandr-capplet.c (select_current_output_from_dialog_position):
|
* xrandr-capplet.c (select_current_output_from_dialog_position):
|
||||||
|
|
|
@ -65,6 +65,7 @@ struct App
|
||||||
static void rebuild_gui (App *app);
|
static void rebuild_gui (App *app);
|
||||||
static void on_rate_changed (GtkComboBox *box, gpointer data);
|
static void on_rate_changed (GtkComboBox *box, gpointer data);
|
||||||
static gboolean output_overlaps (GnomeOutputInfo *output, GnomeRRConfig *config);
|
static gboolean output_overlaps (GnomeOutputInfo *output, GnomeRRConfig *config);
|
||||||
|
static void select_current_output_from_dialog_position (App *app);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
error_message (App *app, const char *primary_text, const char *secondary_text)
|
error_message (App *app, const char *primary_text, const char *secondary_text)
|
||||||
|
@ -113,7 +114,6 @@ on_screen_changed (GnomeRRScreen *scr,
|
||||||
GnomeRRConfig *current;
|
GnomeRRConfig *current;
|
||||||
App *app = data;
|
App *app = data;
|
||||||
int i;
|
int i;
|
||||||
GnomeOutputInfo *best;
|
|
||||||
|
|
||||||
current = gnome_rr_config_new_current (app->screen);
|
current = gnome_rr_config_new_current (app->screen);
|
||||||
|
|
||||||
|
@ -157,25 +157,7 @@ on_screen_changed (GnomeRRScreen *scr,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Select an output */
|
select_current_output_from_dialog_position (app);
|
||||||
best = NULL;
|
|
||||||
for (i = 0; app->current_configuration->outputs[i] != NULL; ++i)
|
|
||||||
{
|
|
||||||
GnomeOutputInfo *output = app->current_configuration->outputs[i];
|
|
||||||
|
|
||||||
if (output->connected)
|
|
||||||
{
|
|
||||||
char *cur_name =
|
|
||||||
app->current_output? app->current_output->name : NULL;
|
|
||||||
|
|
||||||
if ((cur_name && strcmp (output->name, cur_name) == 0) || !best)
|
|
||||||
best = output;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
app->current_output = best;
|
|
||||||
|
|
||||||
rebuild_gui (app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1825,15 +1807,15 @@ get_output_for_window (GnomeRRConfig *configuration, GdkWindow *window)
|
||||||
static void
|
static void
|
||||||
select_current_output_from_dialog_position (App *app)
|
select_current_output_from_dialog_position (App *app)
|
||||||
{
|
{
|
||||||
GnomeOutputInfo *output;
|
if (GTK_WIDGET_REALIZED (app->dialog))
|
||||||
|
|
||||||
output = get_output_for_window (app->current_configuration, app->dialog->window);
|
|
||||||
|
|
||||||
if (output)
|
|
||||||
{
|
{
|
||||||
app->current_output = output;
|
output = get_output_for_window (app->current_configuration, app->dialog->window);
|
||||||
rebuild_gui (app);
|
|
||||||
|
if (output)
|
||||||
|
app->current_output = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rebuild_gui (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a GtkWidget::map-event handler. We wait for the display-properties
|
/* This is a GtkWidget::map-event handler. We wait for the display-properties
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue