build: patch wxWidgets on macOS for alert bug

Add a patch to our build of wxWidgets for macOS to fix the alert sound
bug, as described here:

https://github.com/wxWidgets/wxWidgets/issues/25262#issuecomment-2745905462

. Add a macro to disable our workaround for this bug when a CMake option
indicating that this patch was applied is `TRUE`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover
2025-05-29 15:42:36 +00:00
parent 88302602ca
commit 5972e73e37
5 changed files with 19 additions and 0 deletions

View File

@@ -191,3 +191,13 @@ if(TRANSLATIONS_ONLY AND (ENABLE_SDL OR ENABLE_WX))
endif()
option(GPG_SIGNATURES "Create GPG signatures for release files" OFF)
if(APPLE)
set(wx_mac_patched_default OFF)
if(UPSTREAM_RELEASE)
set(wx_mac_patched_default ON)
endif()
option(WX_MAC_PATCHED "A build of wxWidgets that is patched for the alert sound bug is being used" ${wx_mac_patched_default})
endif()

View File

@@ -1021,6 +1021,10 @@ if(APPLE)
endif()
if(APPLE AND UPSTREAM_RELEASE)
if(WX_MAC_PATCHED)
set_target_compile_definitions(visualboyadvance-m PRIVATE VBAM_WX_MAC_PATCHED_FOR_ALERT_SOUND)
endif()
if(CMAKE_BUILD_TYPE MATCHES "^(Release|MinSizeRel)$")
find_program(STRIP_PROGRAM strip)

View File

@@ -1442,6 +1442,7 @@ int wxvbamApp::FilterEvent(wxEvent& event)
return user_input_event.FilterProcessedInput(user_input.value());
}
#ifndef VBAM_WX_MAC_PATCHED_FOR_ALERT_SOUND
bool wxvbamApp::ProcessEvent(wxEvent& event) {
if (event.GetEventType() == wxEVT_KEY_DOWN) {
// First, figure out if the focused window can process the key down event.
@@ -1461,3 +1462,4 @@ bool wxvbamApp::ProcessEvent(wxEvent& event) {
}
return wxApp::ProcessEvent(event);
}
#endif

View File

@@ -85,7 +85,9 @@ public:
return false;
}
}
#ifndef VBAM_WX_MAC_PATCHED_FOR_ALERT_SOUND
bool ProcessEvent(wxEvent& event) final;
#endif
wxString GetConfigDir();
wxString GetDataDir();

View File

@@ -247,6 +247,7 @@ table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg "--disable-videotoolbox --extr
#table_line_append DIST_PATCHES ffmpeg "-p0 https://gist.githubusercontent.com/rkitover/db75d083b74617b186eec11965c1da74/raw/20da2f8c6d8c02ce284096c5e805ae671351cc6e/ffmpeg-macos10-7.patch"
table_line_append DIST_PATCHES wxwidgets "-p1 https://gist.githubusercontent.com/rkitover/ea85fa30bbb3e6378e845c7934e3e01d/raw/9090dbab11861da8725c8d17433b4d90ebfbb82e/wx-macOS.patch"
if [ -n "$APPLE_SILICON" ] && [ "$target_cpu" != ARM64 ]; then
table_line_append DIST_CONFIGURE_OVERRIDES ffmpeg '--disable-asm'