Set per-monitor DPI awareness explicitly and verify picks on mixed-DPI desktops

未关闭
#67 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
python

调研方向

Start with the entry point that defines main(), autoclicker/gui/picker.py, and click_engine.py; inspect WindowsAutoclicker.spec and the DPI notes in docs/ARCHITECTURE.md and docs/PERFORMANCE.md. Verify the awareness call runs before Tk and PyAutoGUI load, then use the proposed unit test and manually check picked clicks on both monitors of a mixed-DPI Windows desktop. Done means per-monitor awareness is documented and each click lands on its picked pixel.

由索引模型根据 Issue 内容生成。

描述

bug maintenance priority: low

Why it matters

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

  1. 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.
  2. 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.
  3. 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).
主要语言
Python
星标
0
派生
2
平均合并
2 天 13 小时
30 天内合并 PR
2

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/autoclicker 的其他 Issue

查看 TMHSDigital/autoclicker 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。