mirror of https://github.com/BOINC/boinc.git
SCR: Fix delay dismissing screensaver under Mac OS10.7
svn path=/branches/boinc_core_release_6_12/; revision=23885
This commit is contained in:
parent
c828b82c3d
commit
a162454018
|
@ -10020,3 +10020,14 @@ Charlie 18 July 11
|
|||
clientgui/
|
||||
sg_StatImageLoader.cpp
|
||||
sg_ViewTabPage.cpp
|
||||
|
||||
Charlie 27 July 11
|
||||
- SCR: Fix delay dismissing screensaver under Mac OS10.7.
|
||||
|
||||
clientscr/
|
||||
mac_saver_module.cpp
|
||||
Mac_Saver_Module.h
|
||||
Mac_Saver_ModuleView.m, .h
|
||||
mac_build/
|
||||
boinc.xcodeproj/
|
||||
project.pbxproj
|
||||
|
|
|
@ -48,6 +48,7 @@ void setShow_default_ss_first(bool value);
|
|||
void setGFXDefaultPeriod(double value);
|
||||
void setGFXSciencePeriod(double value);
|
||||
void setGGFXChangePeriod(double value);
|
||||
double getDTime();
|
||||
void print_to_log_file(const char *format, ...);
|
||||
void strip_cr(char *buf);
|
||||
void PrintBacktrace(void);
|
||||
|
|
|
@ -56,4 +56,5 @@ void setGFXDefaultPeriod(double value);
|
|||
void setGFXSciencePeriod(double value);
|
||||
void setGGFXChangePeriod(double value);
|
||||
bool validateNumericString(CFStringRef s);
|
||||
double getDTime();
|
||||
extern void print_to_log_file(const char *format, ...);
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
#include <Carbon/Carbon.h>
|
||||
#include <AppKit/AppKit.h>
|
||||
#include <QTKit/QTKitDefines.h> // For NSInteger
|
||||
#include <IOKit/hidsystem/IOHIDLib.h>
|
||||
#include <IOKit/hidsystem/IOHIDParameter.h>
|
||||
#include <IOKit/hidsystem/event_status_driver.h>
|
||||
|
||||
#ifndef NSInteger
|
||||
#if __LP64__ || NS_BUILD_32_LIKE_64
|
||||
|
@ -40,6 +43,10 @@ typedef float CGFloat;
|
|||
void print_to_log_file(const char *format, ...);
|
||||
void strip_cr(char *buf);
|
||||
|
||||
static SInt32 gSystemVersion = 0;
|
||||
static double gSS_StartTime = 0.0;
|
||||
mach_port_t gEventHandle = 0;
|
||||
|
||||
int gGoToBlank; // True if we are to blank the screen
|
||||
int gBlankingTime; // Delay in minutes before blanking the screen
|
||||
NSString *gPathToBundleResources = NULL;
|
||||
|
@ -83,6 +90,13 @@ int signof(float x) {
|
|||
NSBundle * myBundle;
|
||||
int newFrequency;
|
||||
int period;
|
||||
|
||||
gEventHandle = NXOpenEventStatus();
|
||||
|
||||
OSStatus err = Gestalt(gestaltSystemVersion, &gSystemVersion);
|
||||
if (err != noErr) {
|
||||
gSystemVersion = 0;
|
||||
}
|
||||
|
||||
initBOINCSaver();
|
||||
|
||||
|
@ -178,6 +192,8 @@ int signof(float x) {
|
|||
newFrequency = startBOINCSaver();
|
||||
if (newFrequency)
|
||||
[ self setAnimationTimeInterval:1.0/newFrequency ];
|
||||
|
||||
gSS_StartTime = getDTime();
|
||||
}
|
||||
|
||||
// If there are multiple displays, this may get called
|
||||
|
@ -223,6 +239,10 @@ int signof(float x) {
|
|||
char *msg;
|
||||
CFStringRef cf_msg;
|
||||
AbsoluteTime timeToUnblock, frameStartTime = UpTime();
|
||||
kern_return_t kernResult = kIOReturnError;
|
||||
UInt64 params;
|
||||
IOByteCount rcnt = sizeof(UInt64);
|
||||
double idleTime = 0;
|
||||
|
||||
if ([ self isPreview ]) {
|
||||
#if 1 // Currently drawRect just draws our logo in the preview window
|
||||
|
@ -243,6 +263,18 @@ int signof(float x) {
|
|||
return;
|
||||
}
|
||||
|
||||
// For unkown reasons, OS 10.7 Lion screensaver delays several seconds after
|
||||
// user activity before calling stopAnimation, so we check user activity here
|
||||
if ((gSystemVersion >= 1070) && ((getDTime() - gSS_StartTime) > 2.0)) {
|
||||
kernResult = IOHIDGetParameter( gEventHandle, CFSTR(EVSIOIDLE), sizeof(UInt64), ¶ms, &rcnt );
|
||||
if ( kernResult == kIOReturnSuccess ) {
|
||||
idleTime = ((double)params) / 1000.0 / 1000.0 / 1000.0;
|
||||
if (idleTime < 1.5) {
|
||||
[ self stopAnimation ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myContext = [[NSGraphicsContext currentContext] graphicsPort];
|
||||
// [myContext retain];
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ extern CFStringRef gPathToBundleResources;
|
|||
|
||||
static SaverState saverState = SaverState_Idle;
|
||||
// int gQuitCounter = 0;
|
||||
static SInt32 gSystemVersion = 0;
|
||||
|
||||
|
||||
const char * CantLaunchCCMsg = "Unable to launch BOINC application.";
|
||||
|
@ -201,6 +200,11 @@ void setGGFXChangePeriod(double value) {
|
|||
}
|
||||
|
||||
|
||||
double getDTime() {
|
||||
return dtime();
|
||||
}
|
||||
|
||||
|
||||
bool validateNumericString(CFStringRef s) {
|
||||
CFIndex i;
|
||||
CFRange range, result;
|
||||
|
@ -218,7 +222,6 @@ bool validateNumericString(CFStringRef s) {
|
|||
|
||||
CScreensaver::CScreensaver() {
|
||||
struct ss_periods periods;
|
||||
OSStatus err;
|
||||
|
||||
m_dwBlankScreen = 0;
|
||||
m_dwBlankTime = 0;
|
||||
|
@ -241,11 +244,6 @@ CScreensaver::CScreensaver() {
|
|||
rpc = 0;
|
||||
m_bConnected = false;
|
||||
|
||||
err = Gestalt(gestaltSystemVersion, &gSystemVersion);
|
||||
if (err != noErr) {
|
||||
gSystemVersion = 0;
|
||||
}
|
||||
|
||||
// Get project-defined default values for GFXDefaultPeriod, GFXSciencePeriod, GFXChangePeriod
|
||||
GetDefaultDisplayPeriods(periods);
|
||||
m_bShow_default_ss_first = periods.Show_default_ss_first;
|
||||
|
@ -650,7 +648,7 @@ bool CScreensaver::DestroyDataManagementThread() {
|
|||
}
|
||||
|
||||
if (rpc) {
|
||||
rpc->close(); // In case DataManagementProc is hung waiting for RPC
|
||||
rpc->close(); // In case DataManagementProc is hung waiting for RPC
|
||||
}
|
||||
m_hDataManagementThread = NULL; // Don't delay more if this routine is called again.
|
||||
if (m_hGraphicsApplication) {
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
DD29B8A2139F0CED0014477D /* procinfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD29B89E139F0CED0014477D /* procinfo.cpp */; };
|
||||
DD29B8A7139F14D10014477D /* procinfo_mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDB6934F0ABFE9C600689FD8 /* procinfo_mac.cpp */; };
|
||||
DD29B8AC139F15080014477D /* procinfo_mac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DDB6934F0ABFE9C600689FD8 /* procinfo_mac.cpp */; };
|
||||
DD3048CD13E032DD00D47966 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DDE2552B07C62F3E008E7D6E /* IOKit.framework */; };
|
||||
DD32CC830C27CEFB0016F571 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F51BDF4903086C46012012A7 /* InfoPlist.strings */; };
|
||||
DD32CC8F0C27CF860016F571 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F51BDF4903086C46012012A7 /* InfoPlist.strings */; };
|
||||
DD33C6F308B5BAF500768630 /* gui_http.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DD33C6F108B5BAF500768630 /* gui_http.cpp */; };
|
||||
|
@ -1151,6 +1152,7 @@
|
|||
DD130E740820C422001A0291 /* ScreenSaver.framework in Frameworks */,
|
||||
DDB6E3EF0D5B27AA00ED12B8 /* Carbon.framework in Frameworks */,
|
||||
DDB74A6C0D74259E00E97A40 /* AppKit.framework in Frameworks */,
|
||||
DD3048CD13E032DD00D47966 /* IOKit.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue