forked from shaba/openuds
Fixups
This commit is contained in:
parent
eb6065b203
commit
906824cafc
@ -57,7 +57,7 @@ doLogoff = False
|
||||
|
||||
def sigTerm(sigNo, stackFrame):
|
||||
if trayIcon:
|
||||
trayIcon.quit()
|
||||
trayIcon.quit(extra=" (by sigterm)")
|
||||
|
||||
|
||||
# About dialog
|
||||
|
@ -208,14 +208,20 @@ def initIdleDuration(atLeastSeconds):
|
||||
|
||||
|
||||
def getIdleDuration():
|
||||
lastInputInfo = LASTINPUTINFO()
|
||||
lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo)
|
||||
if ctypes.windll.user32.GetLastInputInfo(ctypes.byref(lastInputInfo)) == 0:
|
||||
try:
|
||||
lastInputInfo = LASTINPUTINFO()
|
||||
lastInputInfo.cbSize = ctypes.sizeof(lastInputInfo)
|
||||
if ctypes.windll.user32.GetLastInputInfo(ctypes.byref(lastInputInfo)) == 0:
|
||||
return 0
|
||||
if lastInputInfo.dwTime > 1000000000: # Value toooo high, nonsense...
|
||||
return 0
|
||||
millis = ctypes.windll.kernel32.GetTickCount() - lastInputInfo.dwTime # @UndefinedVariable
|
||||
if millis < 0:
|
||||
return 0
|
||||
return millis / 1000.0
|
||||
except Exception as e:
|
||||
logger.error('Getting idle duration: {}'.format(e))
|
||||
return 0
|
||||
if lastInputInfo.dwTime > 1000000000: # Value toooo high, nonsense...
|
||||
return 0
|
||||
millis = ctypes.windll.kernel32.GetTickCount() - lastInputInfo.dwTime # @UndefinedVariable
|
||||
return millis / 1000.0
|
||||
|
||||
|
||||
def getCurrentUser():
|
||||
|
Loading…
Reference in New Issue
Block a user