inspector: Update for screen config changes

Repopulate the display section whenever the monitor configuration
changes.
This commit is contained in:
Matthias Clasen 2016-02-25 01:21:27 -05:00
parent 15ccdcd25b
commit 84ba01d713

View File

@ -274,13 +274,26 @@ init_env (GtkInspectorGeneral *gen)
}
static void
init_display (GtkInspectorGeneral *gen)
populate_display (GdkScreen *screen, GtkInspectorGeneral *gen)
{
GdkScreen *screen;
gchar *name;
gint i;
GList *children, *l;
GtkWidget *child;
children = gtk_container_get_children (GTK_CONTAINER (gen->priv->x_box));
for (l = children; l; l = l->next)
{
child = l->data;
if (gtk_widget_is_ancestor (gen->priv->x_display, child) ||
gtk_widget_is_ancestor (gen->priv->x_rgba, child) ||
gtk_widget_is_ancestor (gen->priv->x_composited, child))
continue;
gtk_widget_destroy (child);
}
g_list_free (children);
screen = gdk_screen_get_default ();
name = gdk_screen_make_display_name (screen);
gtk_label_set_label (GTK_LABEL (gen->priv->x_display), name);
g_free (name);
@ -343,6 +356,20 @@ init_display (GtkInspectorGeneral *gen)
}
}
static void
init_display (GtkInspectorGeneral *gen)
{
GdkScreen *screen;
screen = gdk_screen_get_default ();
g_signal_connect (screen, "size-changed", G_CALLBACK (populate_display), gen);
g_signal_connect (screen, "composited-changed", G_CALLBACK (populate_display), gen);
g_signal_connect (screen, "monitors-changed", G_CALLBACK (populate_display), gen);
populate_display (screen, gen);
}
static void
add_device (GtkInspectorGeneral *gen,
GdkDevice *device)