Force enable menu icons under GTK

GTK specific: Fixed missing icons for wxMenuItem on GTK2 and GTK3 for skins that haven't enabled showing an icon for gtk_image_menu_item by forcing showing icons for every skin.
This commit is contained in:
tamasmeszaros 2021-08-24 09:44:32 +02:00
parent fefc20dbbb
commit 326fb51316

View file

@ -87,6 +87,11 @@
#include <boost/nowide/fstream.hpp> #include <boost/nowide/fstream.hpp>
#endif // ENABLE_THUMBNAIL_GENERATOR_DEBUG #endif // ENABLE_THUMBNAIL_GENERATOR_DEBUG
// Needed for forcing menu icons back under gtk2 and gtk3
#if defined(__WXGTK20__) || defined(__WXGTK3__)
#include <gtk/gtk.h>
#endif
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
@ -799,6 +804,14 @@ bool GUI_App::OnInit()
bool GUI_App::on_init_inner() bool GUI_App::on_init_inner()
{ {
// Forcing back menu icons under gtk2 and gtk3. Solution is based on:
// https://docs.gtk.org/gtk3/class.Settings.html
// see also https://docs.wxwidgets.org/3.0/classwx_menu_item.html#a2b5d6bcb820b992b1e4709facbf6d4fb
// TODO: Find workaround for GTK4
#if defined(__WXGTK20__) || defined(__WXGTK3__)
g_object_set (gtk_settings_get_default (), "gtk-menu-images", TRUE, NULL);
#endif
// Verify resources path // Verify resources path
const wxString resources_dir = from_u8(Slic3r::resources_dir()); const wxString resources_dir = from_u8(Slic3r::resources_dir());
wxCHECK_MSG(wxDirExists(resources_dir), false, wxCHECK_MSG(wxDirExists(resources_dir), false,