window: Only update the inspector once

Instead of queueing a new idle handler every time we call
gtk_window_update_debugging(), only queue one if none is queued that.

Saves a lot of work, in particular when templates create context menus
for every row in a large listbox as in the gtk-demo listbox example.
This commit is contained in:
Benjamin Otte 2015-08-25 19:46:09 +02:00
parent 207e593075
commit 5037d134c5

View File

@ -12051,21 +12051,24 @@ warn_response (GtkDialog *dialog,
}
}
static guint gtk_window_update_debugging_id;
static gboolean
update_debugging (gpointer data)
{
gtk_inspector_window_rescan (inspector_window);
gtk_window_update_debugging_id = 0;
return G_SOURCE_REMOVE;
}
static void
gtk_window_update_debugging (void)
{
if (inspector_window)
if (inspector_window &&
gtk_window_update_debugging_id == 0)
{
guint id;
id = gdk_threads_add_idle (update_debugging, NULL);
g_source_set_name_by_id (id, "[gtk+] gtk_window_update_debugging");
gtk_window_update_debugging_id = gdk_threads_add_idle (update_debugging, NULL);
g_source_set_name_by_id (gtk_window_update_debugging_id, "[gtk+] gtk_window_update_debugging");
}
}