-
Notifications
You must be signed in to change notification settings - Fork 124
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
Windows Fix Multiple Monitor Mouse Input #158
base: 1.3
Are you sure you want to change the base?
Windows Fix Multiple Monitor Mouse Input #158
Conversation
42ff6c2
to
22ba8a0
Compare
@FaithBeam this pull request is a little out of date - could you please rebase it on top of the 1.3 branch and resolve conflicts? Also, the original pull request contained a couple more commits - could you add them here as well? @kwhat did you have a chance to review this pull request? |
@TolikPylypchuk if @kwhat expresses interest in this, I'll update the PR. |
Ive looked at this vut i still dont understand why its needed. |
It's been a while since I last looked at the code, but libuiohook doesn't calculate the correct coordinates for mouse input when multiple monitors are connected on Windows. One monitor: works This PR fixes multiple monitor mouse input for Windows. |
Sorry, I accidentally closed this. Reopening. |
5944f6c
to
987fec0
Compare
99a6851
to
0e34a45
Compare
7d51994
to
90c2248
Compare
Hello! This PR fixes libuiohook's issue with multi-monitor mouse input and movement for Windows.
Very quickly, this is done by converting the low-level mouse hook coordinates that libuiohook returns to be relative to the virtual desktop. It creates an invisible window and listens for the WM_DISPLAYCHANGE event which is sent whenever a monitor changes position or resolution to get the width and height of monitors in relation to the primary monitor. I wrote some notes and examples here if you want to take a look: https://i.imgur.com/z3vKjtm.png
This video shows a modified demo_hook/post_async with the change. This change does not touch dpi stuff, so the calling application should set something like SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); to handle monitors that are not 100% scale.
https://youtu.be/YhrC_oLPtRM
The modified program listens for middle mouse button release and sends a right mouse button down and up at the current mouse coordinates.
This is the sample program: https://gist.github.com/FaithBeam/e90bad32fd2fef0c825cfa9c403f9e7b
Should fix #21.