From 7da882ed505057a1a58ea337e3cf74e353278f41 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Wed, 5 Sep 2007 11:12:03 +0000 Subject: [PATCH] Mac SCR: Do screen blanking in screensaver since CC no longer does it svn path=/trunk/boinc/; revision=13543 --- clientscr/mac_saver_module.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/clientscr/mac_saver_module.cpp b/clientscr/mac_saver_module.cpp index 185bc0522d..87b0bdc210 100755 --- a/clientscr/mac_saver_module.cpp +++ b/clientscr/mac_saver_module.cpp @@ -475,7 +475,7 @@ OSStatus RPCThread(void* param) { CC_STATE state; CC_STATUS cc_status; AbsoluteTime timeToUnblock; - long time_to_blank; + time_t time_to_blank; pid_t graphics_app_pid = 0; pid_t launcher_shell_pid = 0; char statusBuf[256]; @@ -493,7 +493,19 @@ OSStatus RPCThread(void* param) { double last_change_time = 0.0; double last_run_check_time = 0.0; + // Calculate the estimated blank time by adding the starting + // time and and the user-specified time which is in minutes + if (gGoToBlank) + time_to_blank = SaverStartTime + (gBlankingTime * 60); + else + time_to_blank = 0; + while (true) { + if ((gGoToBlank) && (time(0) > time_to_blank)) { + gClientSaverStatus = SS_STATUS_BLANKED; + gQuitRPCThread = true; + } + if (gQuitRPCThread) { // If main thread has requested we exit if (graphics_app_pid) { terminate_screensaver(graphics_app_pid); @@ -507,13 +519,6 @@ OSStatus RPCThread(void* param) { timeToUnblock = AddDurationToAbsolute(durationSecond/2, UpTime()); MPDelayUntil(&timeToUnblock); - // Calculate the estimated blank time by adding the starting - // time and and the user-specified time which is in minutes - if (gGoToBlank) - time_to_blank = SaverStartTime + (gBlankingTime * 60); - else - time_to_blank = 0; - // Try and get the current state of the CC //Get_CC_State: retval = rpc->get_state(state); @@ -528,6 +533,11 @@ OSStatus RPCThread(void* param) { saverState = SaverState_CoreClientSetToSaverMode; while (true) { + if ((gGoToBlank) && (time(0) > time_to_blank)) { + gClientSaverStatus = SS_STATUS_BLANKED; + gQuitRPCThread = true; + } + if (gQuitRPCThread) { // If main thread has requested we exit if (graphics_app_pid) { terminate_screensaver(graphics_app_pid);