SCR: Mac: continue replacing deprecated Mac APIs

This commit is contained in:
Charlie Fenton 2016-12-16 04:28:41 -08:00
parent b05926822c
commit bcaf986854
4 changed files with 12 additions and 3 deletions

View File

@ -48,6 +48,7 @@ void setGFXDefaultPeriod(double value);
void setGFXSciencePeriod(double value);
void setGGFXChangePeriod(double value);
double getDTime();
void doBoinc_Sleep(double seconds);
void print_to_log_file(const char *format, ...);
void strip_cr(char *buf);
void PrintBacktrace(void);

View File

@ -57,4 +57,5 @@ void setGFXSciencePeriod(double value);
void setGGFXChangePeriod(double value);
bool validateNumericString(CFStringRef s);
double getDTime();
void doBoinc_Sleep(double seconds);
extern void print_to_log_file(const char *format, ...);

View File

@ -244,7 +244,7 @@ int signof(float x) {
NSPoint imagePosition;
char *msg;
CFStringRef cf_msg;
AbsoluteTime timeToUnblock, frameStartTime = UpTime();
double timeToBlock, frameStartTime = getDTime();
kern_return_t kernResult = kIOReturnError;
UInt64 params;
IOByteCount rcnt = sizeof(UInt64);
@ -490,8 +490,10 @@ int signof(float x) {
[ self setAnimationTimeInterval:(1.0/newFrequency) ];
// setAnimationTimeInterval does not seem to be working, so we
// throttle the screensaver directly here.
timeToUnblock = AddDurationToAbsolute(durationSecond/newFrequency, frameStartTime);
MPDelayUntil(&timeToUnblock);
timeToBlock = (1.0/newFrequency) - (getDTime() - frameStartTime);
if (timeToBlock > 0.0) {
doBoinc_Sleep(timeToBlock);
}
}
}

View File

@ -222,6 +222,11 @@ double getDTime() {
}
void doBoinc_Sleep(double seconds) {
boinc_sleep(seconds);
}
CScreensaver::CScreensaver() {
struct ss_periods periods;