diff --git a/checkin_notes b/checkin_notes index cd47638a9e..10568531bc 100644 --- a/checkin_notes +++ b/checkin_notes @@ -9847,3 +9847,19 @@ David 24 Oct 2007 host.inc user/ hosts_user.php + +David 24 Oct 2007 + - client: fixed bug that broke idle detection on Unix. + The problem: the various checks were surrounded by things like + #ifdef HAVE__DEV_MOUSE + If the host on which the client is built doesn't have a mouse + (as is the case with our build machine) + then the resulting executable doesn't check /dev/mouse, + even if it exists on the target host. + - removed configure checks for /dev/mouse, /dev/kbd, and /dev/tty1 + + configure.ac + client/ + hostinfo_unix.C + html/user/ + create_profile.php diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index 196a9dddfa..14900150c4 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -895,8 +895,11 @@ static double GetOSXIdleTime(void) { if (tryNewAPI) { if (bundleRef == NULL) { - frameworkURL = CFURLCreateWithFileSystemPath (kCFAllocatorSystemDefault, - CFSTR("/System/Library/Frameworks/ApplicationServices.framework"), kCFURLPOSIXPathStyle, true); + frameworkURL = CFURLCreateWithFileSystemPath( + kCFAllocatorSystemDefault, + CFSTR("/System/Library/Frameworks/ApplicationServices.framework"), + kCFURLPOSIXPathStyle, true + ); if (frameworkURL) { bundleRef = CFBundleCreate(kCFAllocatorSystemDefault, frameworkURL); CFRelease( frameworkURL ); @@ -904,22 +907,27 @@ static double GetOSXIdleTime(void) { } if (bundleRef) { - if ( (GetSysIdleTime == NULL) || - ( ! CFBundleIsExecutableLoaded( bundleRef ) ) ) // Is this test necessary ? - GetSysIdleTime = (GetIdleTimeProc) - CFBundleGetFunctionPointerForName( bundleRef, CFSTR("CGEventSourceSecondsSinceLastEventType") ); + if ((GetSysIdleTime == NULL) || !CFBundleIsExecutableLoaded(bundleRef) + ) { + // Is this test necessary ? + GetSysIdleTime = (GetIdleTimeProc) CFBundleGetFunctionPointerForName( + bundleRef, CFSTR("CGEventSourceSecondsSinceLastEventType") + ); + } } - if (GetSysIdleTime) + if (GetSysIdleTime) { idleTime = (double)GetSysIdleTime (kCGEventSourceStateCombinedSessionState, kCGAnyInputEventType); - else { + } else { CFRelease( bundleRef ); bundleRef = NULL; - tryNewAPI = false; // CGEventSourceSecondsSinceLastEventType() API is not available on this system + tryNewAPI = false; + // CGEventSourceSecondsSinceLastEventType() API is not available on this system } - if (GetSysIdleTime) + if (GetSysIdleTime) { return idleTime; + } } // if (tryNewAPI) // On 10.3 use this SPI @@ -927,6 +935,7 @@ static double GetOSXIdleTime(void) { // On MDD Powermacs, the above function will return a large value when the machine // is active (-1?). 18446744073.0 is the lowest I've seen on my MDD -ai // Here we check for that value and correctly return a 0 idle time. + // idleTime = CGSSecondsSinceLastInputEvent (-1); if (idleTime >= 18446744000.0) idleTime = 0.0; return idleTime; @@ -948,25 +957,19 @@ bool HOST_INFO::users_idle( #else // ! __APPLE__ bool HOST_INFO::users_idle(bool check_all_logins, double idle_time_to_run) { -#ifdef HAVE__DEV_TTY1 - char device_tty[] = "/dev/tty1"; -#endif - time_t idle_time = time(NULL) - (long) (60 * idle_time_to_run); - return true -#ifdef HAVE_UTMP_H - && (!check_all_logins || all_logins_idle(idle_time)) -#endif -#ifdef HAVE__DEV_MOUSE - && device_idle(idle_time, "/dev/mouse") // solaris, linux -#endif -#ifdef HAVE__DEV_KBD - && device_idle(idle_time, "/dev/kbd") // solaris -#endif -#ifdef HAVE__DEV_TTY1 - && (check_all_logins || all_tty_idle(idle_time, device_tty, '1', 7)) -#endif + time_t idle_time = time(0) - (long) (60 * idle_time_to_run); - ; + if (check_all_logins) { +#ifdef HAVE_UTMP_H + if (!all_logins_idle(idle_time)) return false; +#endif + if (!all_tty_idle(idle_time, "/dev/tty1", '1', 7)) return false; + } + if (!device_idle(idle_time, "/dev/mouse")) return false; + // solaris, linux + if (!device_idle(idle_time, "/dev/kbd")) return false; + // solaris + return true; } #endif // ! __APPLE__ diff --git a/configure.ac b/configure.ac index eb33ac2d0a..a39d912f1a 100644 --- a/configure.ac +++ b/configure.ac @@ -461,17 +461,6 @@ if test -n "$utmp_file"; then AC_DEFINE_UNQUOTED(UTMP_LOCATION, "$utmp_file", utmp file location) fi -dnl Checks for device files -if test -e "/dev/mouse"; then - AC_DEFINE(HAVE__DEV_MOUSE, 1, [Define to 1 if /dev/mouse exists]) -fi -if test -e "/dev/kbd"; then - AC_DEFINE(HAVE__DEV_KBD, 1, [Define to 1 if /dev/kbd exists]) -fi -if test -e "/dev/tty1"; then - AC_DEFINE(HAVE__DEV_TTY1, 1, [Define to 1 if /dev/tty1 exists]) -fi - dnl Check for /proc/self/psinfo (Solaris) if test -e "/proc/self/psinfo"; then AC_DEFINE(HAVE__PROC_SELF_PSINFO, 1, [Define to 1 if /proc/self/psinfo exists]) diff --git a/html/user/create_profile.php b/html/user/create_profile.php index 7c9e4b804f..644f0c8628 100644 --- a/html/user/create_profile.php +++ b/html/user/create_profile.php @@ -6,13 +6,13 @@ db_init(); $user = get_logged_in_user(true); if ($user->total_credit > 0) { - show_profile_creation_page($user); + show_profile_creation_page($user); } else { - page_head("Not available"); - echo "You must have returned results and received credit + page_head("Not available"); + echo "You must have returned results and received credit before you can create a profile. - "; - page_tail(); + "; + page_tail(); } ?>