diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2021-06-09 19:14:52 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2021-10-08 22:09:14 +0200 |
commit | 535c9e63afa226e334bf7e3e2835dc130e853dee (patch) | |
tree | 2c3332fac6b5a6a6ec478366adac4e4700215f4e | |
parent | 311d8f73d48d2d8e515e5160805b0ca76d2bd731 (diff) | |
download | sciteco-535c9e63afa226e334bf7e3e2835dc130e853dee.tar.gz |
revised icon loading on Windows and packaging again
* We don't need the PNG icons on Windows as the compiled-in ICO should suffice
* Ship the dependencies of the SVG pixbuf loader.
* The PNG pixbuf loader is still distributed, as we at least need it
for loading the icon theme.
* Install a loaders.cache - without it, the pixbuf loaders won't be found.
This file can be generated by gdk-pixbuf-query-loaders but apparently has
to be modified by hand.
* Regenerate the icon cache using gtk-update-icon-cache.
* Icon themes are found now.
Unfortunately, we have to distribute the entire Adwaita icon theme
as distributing only the scalable (SVG) icons does not work for some
strange reason (FIXME).
-rw-r--r-- | .github/workflows/ci.yml | 6 | ||||
-rw-r--r-- | .github/workflows/nightly.yml | 54 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | src/interface-gtk/interface.c | 47 | ||||
-rw-r--r-- | win32/loaders.cache | 12 |
5 files changed, 76 insertions, 45 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b5f329..5cd9843 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,6 @@ name: Continuous Integration -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request] jobs: ubuntu: diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bbbbda2..dcab877 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -125,7 +125,7 @@ jobs: - name: Archive Windows Distribution (PDCurses) uses: actions/upload-artifact@v2 with: - name: SciTECO nightly packages on ${{ steps.date.outputs.date }} (Win32, PDCurses) + name: SciTECO nightly build on ${{ steps.date.outputs.date }} (Win32, PDCurses) path: temp-bin/* # NOTE: There is a lot of redundancy with win32-curses. @@ -183,37 +183,49 @@ jobs: - name: Prepare Distribution Directory run: | - mkdir -p temp-bin/bin - cp /mingw32/bin/{sciteco.exe,grosciteco.tes,tedoc.tes} temp-bin/bin/ - cp -r /mingw32/share/sciteco/{lib,*.tmac,*.png} temp-bin/bin/ - cp /mingw32/share/sciteco/sample.teco_ini temp-bin/bin/.teco_ini - cp /mingw32/share/sciteco/fallback.css temp-bin/bin/.teco_css - mkdir -p temp-bin/doc - cp -r /mingw32/share/doc/sciteco/* temp-bin/doc/ - cp COPYING ChangeLog temp-bin/doc/ - cp /mingw32/bin/gspawn-win32-helper*.exe temp-bin/bin/ - cp /mingw32/bin/{libglib-2.0-0,libpcre-1,libintl-8,libiconv-2,libwinpthread-1,libgcc_s_dw2-1}.dll temp-bin/bin/ - cp /mingw32/bin/{libgtk-3-0,libgdk-3-0,libgdk_pixbuf-2.0-0,libatk-1.0-0}.dll temp-bin/bin/ - cp /mingw32/bin/{libgobject-2.0-0,libgmodule-2.0-0,libgio-2.0-0,libffi-7}.dll temp-bin/bin/ - cp /mingw32/bin/{libpango-1.0-0,libpangocairo-1.0-0,libpangowin32-1.0-0,libpangoft2-1.0-0}.dll temp-bin/bin/ - cp /mingw32/bin/{libthai-0,libdatrie-1,libharfbuzz-0,libgraphite2,libfribidi-0,libepoxy-0}.dll temp-bin/bin/ - cp /mingw32/bin/{libfontconfig-1,libexpat-1}.dll temp-bin/bin/ - cp /mingw32/bin/{libfreetype-6,libpng16-16,libbrotlidec,libbrotlicommon,libbz2-1,zlib1}.dll temp-bin/bin/ - cp /mingw32/bin/{libcairo-2,libcairo-gobject-2,libpixman-1-0,libstdc++-6}.dll temp-bin/bin/ + mkdir -p temp-bin + cp /mingw32/bin/{sciteco.exe,grosciteco.tes,tedoc.tes} temp-bin/ + cp -r /mingw32/share/sciteco/{lib,*.tmac} temp-bin/ + # FIXME: Maybe there should be a separate win32/.teco_ini with + # a few pre-enabled settings? + cp /mingw32/share/sciteco/sample.teco_ini temp-bin/.teco_ini + cp /mingw32/share/sciteco/fallback.css temp-bin/.teco_css + cp -r /mingw32/share/doc/sciteco/* temp-bin/ + cp COPYING ChangeLog temp-bin/ + cp /mingw32/bin/gspawn-win32-helper*.exe temp-bin/ + cp /mingw32/bin/{libglib-2.0-0,libpcre-1,libintl-8,libiconv-2,libwinpthread-1,libgcc_s_dw2-1}.dll temp-bin/ + cp /mingw32/bin/{libgtk-3-0,libgdk-3-0,libgdk_pixbuf-2.0-0,libatk-1.0-0}.dll temp-bin/ + cp /mingw32/bin/{libgobject-2.0-0,libgmodule-2.0-0,libgio-2.0-0,libffi-7}.dll temp-bin/ + cp /mingw32/bin/{libpango-1.0-0,libpangocairo-1.0-0,libpangowin32-1.0-0,libpangoft2-1.0-0}.dll temp-bin/ + cp /mingw32/bin/{libthai-0,libdatrie-1,libharfbuzz-0,libgraphite2,libfribidi-0,libepoxy-0}.dll temp-bin/ + cp /mingw32/bin/{libfontconfig-1,libexpat-1}.dll temp-bin/ + cp /mingw32/bin/{libfreetype-6,libbrotlidec,libbrotlicommon,libbz2-1,zlib1}.dll temp-bin/ + cp /mingw32/bin/{libcairo-2,libcairo-gobject-2,libpixman-1-0,libstdc++-6}.dll temp-bin/ + cp /mingw32/bin/{libpng16-16,librsvg-2-2,libxml2-2}.dll temp-bin/ #mkdir -p temp-bin/share #cp /mingw32/share/loader.cache temp-bin/share/ #glib-compile-schemas /mingw32/share/glib-2.0/schemas #mkdir -p temp-bin/share/glib-2.0 #cp /mingw32/share/glib-2.0/gschemas.compiled temp-bin/share/glib-2.0/ mkdir -p temp-bin/share/icons/Adwaita - cp -r /mingw32/share/icons/Adwaita/{scalable,icon-theme.cache,index.theme} temp-bin/share/icons/Adwaita/ + # FIXME: It should be sufficient to package the SVG icons, + # but I cannot get it to work. Perhaps index.theme would have to be tweaked. + # We could also try to include a pure scalable icon theme. + #cp -r /mingw32/share/icons/Adwaita/{scalable*,index.theme} temp-bin/share/icons/Adwaita/ + cp -r /mingw32/share/icons/Adwaita/* temp-bin/share/icons/Adwaita/ + gtk-update-icon-cache-3.0 temp-bin/share/icons/Adwaita/ + # FIXME: It's possible to change the location of loaders.cache via $GDK_PIXBUF_MODULE_FILE. + # If we did that, we could avoid "reusing" the lib/ directory. + # This is important when somebody changes $SCITECOPATH. mkdir -p temp-bin/lib/gdk-pixbuf-2.0/2.10.0/loaders/ - cp /mingw32/lib/gdk-pixbuf-2.0/2.10.0/loaders/{libpixbufloader-svg.dll,libpixbufloader-png.dll} temp-bin/lib/gdk-pixbuf-2.0/2.10.0/loaders/ + cp /mingw32/lib/gdk-pixbuf-2.0/2.10.0/loaders/{libpixbufloader-svg.dll,libpixbufloader-png.dll} \ + temp-bin/lib/gdk-pixbuf-2.0/2.10.0/loaders/ + cp win32/loaders.cache temp-bin/lib/gdk-pixbuf-2.0/2.10.0/ - name: Get Current Date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - name: Archive Windows Distribution (GTK+ 3) uses: actions/upload-artifact@v2 with: - name: SciTECO nightly packages on ${{ steps.date.outputs.date }} (Win32, GTK+ 3) + name: SciTECO nightly build on ${{ steps.date.outputs.date }} (Win32, GTK+ 3) path: temp-bin/* diff --git a/Makefile.am b/Makefile.am index 6a866ba..80b0ca6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,6 +18,8 @@ dist_pkgdata_DATA += ico/sciteco-16.png ico/sciteco-32.png \ ico/sciteco-48.png EXTRA_DIST += ico/sciteco-256.png ico/sciteco.ico +EXTRA_DIST += win32/loaders.cache + # Distribute entire scintilla directory and # do some manual cleanup dist-hook: diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 9c16a5d..567f034 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -931,23 +931,34 @@ teco_interface_event_loop(GError **error) return FALSE; } - static const gchar *icon_files[] = {"sciteco-48.png", "sciteco-32.png", "sciteco-16.png"}; +#ifdef G_OS_WIN32 + /* + * FIXME: This is necessary so that the icon themes are found in the same + * directory as sciteco.exe. + * This fails of course when $SCITECOCONFIG is changed. + * We should perhaps always use the absolute path of sciteco.exe. + * If you want to install SciTECO differently, you can still set + * $XDG_DATA_DIRS. + * + * FIXME FIXME FIXME: This is also currently broken. + */ + //g_autofree char *theme_path = g_build_filename(scitecoconfig.data, "icons"); + //gtk_icon_theme_prepend_search_path(gtk_icon_theme_get_default(), theme_path); +#else + /* + * Load icons for the GTK window. + * This is not necessary on Windows since the icon included + * as a resource will be used by default. + */ + static const gchar *icon_files[] = { + SCITECODATADIR G_DIR_SEPARATOR_S "sciteco-48.png", + SCITECODATADIR G_DIR_SEPARATOR_S "sciteco-32.png", + SCITECODATADIR G_DIR_SEPARATOR_S "sciteco-16.png" + }; GList *icon_list = NULL; for (gint i = 0; i < G_N_ELEMENTS(icon_files); i++) { - /* - * FIXME: Looking for icon files in $SCITECOCONFIG on Windows makes - * sure they are usually found in the installation directory. - * Theoretically, $SCITECOCONFIG could be changed, though. - * Perhaps it would be cleaner to have a global variable pointing - * to the absolute directory of the binary. - */ -#ifdef G_OS_WIN32 - g_autofree gchar *icon_path = g_build_filename(scitecoconfig.data, icon_files[i], NULL); -#else - g_autofree gchar *icon_path = g_build_filename(SCITECODATADIR, icon_files[i], NULL); -#endif - GdkPixbuf *icon_pixbuf = gdk_pixbuf_new_from_file(icon_path, NULL); + GdkPixbuf *icon_pixbuf = gdk_pixbuf_new_from_file(icon_files[i], NULL); /* fail silently if there's a problem with one of the icons */ if (icon_pixbuf) @@ -957,6 +968,7 @@ teco_interface_event_loop(GError **error) gtk_window_set_default_icon_list(icon_list); g_list_free_full(icon_list, g_object_unref); +#endif teco_interface_refresh_info(); @@ -1082,11 +1094,8 @@ static void teco_interface_cmdline_size_allocate_cb(GtkWidget *widget, GdkRectangle *allocation, gpointer user_data) { - /* - * The GDK lock is already held, so we avoid using teco_view_ssm(). - */ - scintilla_send_message(SCINTILLA(widget), SCI_SETXCARETPOLICY, - CARET_SLOP, allocation->width/2); + teco_view_ssm(teco_interface.cmdline_view, + SCI_SETXCARETPOLICY, CARET_SLOP, allocation->width/2); } static gboolean diff --git a/win32/loaders.cache b/win32/loaders.cache new file mode 100644 index 0000000..a34ae4d --- /dev/null +++ b/win32/loaders.cache @@ -0,0 +1,12 @@ +"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.dll" +"png" 5 "gdk-pixbuf" "PNG" "LGPL" +"image/png" "" +"png" "" +"\211PNG\r\n\032\n" "" 100 + +"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll" +"svg" 6 "gdk-pixbuf" "Scalable Vector Graphics" "LGPL" +"image/svg+xml" "image/svg" "image/svg-xml" "image/vnd.adobe.svg+xml" "text/xml-svg" "image/svg+xml-compressed" "" +"svg" "svgz" "svg.gz" "" +" <svg" "* " 100 +" <!DOCTYPE svg" "* " 100 |