mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
fix build errors on Linux with Clang 20 and GTK warnings (#12507)
* guard -Wno-error=enum-constexpr-conversion behind compiler flag check * Fix: Suppress GTK critical warnings and prevent multiple URI scheme registrations in WebView
This commit is contained in:
@@ -436,7 +436,11 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 15)
|
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 15)
|
||||||
add_compile_options(-Wno-error=enum-constexpr-conversion)
|
include(CheckCXXCompilerFlag)
|
||||||
|
check_cxx_compiler_flag(-Wno-error=enum-constexpr-conversion HAS_WNO_ERROR_ENUM_CONSTEXPR_CONV)
|
||||||
|
if(HAS_WNO_ERROR_ENUM_CONSTEXPR_CONV)
|
||||||
|
add_compile_options(-Wno-error=enum-constexpr-conversion)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
|
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
|
||||||
|
|||||||
@@ -2697,6 +2697,18 @@ bool GUI_App::on_init_inner()
|
|||||||
g_object_set (gtk_settings_get_default (), "gtk-menu-images", TRUE, NULL);
|
g_object_set (gtk_settings_get_default (), "gtk-menu-images", TRUE, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__WXGTK20__) || defined(__WXGTK3__)
|
||||||
|
// Suppress harmless GTK critical warnings from the GTK3/wxWidgets interaction.
|
||||||
|
// These include widget allocation on hidden widgets and events on unrealized widgets.
|
||||||
|
g_log_set_handler("Gtk", G_LOG_LEVEL_CRITICAL,
|
||||||
|
[](const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) {
|
||||||
|
if (message && (strstr(message, "gtk_widget_set_allocation") ||
|
||||||
|
strstr(message, "WIDGET_REALIZED_FOR_EVENT")))
|
||||||
|
return;
|
||||||
|
g_log_default_handler(log_domain, log_level, message, user_data);
|
||||||
|
}, nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
//BBS set crash log folder
|
//BBS set crash log folder
|
||||||
CBaseException::set_log_folder(data_dir());
|
CBaseException::set_log_folder(data_dir());
|
||||||
|
|||||||
@@ -65,20 +65,20 @@ void Label::initSysFont()
|
|||||||
wxString font_path = wxString::FromUTF8(resource_path + "/fonts/HarmonyOS_Sans_SC_Bold.ttf");
|
wxString font_path = wxString::FromUTF8(resource_path + "/fonts/HarmonyOS_Sans_SC_Bold.ttf");
|
||||||
bool result = wxFont::AddPrivateFont(font_path);
|
bool result = wxFont::AddPrivateFont(font_path);
|
||||||
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of HarmonyOS_Sans_SC_Bold returns %1%")%result;
|
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of HarmonyOS_Sans_SC_Bold returns %1%")%result;
|
||||||
printf("add font of HarmonyOS_Sans_SC_Bold returns %d\n", result);
|
// printf("add font of HarmonyOS_Sans_SC_Bold returns %d\n", result);
|
||||||
font_path = wxString::FromUTF8(resource_path + "/fonts/HarmonyOS_Sans_SC_Regular.ttf");
|
font_path = wxString::FromUTF8(resource_path + "/fonts/HarmonyOS_Sans_SC_Regular.ttf");
|
||||||
result = wxFont::AddPrivateFont(font_path);
|
result = wxFont::AddPrivateFont(font_path);
|
||||||
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of HarmonyOS_Sans_SC_Regular returns %1%")%result;
|
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of HarmonyOS_Sans_SC_Regular returns %1%")%result;
|
||||||
printf("add font of HarmonyOS_Sans_SC_Regular returns %d\n", result);
|
// printf("add font of HarmonyOS_Sans_SC_Regular returns %d\n", result);
|
||||||
// Adding NanumGothic Regular and Bold
|
// Adding NanumGothic Regular and Bold
|
||||||
font_path = wxString::FromUTF8(resource_path + "/fonts/NanumGothic-Regular.ttf");
|
font_path = wxString::FromUTF8(resource_path + "/fonts/NanumGothic-Regular.ttf");
|
||||||
result = wxFont::AddPrivateFont(font_path);
|
result = wxFont::AddPrivateFont(font_path);
|
||||||
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of NanumGothic-Regular returns %1%")%result;
|
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of NanumGothic-Regular returns %1%")%result;
|
||||||
printf("add font of NanumGothic-Regular returns %d\n", result);
|
// printf("add font of NanumGothic-Regular returns %d\n", result);
|
||||||
font_path = wxString::FromUTF8(resource_path + "/fonts/NanumGothic-Bold.ttf");
|
font_path = wxString::FromUTF8(resource_path + "/fonts/NanumGothic-Bold.ttf");
|
||||||
result = wxFont::AddPrivateFont(font_path);
|
result = wxFont::AddPrivateFont(font_path);
|
||||||
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of NanumGothic-Bold returns %1%")%result;
|
// BOOST_LOG_TRIVIAL(info) << boost::format("add font of NanumGothic-Bold returns %1%")%result;
|
||||||
printf("add font of NanumGothic-Bold returns %d\n", result);
|
// printf("add font of NanumGothic-Bold returns %d\n", result);
|
||||||
#endif
|
#endif
|
||||||
Head_48 = Label::sysFont(48, true);
|
Head_48 = Label::sysFont(48, true);
|
||||||
Head_32 = Label::sysFont(32, true);
|
Head_32 = Label::sysFont(32, true);
|
||||||
|
|||||||
@@ -277,10 +277,15 @@ wxWebView* WebView::CreateWebView(wxWindow * parent, wxString const & url)
|
|||||||
// And the memory: file system
|
// And the memory: file system
|
||||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
||||||
#else
|
#else
|
||||||
// With WKWebView handlers need to be registered before creation
|
// With WKWebView handlers need to be registered before creation.
|
||||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
// On Linux (WebKit2GTK), URI schemes are registered globally and can only
|
||||||
// And the memory: file system
|
// be registered once, so guard against multiple registrations.
|
||||||
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
static bool s_schemes_registered = false;
|
||||||
|
if (!s_schemes_registered) {
|
||||||
|
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
|
||||||
|
webView->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));
|
||||||
|
s_schemes_registered = true;
|
||||||
|
}
|
||||||
webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
webView->Create(parent, wxID_ANY, url2, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
|
||||||
webView->SetUserAgent(wxString::Format("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) BBL-Slicer/v%s (%s) BBL-Language/%s",
|
webView->SetUserAgent(wxString::Format("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) BBL-Slicer/v%s (%s) BBL-Language/%s",
|
||||||
SLIC3R_VERSION, Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light", language_code.mb_str()));
|
SLIC3R_VERSION, Slic3r::GUI::wxGetApp().dark_mode() ? "dark" : "light", language_code.mb_str()));
|
||||||
|
|||||||
Reference in New Issue
Block a user