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

Fix issues on windows with high DPI monitors (scaling set higher than 100%) #1543

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/newsfragments/fix-windows-high-dpi.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix running on a windows monitor with Scale set to more than 100%.
(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)
4 changes: 4 additions & 0 deletions src/lib/barrier/win32/AppUtilWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ AppUtilWindows::run(int argc, char** argv)
throw std::runtime_error("Barrier only supports Windows XP SP3 and above.");
}

// This changes the behavior of future calls to GetSystemMetrics()
// so that the size or position in raw pixels is returned instead of a scaled value
// (when a windows display has a Scale of > 100% set).
SetProcessDPIAware();
// record window instance for tray icon, etc
ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL));

Expand Down