You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set per-monitor DPI awareness explicitly and verify picks on mixed-DPI desktops #67
Picking and clicking only line up if the picker (Tk) and the clicker (PyAutoGUI / Win32) agree on what a pixel is. Today the process's DPI awareness is set implicitly, as a side effect of importing PyAutoGUI, and only to system awareness. On the setups where coordinate bugs actually happen (a 4K laptop at 150% next to a 1080p monitor at 100%), Windows virtualizes coordinates per monitor for system-aware apps. The result may be fine, slightly off, or a blurry overlay on one screen, and nothing in the repo verifies which.
Evidence
pyautogui/_pyautogui_win.py calls ctypes.windll.user32.SetProcessDPIAware() at import (system-aware, not per-monitor).
No SetProcessDpiAwarenessContext call and no manifest entry in WindowsAutoclicker.spec; nothing in autoclicker/ mentions DPI.
autoclicker/gui/picker.py sizes the overlay from GetSystemMetrics(SM_*VIRTUALSCREEN) and reports event.x_root/y_root; click_engine.py moves with pyautogui.moveTo. Correctness on mixed-DPI desktops depends on both sides being virtualized identically.
docs/PERFORMANCE.md and docs/ARCHITECTURE.md already list "multi-monitor DPI risk" as a reason to defer a SendInput path.
Suggested approach
Set awareness explicitly and first thing in main() (before Tk and PyAutoGUI load): SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) with fallbacks to SetProcessDpiAwareness(2) and SetProcessDPIAware(). Optionally also embed it in the exe manifest.
Manually verify on a mixed-DPI two-monitor setup: pick a point on each monitor, run, and confirm the click lands on the picked pixel. Record the result in docs/ARCHITECTURE.md.
Add a unit test that main() calls the awareness setter before creating the app.
Done when
DPI awareness is explicit, per-monitor v2 where available, and documented.
Picks on every monitor of a mixed-DPI desktop click the exact picked pixel (verified once manually and noted in docs).
Implemented in 8588482: core/dpi.py opts into per-monitor v2 awareness at the top of main.py, before PyAutoGUI is imported (a subprocess test confirms the process ends up per-monitor aware). Leaving this open for the one step that needs real hardware: on a mixed-DPI desktop (for example a 150% laptop screen next to a 100% monitor), pick a point on each monitor and confirm the click lands on the picked pixel, then note the result in docs/ARCHITECTURE.md.
Activity
TMHSDigital commentedon Oct 4, 2026
Implemented in 8588482:
core/dpi.pyopts into per-monitor v2 awareness at the top ofmain.py, before PyAutoGUI is imported (a subprocess test confirms the process ends up per-monitor aware). Leaving this open for the one step that needs real hardware: on a mixed-DPI desktop (for example a 150% laptop screen next to a 100% monitor), pick a point on each monitor and confirm the click lands on the picked pixel, then note the result in docs/ARCHITECTURE.md.fix(dpi): declare per-monitor-v2 DPI awareness before PyAutoGUI loads