Skip to content

Commit

Permalink
plugins: fix linkage of GResources
Browse files Browse the repository at this point in the history
The libcommon_dep gresources were not ending up in the final gsd-* plugin
binaries. What this means is that the work to disable the GTK theme parsing
at startup was innefective, wasting significant time and memory during
application startup.

Collectively, these are still slowing down login.

Calling g_resources_register() at startup is enough to ensure that the
the empty gtk.css ends up in the target binary.

You can verify the resources show up in the resulting binary with:

  $ gresources list /path/to/gsd-media-keys
  /org/gtk/libgtk/theme/Disabled/gtk.css

This was found with Sysprof while profiling login on GNOME OS.
  • Loading branch information
chergert committed Aug 10, 2023
1 parent 7af92d4 commit f01f0bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/color/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ deps = plugins_deps + [
libcanberra_gtk_dep,
libgeoclue_dep,
libnotify_dep,
libcommon_dep,
m_dep,
]

Expand Down
5 changes: 5 additions & 0 deletions plugins/common/daemon-skeleton-gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#include "gnome-settings-bus.h"

#include "gsd-resources.h"

#ifndef PLUGIN_NAME
#error Include PLUGIN_CFLAGS in the daemon s CFLAGS
#endif /* !PLUGIN_NAME */
Expand Down Expand Up @@ -219,6 +221,9 @@ main (int argc, char **argv)
textdomain (GETTEXT_PACKAGE);
setlocale (LC_ALL, "");

/* Ensure we don't lose resources during linkage */
g_resources_register (gsd_get_resource ());

set_empty_gtk_theme (TRUE);

#ifdef GDK_BACKEND
Expand Down

0 comments on commit f01f0bf

Please sign in to comment.