|
1 | | -import time |
2 | | - |
3 | 1 | import ctypes |
4 | | -from ctypes import Structure, POINTER, WINFUNCTYPE, windll # type: ignore |
5 | | -from ctypes.wintypes import BOOL, UINT, DWORD # type: ignore |
| 2 | +import time |
| 3 | +from ctypes import POINTER, WINFUNCTYPE, Structure |
| 4 | +from ctypes.wintypes import BOOL, DWORD, UINT |
6 | 5 |
|
7 | 6 |
|
8 | 7 | class LastInputInfo(Structure): |
9 | | - _fields_ = [ |
10 | | - ("cbSize", UINT), |
11 | | - ("dwTime", DWORD) |
12 | | - ] |
| 8 | + _fields_ = [("cbSize", UINT), ("dwTime", DWORD)] |
13 | 9 |
|
14 | 10 |
|
15 | 11 | def _getLastInputTick() -> int: |
16 | 12 | prototype = WINFUNCTYPE(BOOL, POINTER(LastInputInfo)) |
17 | | - paramflags = ((1, "lastinputinfo"), ) |
| 13 | + paramflags = ((1, "lastinputinfo"),) |
18 | 14 | c_GetLastInputInfo = prototype(("GetLastInputInfo", ctypes.windll.user32), paramflags) # type: ignore |
19 | 15 |
|
20 | | - l = LastInputInfo() |
21 | | - l.cbSize = ctypes.sizeof(LastInputInfo) |
22 | | - assert 0 != c_GetLastInputInfo(l) |
23 | | - return l.dwTime |
| 16 | + lastinput = LastInputInfo() |
| 17 | + lastinput.cbSize = ctypes.sizeof(LastInputInfo) |
| 18 | + assert 0 != c_GetLastInputInfo(lastinput) |
| 19 | + return lastinput.dwTime |
24 | 20 |
|
25 | 21 |
|
26 | 22 | def _getTickCount() -> int: |
|
0 commit comments