Compare commits

...

2 Commits

Author SHA1 Message Date
0371dd95dd
sdgui: fix popup menu alignment
On Windows 10 GTK+ completely failed to turn it around
so that it would be visible.
2021-10-23 18:51:23 +02:00
cbdb1cfaa6
Remove unnecessary DLLs from Windows builds
This saves 21 MiB of MSYS2 libraries, without any adverse effects.

The MSYS2 build remains bloated, due to the Adwaita icon theme.
2021-10-23 18:27:43 +02:00
3 changed files with 44 additions and 5 deletions

View File

@ -244,8 +244,7 @@ elseif (WITH_GUI)
install (DIRECTORY install (DIRECTORY
${WIN32_DEPENDS_PATH}/bin/ ${WIN32_DEPENDS_PATH}/bin/
DESTINATION . DESTINATION .
FILES_MATCHING PATTERN "*.dll" FILES_MATCHING PATTERN "*.dll")
PATTERN "libgettext*" EXCLUDE)
install (DIRECTORY install (DIRECTORY
${WIN32_DEPENDS_PATH}/etc/ ${WIN32_DEPENDS_PATH}/etc/
DESTINATION etc) DESTINATION etc)
@ -263,6 +262,8 @@ elseif (WITH_GUI)
install (FILES install (FILES
${WIN32_DEPENDS_PATH}/share/icons/hicolor/index.theme ${WIN32_DEPENDS_PATH}/share/icons/hicolor/index.theme
DESTINATION share/icons/hicolor) DESTINATION share/icons/hicolor)
install (SCRIPT cmake/Win32Cleanup.cmake)
endif () endif ()
# Do some unit tests # Do some unit tests

37
cmake/Win32Cleanup.cmake Normal file
View File

@ -0,0 +1,37 @@
# To be run from cmake_install.cmake, eradicates all unreferenced libraries.
# CMake 3.9.6 has a parsing bug with ENCODING UTF-8.
cmake_minimum_required (VERSION 3.10)
# CPack runs this almost without any CMake variables at all
# (cmStateSnapshot::SetDefaultDefinitions(), CMAKE_INSTALL_PREFIX, [DESTDIR])
set (installdir "${CMAKE_INSTALL_PREFIX}")
if (NOT installdir OR installdir MATCHES "^/usr(/|$)")
return ()
endif ()
# The function is recursive and CMake has tragic scoping behaviour;
# environment variables are truly global there, in the absence of a cache
unset (ENV{seen})
function (expand path)
set (seen $ENV{seen})
if (path IN_LIST seen OR NOT EXISTS "${path}")
return ()
endif ()
set (ENV{seen} "$ENV{seen};${path}")
file (STRINGS "${path}" strings REGEX "[.][Dd][Ll][Ll]$" ENCODING UTF-8)
foreach (string ${strings})
string (REGEX MATCH "[-.+_a-zA-Z0-9]+$" word "${string}")
expand ("${installdir}/${word}")
endforeach ()
endfunction ()
file (GLOB roots LIST_DIRECTORIES false "${installdir}/*.[Ee][Xx][Ee]"
"${installdir}/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.[Dd][Ll][Ll]")
foreach (binary ${roots})
expand ("${binary}")
endforeach ()
file (GLOB libraries LIST_DIRECTORIES false "${installdir}/*.[Dd][Ll][Ll]")
list (REMOVE_ITEM libraries $ENV{seen})
file (REMOVE ${libraries})

View File

@ -407,6 +407,7 @@ main (int argc, char *argv[])
G_CALLBACK (on_selection_watch_toggle), NULL); G_CALLBACK (on_selection_watch_toggle), NULL);
GtkWidget *menu = gtk_menu_new (); GtkWidget *menu = gtk_menu_new ();
gtk_widget_set_halign (menu, GTK_ALIGN_END);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_open); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_open);
#ifndef WIN32 #ifndef WIN32
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_selection); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item_selection);
@ -414,10 +415,10 @@ main (int argc, char *argv[])
gtk_widget_show_all (menu); gtk_widget_show_all (menu);
g.hamburger = gtk_menu_button_new (); g.hamburger = gtk_menu_button_new ();
gtk_menu_button_set_direction
(GTK_MENU_BUTTON (g.hamburger), GTK_ARROW_NONE);
gtk_menu_button_set_popup (GTK_MENU_BUTTON (g.hamburger), menu);
gtk_button_set_relief (GTK_BUTTON (g.hamburger), GTK_RELIEF_NONE); gtk_button_set_relief (GTK_BUTTON (g.hamburger), GTK_RELIEF_NONE);
gtk_button_set_image (GTK_BUTTON (g.hamburger), gtk_image_new_from_icon_name
("open-menu-symbolic", GTK_ICON_SIZE_BUTTON));
gtk_menu_button_set_popup (GTK_MENU_BUTTON (g.hamburger), menu);
gtk_widget_show (g.hamburger); gtk_widget_show (g.hamburger);
g.notebook = gtk_notebook_new (); g.notebook = gtk_notebook_new ();