mirror of https://github.com/BOINC/boinc.git
- client: Account for the display management power system when
calculating idle time from the XSS system on Linux.
This commit is contained in:
parent
9209a887cc
commit
4ee64625c1
|
@ -7989,3 +7989,10 @@ David 29 Dec 2012
|
|||
|
||||
client/
|
||||
gui_rpc_server_ops.cpp
|
||||
|
||||
Rom 1 Jan 2013
|
||||
- client: Account for the display management power system when
|
||||
calculating idle time from the XSS system on Linux.
|
||||
|
||||
client/
|
||||
hostinfo_unix.cpp
|
|
@ -150,6 +150,10 @@ mach_port_t gEventHandle = NULL;
|
|||
#define _SC_PAGESIZE _SC_PAGE_SIZE
|
||||
#endif
|
||||
|
||||
#if HAVE_DPMS
|
||||
#include <X11/extensions/dpms.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_XSS
|
||||
#include <X11/extensions/scrnsaver.h>
|
||||
#endif
|
||||
|
@ -1806,7 +1810,51 @@ bool xss_idle(long idle_treshold) {
|
|||
|
||||
if(disp != NULL) {
|
||||
XScreenSaverQueryInfo(disp, DefaultRootWindow(disp), xssInfo);
|
||||
idle_time = xssInfo->idle / 1000; // xssInfo->idle is in ms
|
||||
|
||||
idle_time = xssInfo->idle;
|
||||
|
||||
#if HAVE_DPMS
|
||||
int dummy;
|
||||
CARD16 standby, suspend, off;
|
||||
CARD16 state;
|
||||
BOOL onoff;
|
||||
|
||||
if (DPMSQueryExtension(disp, &dummy, &dummy)) {
|
||||
if (DPMSCapable(disp)) {
|
||||
DPMSGetTimeouts(disp, &standby, &suspend, &off);
|
||||
DPMSInfo(disp, &state, &onoff);
|
||||
|
||||
if (onoff) {
|
||||
switch (state) {
|
||||
case DPMSModeStandby:
|
||||
/* this check is a littlebit paranoid, but be sure */
|
||||
if (idle_time < (unsigned) (standby * 1000)) {
|
||||
idle_time += (standby * 1000);
|
||||
}
|
||||
break;
|
||||
case DPMSModeSuspend:
|
||||
if (idle_time < (unsigned) ((suspend + standby) * 1000)) {
|
||||
idle_time += ((suspend + standby) * 1000);
|
||||
}
|
||||
break;
|
||||
case DPMSModeOff:
|
||||
if (idle_time < (unsigned) ((off + suspend + standby) * 1000)) {
|
||||
idle_time += ((off + suspend + standby) * 1000);
|
||||
}
|
||||
break;
|
||||
case DPMSModeOn:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// convert from milliseconds to seconds
|
||||
idle_time = idle_time / 1000;
|
||||
|
||||
} else {
|
||||
disp = XOpenDisplay(NULL);
|
||||
// XOpenDisplay may return NULL if there is no running X
|
||||
|
|
|
@ -847,6 +847,9 @@ fi
|
|||
LIBS=$svlibs
|
||||
|
||||
if (test "$enable_xss" == yes) && (test "$have_Xss" == yes); then
|
||||
SAH_CHECK_LIB([xcb-dpms],[DPMSQueryExtension],[
|
||||
AC_DEFINE([HAVE_DPMS],[1],[Define to 1 if you have xcb-dpms library])
|
||||
CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
|
||||
SAH_CHECK_LIB([Xss],[XScreenSaverAllocInfo],[
|
||||
AC_DEFINE([HAVE_XSS],[1],[Define to 1 if you have xss library])
|
||||
CLIENTLIBS="${sah_lib_last} ${CLIENTLIBS}"])
|
||||
|
|
Loading…
Reference in New Issue