From eb0231248cba271a1bb5fbfe4b8c974617c2b600 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Sat, 28 Oct 2023 05:55:06 -0700 Subject: [PATCH] Mac installer: don't offer to set BOINC as screensaver when running under MacOS 14 Sonoma --- mac_installer/PostInstall.cpp | 37 ++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/mac_installer/PostInstall.cpp b/mac_installer/PostInstall.cpp index d3683a76fa3..131444f59ac 100644 --- a/mac_installer/PostInstall.cpp +++ b/mac_installer/PostInstall.cpp @@ -1678,19 +1678,27 @@ OSErr UpdateAllVisibleUsers(long brandID, long oldBrandID) } } - if (! saverAlreadySetForAll) { - if (gCommandLineInstall) { - err = stat("/tmp/setboincsaver.txt", &sbuf); - if (err == noErr) { - puts("setboincsaver.txt file detected\n"); - fflush(stdout); - unlink("/tmp/setboincsaver.txt"); - setSaverForAllUsers = true; - } - } else { - setSaverForAllUsers = ShowMessage(true, + // As of MacOS 14.0, the legacyScreenSaver sandbox prevents using + // IOSurfaceLookupFromMachPort. I have filed bug report FB13300491 + // with Apple and hope they will change this in a future MacOS. + // Also as of MacOS 14.0 Sonoma, we can't set the screensaver + //automatically. I have filed bug report FB13270885 about this. + // See a;so the comment at top of SetScreenSaverSelection(). + if (compareOSVersionTo(14, 0) < 0) { + if (! saverAlreadySetForAll) { + if (gCommandLineInstall) { + err = stat("/tmp/setboincsaver.txt", &sbuf); + if (err == noErr) { + puts("setboincsaver.txt file detected\n"); + fflush(stdout); + unlink("/tmp/setboincsaver.txt"); + setSaverForAllUsers = true; + } + } else { + setSaverForAllUsers = ShowMessage(true, (char *)_("Do you want to set %s as the screensaver for all %s users on this Mac?"), brandName[brandID], brandName[brandID]); + } } } @@ -2008,6 +2016,8 @@ OSErr UpdateAllVisibleUsers(long brandID, long oldBrandID) } +// As of MacOS 14.0 Sonoma, this code no longer will detect the current screensaver, +// and will need to be rewritten. See the comment at top of SetScreenSaverSelection(). OSErr GetCurrentScreenSaverSelection(passwd *pw, char *moduleName, size_t maxLen) { char buf[1024]; FILE *f; @@ -2047,6 +2057,11 @@ OSErr GetCurrentScreenSaverSelection(passwd *pw, char *moduleName, size_t maxLen } +// As of MacOS 14.0 Sonoma, we can't set the screensaver automatically. +// I have filed bug report FB13270885 about this. After this is fixed, +// probably need to put an AppleScript to do this in the launch agent +// we add for each user. See also: +// https://forum.iscreensaver.com/t/understanding-the-macos-sonoma-screensaver-plist/718 OSErr SetScreenSaverSelection(char *moduleName, char *modulePath, int type) { OSErr err = noErr; CFStringRef preferenceName = CFSTR("com.apple.screensaver");