Mac: screensaver check release portion of library version number used to build graphics app

Fix build error on Windows
This commit is contained in:
Charlie Fenton 2024-05-03 04:59:31 -07:00
parent 51ce18af24
commit 67559d2e3c
4 changed files with 12 additions and 8 deletions

View File

@ -55,7 +55,7 @@ void setGGFXChangePeriod(double value);
double getDTime();
void doBoinc_Sleep(double seconds);
void launchedGfxApp(char * appPath, char * wuName, pid_t thePID, int slot);
int compareBOINCLibVersionTo(int toMajor, int toMinor);
int compareBOINCLibVersionTo(int toMajor, int toMinor, int toRelease);
void print_to_log_file(const char *format, ...);
void strip_cr(char *buf);
void PrintBacktrace(void);

View File

@ -93,7 +93,7 @@ void setGGFXChangePeriod(double value);
double getDTime();
void doBoinc_Sleep(double seconds);
void launchedGfxApp(char * appPath, char * wuName, pid_t thePID, int slot);
int compareBOINCLibVersionTo(int toMajor, int toMinor);
int compareBOINCLibVersionTo(int toMajor, int toMinor, int toRelease);
void print_to_log_file(const char *format, ...);
void strip_cr(char *buf);
void PrintBacktrace(void);

View File

@ -177,7 +177,8 @@ static bool myIsPreview;
#define MAX_CGWINDOWLIST_TRIES 3
#define MAJORBOINCGFXLIBNEEDEDFORSONOMA 8
#define MINORBOINCGFXLIBNEEDEDFORSONOMA 1
#define MINORBOINCGFXLIBNEEDEDFORSONOMA 0
#define RELEASEBOINCGFXLIBNEEDEDFORSONOMA 2
int signof(float x) {
return (x > 0.0 ? 1 : -1);
@ -658,7 +659,7 @@ void launchedGfxApp(char * appPath, char * wuName, pid_t thePID, int slot) {
if (gIsCatalina) {
if (gMach_bootstrap_unavailable_to_screensavers) {
// Is the gfx app built with a new enough BOINC graphics library version?
if (compareBOINCLibVersionTo(MAJORBOINCGFXLIBNEEDEDFORSONOMA, MINORBOINCGFXLIBNEEDEDFORSONOMA) >= 0) {
if (compareBOINCLibVersionTo(MAJORBOINCGFXLIBNEEDEDFORSONOMA, MINORBOINCGFXLIBNEEDEDFORSONOMA, RELEASEBOINCGFXLIBNEEDEDFORSONOMA) >= 0) {
runningSharedGraphics = true;
if (childPid) {
gfxAppStartTime = 0.0;

View File

@ -722,8 +722,8 @@ DataMgmtProcType CScreensaver::DataManagementProc() {
}
}
m_vIncompatibleGfxApps.clear();
}
#endif
}
switch_to_default_gfx = false;
}
}
@ -1085,15 +1085,18 @@ void CScreensaver::GetDefaultDisplayPeriods(struct ss_periods &periods) {
#ifdef __APPLE__
// compareBOINCLibVersionTo(x, y) returns:
// -1 if the library version is less than x.y
// 0 if the library version is equal to x.y
// -1 if the library version is less than x.y.z
// 0 if the library version is equal to x.y.z
// +1 if the library version is lgreater than x.y
int compareBOINCLibVersionTo(int toMajor, int toMinor) {
int compareBOINCLibVersionTo(int toMajor, int toMinor, int toRelease) {
if (ss_shmem->major_version < toMajor) return -1;
if (ss_shmem->major_version > toMajor) return 1;
// if (major == toMajor) compare minor version numbers
if (ss_shmem->minor_version < toMinor) return -1;
if (ss_shmem->minor_version > toMinor) return 1;
// if (minor == toMinor) compare release version numbers
if (ss_shmem->release < toRelease) return -1;
if (ss_shmem->release > toRelease) return 1;
return 0;
}
#endif