Re: Removing xrdb for 10% startup win?

Hi All,

You'll find attached a patch which fixes the multiple call problem using Xsettings instead
   of the "style-set" signal.

I've also created a bug to track this issue (


Erwann Chenede wrote:

Hi all,

Ross Burton wrote:

On Mon, 2005-08-29 at 10:24 +0100, ghee teo wrote:
    Look like some cool stuffs you have done here!
Just want to point out that John Rice is doing some performance analysis
work on GNOME startup time also, see his blog:

The good question here is why is xrdb being executed 11 times?
After a quick look at gnome-settings-xrdb.c
It seems that the style_set_cb callback, which ultimately spawn the xrdb command, is called multiple times. This happens because the style_set_cb callback is connected to the GtkWidget signal "style-set" which receive multiple "style-set" signals (8 or 9) initially for the same theme.

One solution to avoid these multiple calls would be to monitor the gtk theme Xsettings property as gtk does (via "notify::gtk-theme-name") or the /desktop/gnome/interface/gtk_theme gconf key directly
instead of relying on the "style-set" signal.
This way only complete theme change would trigger a xrdb change.



The first one (spawned by gnome-session) looks like a xrdb call
in .gnomerc or some other file, but the 10 calls by
gnome-settings-daemon is caused by "grdb" and is surely a bug...


             Erwann Chénedé,
Desktop Group,           Sun Microsystems

[ I speak for myself, not for my employer ]

--- gnome-settings-xrdb.c	2005-07-01 13:42:20.000000000 +0200
+++ modif/gnome-settings-xrdb.c	2005-08-29 16:42:20.000000000 +0200
@@ -321,8 +321,9 @@
-static void
-style_set_cb (GtkWidget *widget, GtkStyle *s, gpointer data)
+static void theme_changed (GtkSettings  *settings,
+                           GParamSpec   *pspec,
+			   GtkWidget    *widget)
 	apply_settings (gtk_widget_get_style (widget));
@@ -330,13 +331,25 @@
 gnome_settings_xrdb_init (GConfClient *client)
-	widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-	g_signal_connect (widget, "style-set", (GCallback)style_set_cb, NULL);
-	gtk_widget_ensure_style (widget);
 gnome_settings_xrdb_load (GConfClient *client)
-	style_set_cb (widget, NULL, NULL);
+	static gboolean initialized = FALSE;
+	if (!initialized) 
+	  { /* the initialization is done here otherwise 
+	       gnome_settings_xsettings_load would generate 
+	       false hit as gtk-theme-name is set to Default in 
+	       gnome_settings_xsettings_init */
+	    GtkSettings *settings = gtk_settings_get_default ();
+	    widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	    g_signal_connect (settings,
+			      "notify::gtk-theme-name",
+			      G_CALLBACK (theme_changed),
+			      widget);
+	    gtk_widget_ensure_style (widget); 
+	    initialized = TRUE;
+	  }

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]