inspector: Rescan toplevels when they change

This ensures that windows appear in the inspectors tree when
they are created, and it prevents GTK_DEBUG=interactive from
coming up with an empty object tree.

https://bugzilla.gnome.org/show_bug.cgi?id=752664
This commit is contained in:
Matthias Clasen 2015-07-23 21:28:28 -04:00
parent 9a44f18940
commit 3fec234c22

View File

@ -571,6 +571,7 @@ static GtkWindowRegion get_active_region_type (GtkWindow *window,
gint x,
gint y);
static void gtk_window_update_debugging (void);
G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
G_ADD_PRIVATE (GtkWindow)
@ -1645,6 +1646,7 @@ gtk_window_init (GtkWindow *window)
g_object_ref_sink (window);
priv->has_user_ref_count = TRUE;
toplevel_list = g_slist_prepend (toplevel_list, window);
gtk_window_update_debugging ();
if (priv->screen)
g_signal_connect_object (priv->screen, "composited-changed",
@ -5679,6 +5681,7 @@ gtk_window_destroy (GtkWidget *widget)
gtk_window_release_application (window);
toplevel_list = g_slist_remove (toplevel_list, window);
gtk_window_update_debugging ();
if (priv->transient_parent)
gtk_window_set_transient_for (window, NULL);
@ -11512,9 +11515,9 @@ _gtk_window_set_is_toplevel (GtkWindow *window,
{
_gtk_widget_set_is_toplevel (widget, FALSE);
toplevel_list = g_slist_remove (toplevel_list, window);
_gtk_widget_propagate_hierarchy_changed (widget, widget);
}
gtk_window_update_debugging ();
}
/**
@ -11987,6 +11990,20 @@ warn_response (GtkDialog *dialog,
}
}
static gboolean
update_debugging (gpointer data)
{
gtk_inspector_window_rescan (inspector_window);
return G_SOURCE_REMOVE;
}
static void
gtk_window_update_debugging (void)
{
if (inspector_window)
g_idle_add (update_debugging, NULL);
}
static void
gtk_window_set_debugging (gboolean enable,
gboolean select,