mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-15 14:16:02 -06:00
[PR #1543] Fix issues on windows with high DPI monitors (scaling set higher than 100%) #1815
Labels
No labels
HiDPI
bounty
bsd/freebsd
bsd/openbsd
bug
bug
build-infra
cantfix
critical
doc
duplicate
enhancement
fix-available
from git
from release
good first issue
help wanted
installer/package
invalid
linux
macOS
meta
needs testing
pull-request
query
question
regression
regression
v2.4.0
windows
wontfix
work-in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/barrier#1815
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/debauchee/barrier/pull/1543
Author: @jstamerj
Created: 1/29/2022
Status: 🔄 Open
Base:
master← Head:jstamerj/WinHighDPIFix📝 Commits (6)
367beb5Call SetProcessDPIAware726258fFix whitespace5c1527cremove unnecessary calls31acdd2remove extra whitespace4ee8913add newsfragments9b57c5badd comment to code📊 Changes
2 files changed (+6 additions, -0 deletions)
View changed files
➕
doc/newsfragments/fix-windows-high-dpi.bugfix(+2 -0)📝
src/lib/barrier/win32/AppUtilWindows.cpp(+4 -0)📄 Description
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:
https://github.com/debauchee/barrier/issues/94
https://github.com/debauchee/barrier/issues/273
https://github.com/debauchee/barrier/issues/1363
https://github.com/debauchee/barrier/issues/1405
https://github.com/debauchee/barrier/issues/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/newsfragmentsdirectory IF it is auser-visible change (and make sure to read the
README.mdin that directory)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.