From 5037d134c56ab827a18b965442f5fcac95c9ee8a Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 25 Aug 2015 19:46:09 +0200 Subject: [PATCH] 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. --- gtk/gtkwindow.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 0367c90a9e..126f8f99d5 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -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"); } }