[hildjj] go away under windows too when screensaver is active. Fixes #4178
This commit is contained in:
parent
384283d2a4
commit
da955fd4da
|
@ -43,6 +43,11 @@ try:
|
||||||
|
|
||||||
lastInputInfo = LASTINPUTINFO()
|
lastInputInfo = LASTINPUTINFO()
|
||||||
lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo)
|
lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo)
|
||||||
|
|
||||||
|
# one or more of these may not be supported before XP.
|
||||||
|
OpenInputDesktop = ctypes.windll.user32.OpenInputDesktop
|
||||||
|
CloseDesktop = ctypes.windll.user32.CloseDesktop
|
||||||
|
SystemParametersInfo = ctypes.windll.user32.SystemParametersInfoW
|
||||||
else: # unix
|
else: # unix
|
||||||
from common import idle
|
from common import idle
|
||||||
except Exception:
|
except Exception:
|
||||||
|
@ -65,6 +70,21 @@ class SleepyWindows:
|
||||||
if not SUPPORTED:
|
if not SUPPORTED:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# screen saver, in windows >= XP
|
||||||
|
saver_runing = ctypes.c_int(0)
|
||||||
|
# 0x72 is SPI_GETSCREENSAVERRUNNING
|
||||||
|
if SystemParametersInfo(0x72, 0, ctypes.byref(saver_runing), 0) and \
|
||||||
|
saver_runing.value:
|
||||||
|
self.state = STATE_XA
|
||||||
|
return True
|
||||||
|
|
||||||
|
desk = OpenInputDesktop(0, False, 0)
|
||||||
|
if not desk:
|
||||||
|
# Screen locked
|
||||||
|
self.state = STATE_XA
|
||||||
|
return True
|
||||||
|
CloseDesktop(desk)
|
||||||
|
|
||||||
idleTime = self.getIdleSec()
|
idleTime = self.getIdleSec()
|
||||||
|
|
||||||
# xa is stronger than away so check for xa first
|
# xa is stronger than away so check for xa first
|
||||||
|
|
Loading…
Reference in New Issue