Repository navigation
Gate per-monitor DPI on GetDpiForMonitor availability - #22299
Merged
Merged
Conversation
NuGet packagesThe packages for this pull request have been published (workflow run):
|
MrJul
approved these changes
Oct 7, 2026
MrJul
left a comment
Member
There was a problem hiding this comment.
WinScreen.cs already had this check, it makes sense to generalize it.
LGTM!
Member
|
The CLA needs to be accepted, but our bot is having trouble triggering the required comment. |
Collaborator
|
Contributor
Author
|
@cla-avalonia agree |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 8, 2026
MrJul
pushed a commit
that referenced
this pull request
Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
Makes the Win32 backend check whether
GetDpiForMonitorexists before using per-monitor DPI, instead of checking the reported Windows version.What is the current behavior?
WindowImpl,FramebufferManagerandTrayIconImplonly useGetDpiForMonitorwhenWin32Platform.WindowsVersion >= 8.1. Under an app compatibility shim,RtlGetVersioncan report an older version (e.g. 6.0.6000) on Windows 11. The check then fails,RenderScalingstays at 1, and the window is too small at scales above 100%.Screensalready reports the correct scaling becauseWinScreenchecks withGetProcAddress.What is the updated/expected behavior with this PR?
RenderScalingmatches the monitor DPI even when the reported Windows version is spoofed.How was the solution implemented (if it's not obvious)?
UnmanagedMethods.ShCoreAvailableis replaced by a cachedGetDpiForMonitorAvailable, which uses the sameGetProcAddresscheckWinScreenalready had. All four call sites now use it.Checklist
No test:
Win32Platform.WindowsVersionis read-only and set once fromRtlGetVersion, so a spoofed version can't be simulated in a unit test.Fixed issues
Fixes #22204