forked from AuroraMiddleware/gtk
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:
parent
207e593075
commit
5037d134c5
@ -12051,21 +12051,24 @@ warn_response (GtkDialog *dialog,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static guint gtk_window_update_debugging_id;
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
update_debugging (gpointer data)
|
update_debugging (gpointer data)
|
||||||
{
|
{
|
||||||
gtk_inspector_window_rescan (inspector_window);
|
gtk_inspector_window_rescan (inspector_window);
|
||||||
|
gtk_window_update_debugging_id = 0;
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_window_update_debugging (void)
|
gtk_window_update_debugging (void)
|
||||||
{
|
{
|
||||||
if (inspector_window)
|
if (inspector_window &&
|
||||||
|
gtk_window_update_debugging_id == 0)
|
||||||
{
|
{
|
||||||
guint id;
|
gtk_window_update_debugging_id = gdk_threads_add_idle (update_debugging, NULL);
|
||||||
id = gdk_threads_add_idle (update_debugging, NULL);
|
g_source_set_name_by_id (gtk_window_update_debugging_id, "[gtk+] gtk_window_update_debugging");
|
||||||
g_source_set_name_by_id (id, "[gtk+] gtk_window_update_debugging");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user