I fixed the Windows runtime path so gdk-pixbuf can actually find/use its loader modules before GTK initializes, by adding win32_configure_pixbuf_loaders() and calling it in startup on Windows. This sets GDK_PIXBUF_MODULEDIR / GDK_PIXBUF_MODULE_FILE from the bundled install tree so SVG resources can render instead of placeholder icons.

I also fixed Windows packaging to include what the SVG path needs at runtime: librsvg DLLs, gdk-pixbuf loader modules, and loaders.cache in the release bundle.
This commit is contained in:
2026-02-17 21:30:51 -07:00
parent afc490aa18
commit 1a920ba955
2 changed files with 53 additions and 0 deletions

View File

@@ -174,6 +174,53 @@ win32_set_gsettings_schema_dir (void)
g_free (base_path);
}
static void
win32_configure_pixbuf_loaders (void)
{
char *base_path;
char *pixbuf_root;
GDir *versions;
const gchar *entry;
base_path = g_win32_get_package_installation_directory_of_module (NULL);
if (!base_path)
return;
pixbuf_root = g_build_filename (base_path, "lib", "gdk-pixbuf-2.0", NULL);
if (!g_file_test (pixbuf_root, G_FILE_TEST_IS_DIR))
{
g_free (pixbuf_root);
g_free (base_path);
return;
}
versions = g_dir_open (pixbuf_root, 0, NULL);
if (versions)
{
while ((entry = g_dir_read_name (versions)) != NULL)
{
char *module_dir = g_build_filename (pixbuf_root, entry, "loaders", NULL);
char *module_file = g_build_filename (pixbuf_root, entry, "loaders.cache", NULL);
if (g_file_test (module_dir, G_FILE_TEST_IS_DIR))
g_setenv ("GDK_PIXBUF_MODULEDIR", module_dir, TRUE);
if (g_file_test (module_file, G_FILE_TEST_EXISTS))
g_setenv ("GDK_PIXBUF_MODULE_FILE", module_file, TRUE);
g_free (module_file);
g_free (module_dir);
if (g_getenv ("GDK_PIXBUF_MODULEDIR") != NULL)
break;
}
g_dir_close (versions);
}
g_free (pixbuf_root);
g_free (base_path);
}
static void
win32_configure_icon_theme (void)
{
@@ -307,6 +354,7 @@ fe_args (int argc, char *argv[])
#ifdef WIN32
win32_set_gsettings_schema_dir ();
win32_configure_pixbuf_loaders ();
/* this is mainly for irc:// URL handling. When windows calls us from */
/* I.E, it doesn't give an option of "Start in" directory, like short */

View File

@@ -67,6 +67,7 @@
<None Include="$(DepsRoot)\bin\*pangocairo-1.0-0.dll" />
<None Include="$(DepsRoot)\bin\*pangoft2-1.0-0.dll" />
<None Include="$(DepsRoot)\bin\*pangowin32-1.0-0.dll" />
<None Include="$(DepsRoot)\bin\*rsvg*.dll" />
<None Include="$(DepsRoot)\bin\*zlib*.dll" />
<None Include="$(DepsRoot)\bin\luajit*.dll" />
<None Include="$(DepsRoot)\bin\*girepository*.dll" />
@@ -82,6 +83,8 @@
<Gtk3Immodules Include="$(DepsRoot)\lib\gtk-3.0\3.0.0\immodules\**\*" />
<Gtk3PrintBackends Include="$(DepsRoot)\lib\gtk-3.0\3.0.0\printbackends\**\*" />
<GSettingsSchemas Include="$(DepsRoot)\share\glib-2.0\schemas\*" />
<GdkPixbufLoaders Include="$(DepsRoot)\lib\gdk-pixbuf-2.0\**\loaders\**\*" />
<GdkPixbufLoaderCache Include="$(DepsRoot)\lib\gdk-pixbuf-2.0\**\loaders.cache" />
<FontConfig Include="$(DepsRoot)\etc\fonts\*" />
<Share Include="share\**\*" />
@@ -95,6 +98,8 @@
<Copy SourceFiles="@(FontConfig)" DestinationFolder="$(ZoiteChatRel)\etc\fonts" />
<Copy SourceFiles="@(Gtk3Immodules)" DestinationFiles="@(Gtk3Immodules->'$(ZoiteChatRel)\lib\gtk-3.0\3.0.0\immodules\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(Gtk3PrintBackends)" DestinationFiles="@(Gtk3PrintBackends->'$(ZoiteChatRel)\lib\gtk-3.0\3.0.0\printbackends\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(GdkPixbufLoaders)" DestinationFiles="@(GdkPixbufLoaders->'$(ZoiteChatRel)\lib\gdk-pixbuf-2.0\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(GdkPixbufLoaderCache)" DestinationFiles="@(GdkPixbufLoaderCache->'$(ZoiteChatRel)\lib\gdk-pixbuf-2.0\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(GSettingsSchemas)" DestinationFiles="@(GSettingsSchemas->'$(ZoiteChatRel)\share\glib-2.0\schemas\%(Filename)%(Extension)')" />
<Copy SourceFiles="@(Share)" DestinationFiles="@(Share->'$(ZoiteChatRel)\share\%(RecursiveDir)%(Filename)%(Extension)')" />
<Copy SourceFiles="@(DepsRootIcons)" DestinationFiles="@(DepsRootIcons->'$(ZoiteChatRel)\share\icons\%(RecursiveDir)%(Filename)%(Extension)')" />