-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix issues on windows with high DPI monitors (scaling set higher than 100%) #1543
base: master
Are you sure you want to change the base?
Conversation
I have the same issue with 4K monitor with 150% scale on Barrier server PC - mouse cursor work on left 2/3 of screen width, and disappear when moved to right 1/3. I can confirm that marking Barrier binaries as "DPI aware" fixes situation - I did it by modifying RT_MANIFEST directly inside the binaries using Visual Studio as editor. Not sure which exactly binary from barrier.exe, barrierd.exe, barriers.exe need such modification, I did it for all three of them.
|
Probably, already done in this commit (8 jan): 00a57ea |
Any updates on this being merged with the main branch? Seems like it should be as I still have the issue persisting with 2.4 |
For a long time, I could not understand why the connection works in one direction, but not in the other. Well, yes, if you change it to 100%, it starts working. But alas, it's too small :( |
I don't see a issue merging this. When is this gonna get merged? |
When a windows monitor is scaled to > 100%, GetSystemMetrics() returns a correspondingly reduced size. But, barrier still reads/writes the mouse position in terms of raw pixels. This causes these problems:
#94
#273
#1363
#1405
#1462
Adding a call to SetProcessDPIAware() changes the behavior of GetSystemMetrics() to return the sizes in pixels (as if all monitors were scaled at 100%). This fixes the problems above. I debugged and verified this fix on my setup (windows barrier server to the left of a linux client). I don't have the capability to try this on all possible setups, but I believe it will fix all of the above issues.
When windows is the server, and the mouse pointer scrolls offscreen (to a barrier client), barrier hides the mouse cursor on the server and sets the mouse position back to the center of the screen. However, because of the above mixup between scaled/unscalled pixels, the position the mouse gets set to isn't actually the center of the screen. The barrier server then sees that the mouse position is not centered and interprets this as the user moving the mouse (even when the user has not). Barrier then movies the mouse on the client and sets the mouse back to the false center on the server again. This results in an infinite loop always moving the mouse one way. The effective position gets pinned in one corner of a client screen.
Another effect of the bug is that the mouse cursor appears to jump from the server to the client prematurely (because the barrier server thought the server's screen was smaller than it actually is).
Contributor Checklist:
doc/newsfragments
directory IF it is auser-visible change (and make sure to read the
README.md
in that directory)