Mac: changes needed for wxWidgets 3.1.6 and for args now accepted by patch utility

This commit is contained in:
Charlie Fenton 2023-04-06 04:50:24 -07:00
parent 5d4f9b3a54
commit 1bed9a9831
4 changed files with 49 additions and 32 deletions

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2022 University of California
// Copyright (C) 2023 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@ -410,13 +410,22 @@ wxMenu *CTaskBarIcon::CreatePopupMenu() {
// 16x16 icon for the menubar, while the Dock needs a 128x128 icon.
// Rather than using an entire separate icon, overlay the Dock icon with a badge
// so we don't need additional Snooze and Disconnected icons for branding.
bool CTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& ) {
#if wxCHECK_VERSION(3,1,6)
bool CTaskBarIcon::SetIcon(const wxBitmapBundle& newIcon, const wxString& )
#else
bool CTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& )
#endif
{
wxImage macIcon;
#if wxDEBUG_LEVEL
int err = noErr;
#endif
int w, h, x, y;
#if wxCHECK_VERSION(3,1,6)
wxIcon icon = newIcon.GetIcon(wxDefaultSize);
#endif
if (m_iconType != wxTBI_DOCK) {
if (wxGetApp().GetBOINCMGRHideMenuBarIcon()) {
RemoveIcon();
@ -481,7 +490,7 @@ bool CTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& ) {
return true;
}
#endif // ! __WXMAC__
#endif // __WXMAC__
void CTaskBarIcon::DisplayContextMenu() {

View File

@ -1,6 +1,6 @@
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
// Copyright (C) 2023 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
@ -81,7 +81,11 @@ private:
public:
wxMenu *CreatePopupMenu();
#if wxCHECK_VERSION(3,1,6)
bool SetIcon(const wxBitmapBundle& icon, const wxString& message = wxEmptyString);
#else
bool SetIcon(const wxIcon& icon, const wxString& message = wxEmptyString);
#endif
#define BALLOONTYPE_INFO 0
bool IsBalloonsSupported();
@ -92,7 +96,7 @@ public:
const wxString message = wxEmptyString,
unsigned int iconballoon = BALLOONTYPE_INFO
);
#endif
#endif // __WXMAC__
wxIcon m_iconTaskBarNormal;
wxIcon m_iconTaskBarDisconnected;

View File

@ -3980,13 +3980,13 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ../clientgui/mac/MacGUI.pch;
HEADER_SEARCH_PATHS = (
"../../wxWidgets-3.1.5/include",
"../../wxWidgets-3.1.5/build/osx/setup/cocoa/include",
"../../wxWidgets-3.1.6/include",
"../../wxWidgets-3.1.6/build/osx/setup/cocoa/include",
../clientgui,
"../lib/**",
);
INFOPLIST_FILE = Info.plist;
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.5/build/osx/build/Debug";
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.6/build/osx/build/Debug";
OTHER_CFLAGS = (
"-DHAVE_CONFIG_H",
"-D_FILE_OFFSET_BITS=64",
@ -4058,13 +4058,13 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ../clientgui/mac/MacGUI.pch;
HEADER_SEARCH_PATHS = (
"../../wxWidgets-3.1.5/include",
"../../wxWidgets-3.1.5/build/osx/setup/cocoa/include",
"../../wxWidgets-3.1.6/include",
"../../wxWidgets-3.1.6/build/osx/setup/cocoa/include",
../clientgui,
"../lib/**",
);
INFOPLIST_FILE = Info.plist;
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.5/build/osx/build/Release";
LIBRARY_SEARCH_PATHS = "../../wxWidgets-3.1.6/build/osx/build/Release";
OTHER_CFLAGS = (
"-DHAVE_CONFIG_H",
"-D_FILE_OFFSET_BITS=64",

View File

@ -18,7 +18,7 @@
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
#
#
# Script to build the wxMac-3.1.0 wxCocoa library for BOINC
# Script to build the wxMac-3.1.6 wxCocoa library for BOINC
#
# by Charlie Fenton 7/21/06
# Updated for wx-Mac 2.8.10 and Unicode 4/17/09
@ -44,11 +44,12 @@
# Updated 9/30/21 for wxCocoa 3.1.5
# Updated 10/18/21 to add -Werror=unguarded-availability compiler flag
# Updated 2/6/23 changed MACOSX_DEPLOYMENT_TARGET to 10.13
# Updated 4/6/23 for wxCocoa 3.1.6 and for args now accepted by patch utility
#
## This script requires OS 10.6 or later
##
## In Terminal, CD to the wxWidgets-3.1.0 directory.
## cd [path]/wxWidgets-3.1.0/
## In Terminal, CD to the wxWidgets-3.1.6 directory.
## cd [path]/wxWidgets-3.1.6/
## then run this script:
## source [ path_to_this_script ] [ -clean ] [ -nodebug ] [--prefix PATH]
##
@ -82,11 +83,11 @@ echo ""
##
## We patch 4 files to accomplish this.
##
# Patch wxWidgets-3.1.5/include/wx/osx/choice.h
# Patch wxWidgets-3.1.6/include/wx/osx/choice.h
if [ ! -f include/wx/osx/choice.h.orig ]; then
cat >> /tmp/choice_h_diff << ENDOFFILE
--- include/wx/osx/choice.h 2021-04-12 15:23:58.000000000 -0700
+++ include/wx/osx/choice_patched.h 2021-09-29 23:47:19.000000000 -0700
--- include/wx/osx/choice.h
+++ include/wx/osx/choice_patched.h
@@ -73,6 +73,7 @@
virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE;
virtual wxString GetString(unsigned int n) const wxOVERRIDE;
@ -96,7 +97,7 @@ if [ ! -f include/wx/osx/choice.h.orig ]; then
virtual bool OSXHandleClicked(double timestampsec) wxOVERRIDE;
ENDOFFILE
patch -bfi /tmp/choice_h_diff include/wx/osx/choice.h
patch -b -f -i /tmp/choice_h_diff include/wx/osx/choice.h
rm -f /tmp/choice_h_diff
else
echo "include/wx/osx/choice.h already patched"
@ -104,12 +105,12 @@ fi
echo ""
# Patch wxWidgets-3.1.5/src/osx/choice_osx.cpp
# Patch wxWidgets-3.1.6/src/osx/choice_osx.cpp
if [ ! -f src/osx/choice_osx.cpp.orig ]; then
cat >> /tmp/choice_osx_cpp_diff << ENDOFFILE
--- src/osx/choice_osx.cpp 2021-04-12 15:23:58.000000000 -0700
+++ src/osx/choice_osx_patched.cpp 2021-09-30 00:26:06.000000000 -0700
@@ -212,6 +212,13 @@
@@ -217,6 +217,13 @@
return m_strings[n] ;
}
@ -124,7 +125,7 @@ if [ ! -f src/osx/choice_osx.cpp.orig ]; then
// client data
// ----------------------------------------------------------------------------
ENDOFFILE
patch -bfi /tmp/choice_osx_cpp_diff src/osx/choice_osx.cpp
patch -b -f -i /tmp/choice_osx_cpp_diff src/osx/choice_osx.cpp
rm -f /tmp/choice_osx_cpp_diff
else
echo "src/osx/choice_osx.cpp already patched"
@ -132,12 +133,12 @@ fi
echo ""
# Patch wxWidgets-3.1.5/include/wx/osx/core/private.h
# Patch wxWidgets-3.1.6/include/wx/osx/core/private.h
if [ ! -f include/wx/osx/core/private.h.orig ]; then
cat >> /tmp/private_h_cpp_diff << ENDOFFILE
--- include/wx/osx/core/private.h 2021-04-12 15:23:58.000000000 -0700
+++ include/wx/osx/core/private_patched.h 2021-09-30 01:11:28.000000000 -0700
@@ -809,6 +809,8 @@
@@ -821,6 +821,8 @@
}
virtual void SetItem(int pos, const wxString& item) = 0;
@ -147,7 +148,7 @@ if [ ! -f include/wx/osx/core/private.h.orig ]; then
ENDOFFILE
patch -bfi /tmp/private_h_cpp_diff include/wx/osx/core/private.h
patch -b -f -i /tmp/private_h_cpp_diff include/wx/osx/core/private.h
rm -f /tmp/private_h_cpp_diff
else
echo "include/wx/osx/core/private.h already patched"
@ -155,26 +156,29 @@ fi
echo ""
# Patch wxWidgets-3.1.5/src/osx/cocoa/choice.mm
# Patch wxWidgets-3.1.6/src/osx/cocoa/choice.mm
if [ ! -f src/osx/cocoa/choice.mm.orig ]; then
cat >> /tmp/choice_mm_diff << ENDOFFILE
--- src/osx/cocoa/choice.mm 2021-09-28 22:52:32.000000000 -0700
+++ src/osx/cocoa/choice_patched.mm 2021-09-30 01:08:32.000000000 -0700
@@ -130,6 +130,12 @@
@@ -130,6 +130,15 @@
m_popUpMenu->FindItemByPosition( pos )->SetItemLabel( s ) ;
}
+ void SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
+ void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) wxOVERRIDE
+ {
+ if ( bitmap.Ok() )
+ m_popUpMenu->FindItemByPosition( n )->SetBitmap( bitmap ); ;
+ if ( bitmap.Ok() ) {
+ wxMenuItem *item = m_popUpMenu->FindItemByPosition( n );
+ item->SetBitmap( bitmap );
+ item->UpdateItemBitmap();
+ }
+ }
+
private:
wxMenu* m_popUpMenu;
};
ENDOFFILE
patch -bfi /tmp/choice_mm_diff src/osx/cocoa/choice.mm
patch -b -f -i /tmp/choice_mm_diff src/osx/cocoa/choice.mm
rm -f /tmp/choice_mm_diff
else
echo "src/osx/cocoa/choice.mm already patched"
@ -273,7 +277,7 @@ else
## systems supported by BOINC.
set -o pipefail
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Release $doclean build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.13" GCC_C_LANGUAE_STANDARD="compiler-default" CLANG_CXX_LANGUAGE_SANDARD="c++0x" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER NO_CXX11_REGEX WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Release $doclean build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.13" GCC_C_LANGUAE_STANDARD="compiler-default" CLANG_CXX_LANGUAGE_STANDARD="compiler-default" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DwxDEBUG_LEVEL=0 -DPNG_ARM_NEON_OPT=0 -DNDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="\$(GCC_PREPROCESSOR_DEFINITIONS) wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
if [ ${retval} -ne 0 ]; then return 1; fi
if [ "x${lprefix}" != "x" ]; then
# copy library and headers to $lprefix
@ -329,7 +333,7 @@ else
## $(ARCHS_STANDARD) builds Universal Binary (x86_64 & arm64) library under
## Xcode versions that can, otherwise it builds only the X86_64 library.
set -o pipefail
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.13" GCC_C_LANGUAE_STANDARD="compiler-default" CLANG_CXX_LANGUAGE_SANDARD="c++0x" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -include unistd.h" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="WXBUILDING __WXOSX_COCOA__ __WX__ wxUSE_BASE=1 _FILE_OFFSET_BITS=64 _LARGE_FILES MACOS_CLASSIC __WXMAC_XCODE__=1 SCI_LEXER NO_CXX11_REGEX WX_PRECOMP=1 wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
xcodebuild -project build/osx/wxcocoa.xcodeproj -target static -configuration Debug build ARCHS="\$(ARCHS_STANDARD)" ONLY_ACTIVE_ARCH="NO" MACOSX_DEPLOYMENT_TARGET="10.13" GCC_C_LANGUAE_STANDARD="compiler-default" CLANG_CXX_LANGUAGE_STANDARD="compiler-default" CLANG_CXX_LIBRARY="libc++" OTHER_CFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden" OTHER_CPLUSPLUSFLAGS="-Wall -Wundef -Werror=unguarded-availability -fno-strict-aliasing -fno-common -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DwxUSE_UNICODE=1 -DPNG_ARM_NEON_OPT=0 -DDEBUG -fvisibility=hidden -fvisibility-inlines-hidden" GCC_PREPROCESSOR_DEFINITIONS="\$(GCC_PREPROCESSOR_DEFINITIONS) wxUSE_UNICODE_UTF8=1 wxUSE_UNICODE_WCHAR=0 __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" | $beautifier; retval=$?
if [ ${retval} -ne 0 ]; then return 1; fi
if [ "x${lprefix}" != "x" ]; then
# copy debug library to $PREFIX