diff --git a/server/src/ledgrab/utils/win_shutdown.py b/server/src/ledgrab/utils/win_shutdown.py index 75def70..34e1906 100644 --- a/server/src/ledgrab/utils/win_shutdown.py +++ b/server/src/ledgrab/utils/win_shutdown.py @@ -101,16 +101,15 @@ class _WNDCLASS(ctypes.Structure): ] -class _MSG(ctypes.Structure): - _fields_ = [ - ("hwnd", wintypes.HWND), - ("message", wintypes.UINT), - ("wParam", wintypes.WPARAM), - ("lParam", wintypes.LPARAM), - ("time", wintypes.DWORD), - ("pt_x", wintypes.LONG), - ("pt_y", wintypes.LONG), - ] +# Use the stdlib wintypes.MSG (rather than a project-local _MSG) so the +# POINTER(MSG) type is shared with any other module that binds +# user32.GetMessageW.argtypes — argtypes is a global on the cached DLL +# handle, and two modules binding it with different POINTER classes for +# the same C function fight each other (last writer wins, the other one's +# byref() then trips Python 3.13's strict argtype check). PlatformDetector's +# display-power monitor binds with POINTER(wintypes.MSG); aligning here +# means whichever loads last produces the same binding. +_MSG = wintypes.MSG def _bind_winapi() -> None: