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

InputNonClientPointerSource.SetRegionRects with NonClientRegionKind.Passthrough fails to apply the provided excluded regions when Display scale is changed to higher value #10151

Open
abdes opened this issue Nov 11, 2024 · 0 comments
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners

Comments

@abdes
Copy link

abdes commented Nov 11, 2024

Describe the bug

Using the full example at https://learn.microsoft.com/en-us/windows/apps/develop/title-bar, with modified toolbar layout. The calculation of the excluded rectangles is fully detailed in the application debug traces below. The calculation is correct, and works as long as the Display scale is not changed or is set to a lower value. Note that reproduction works with changing the Display Scale in the Settings App or by dragging the window between two monitors with different Display Scale.

If the Display Scale is changed to a Higher value (from 150% to 175% for example), the calculation of the excluded region is correct, but the call to InputNonClientPointerSource.SetRegionRects() does not properly apply the regions. The old rectangle for the padding right in the traces below is still the one active.

SetRegionsForCustomTitleBar: 1.75
SetRegionsForCustomTitleBar: padding left=0 , right=123.42857360839844
SetRegionsForCustomTitleBar: primary width=46 , height=46
SetRegionsForCustomTitleBar: secondary width=92 , height=46

--> Change Scale to 150% , rectangles properly excluded

SetRegionsForCustomTitleBar
SetRegionsForCustomTitleBar: 1.5
SetRegionsForCustomTitleBar: padding left=0 , right=144
SetRegionsForCustomTitleBar: primary width=40 , height=39
SetRegionsForCustomTitleBar: secondary width=79 , height=39

--> Change Scale back to 175%, rectangles not properly excluded, the right padding area is still as if it were 144

SetRegionsForCustomTitleBar
SetRegionsForCustomTitleBar: 1.75
SetRegionsForCustomTitleBar: padding left=0 , right=123.42857360839844
SetRegionsForCustomTitleBar: primary width=46 , height=46
SetRegionsForCustomTitleBar: secondary width=92 , height=46

--> Maximize then restore the Window => excluded rectangles are now applied, although the bounds did not change of course.
SetRegionsForCustomTitleBar
SetRegionsForCustomTitleBar: 1.75
SetRegionsForCustomTitleBar: padding left=0 , right=123.42857360839844
SetRegionsForCustomTitleBar: primary width=46 , height=46
SetRegionsForCustomTitleBar: secondary width=92 , height=46

Steps to reproduce the bug

Use the Microsoft sample at https://learn.microsoft.com/en-us/windows/apps/develop/title-bar

Make the PersonPicture interactive, a button for example.

Change Display Scale with Windows 11 Settings App.

Expected behavior

Excluded regions should be applied as provided when Display scale is set to a higher value or when the application window is moved across monitors with different display scale, or when they are programmatically changed... Basically honor the rectangles provided to the API call.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

@abdes abdes added the bug Something isn't working label Nov 11, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-triage Issue needs to be triaged by the area owners
Projects
None yet
Development

No branches or pull requests

1 participant