Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with mouse position when using scaled monitor in windows. #13

Closed
jay7one opened this issue Feb 23, 2024 · 1 comment
Closed

Issue with mouse position when using scaled monitor in windows. #13

jay7one opened this issue Feb 23, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@jay7one
Copy link

jay7one commented Feb 23, 2024

Hi, this is a very nice app,

This is an issue with pynput, below is an extract from https://pynput.readthedocs.io/en/latest/mouse.html, maybe have the option to turn this on;

Ensuring consistent coordinates between listener and controller on Windows
Recent versions of Windows support running legacy applications scaled when the system scaling has been increased beyond 100%. This allows old applications to scale, albeit with a blurry look, and avoids tiny, unusable user interfaces.

This scaling is unfortunately inconsistently applied to a mouse listener and a controller: the listener will receive physical coordinates, but the controller has to work with scaled coordinates.

This can be worked around by telling Windows that your application is DPI aware. This is a process global setting, so pynput cannot do it automatically. Do enable DPI awareness, run the following code:

import ctypes
PROCESS_PER_MONITOR_DPI_AWARE = 2
ctypes.windll.shcore.SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE)

Rgs
J

@jay7one jay7one added the bug Normal bug label Feb 23, 2024
@LOUDO56 LOUDO56 added enhancement New feature or request and removed bug Normal bug labels Feb 23, 2024
@LOUDO56
Copy link
Owner

LOUDO56 commented Feb 23, 2024

Hello, thank you for this information! I'll try it later, when I'll got some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants