Skip to content

Fix Popup regression on high DPI - #6300

Closed
ThomasGoulet73 wants to merge 1 commit into
dotnet:mainfrom
ThomasGoulet73:fix-popup-dpi-regression
Closed

ThomasGoulet73 wants to merge 1 commit into
dotnet:mainfrom
ThomasGoulet73:fix-popup-dpi-regression

Conversation

@ThomasGoulet73

Copy link
Copy Markdown
Contributor

Fixes #6289

Description

Fixes a regression where popups would vanish when using high DPI settings. The current code in .Net 6.0.3 uses the position of the mouse to check if the mouse was inside an array of points. The problem was that the position of the mouse was not DPI aware while the array of points was DPI aware. I fixed this by transforming the position of the mouse to have a point which is DPI aware.

Customer Impact

Fixes popup vanishing immediately.

Regression

Regression introduced in .Net 6.0.3 with #6063 which was a backport of #5931.

Testing

I tested locally using the sample provided here: #6063 (comment). I used two monitors with different DPI settings and after the changes in this PR, the issue was fixed.

Risk

Low.

@ThomasGoulet73
ThomasGoulet73 requested a review from a team as a code owner March 23, 2022 05:24
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Mar 23, 2022
@ghost
ghost requested review from SamBent, dipeshmsft and singhashish-wpf March 23, 2022 05:24
@ghost ghost added the Community Contribution A label for all community Contributions label Mar 23, 2022
@ThomasGoulet73

Copy link
Copy Markdown
Contributor Author

@dotnet/wpf-developers Could this PR be prioritized ? This fixes a regression introduced in .Net 6.0.3 which broke most popups on screens with high DPI. Hopefully this could get backported to the release/6.0 branch and included in .Net 6.0.4 (If this PR is considered to be the right fix and accepted by the WPF team, obviously). Thank you!

@SamBent

SamBent commented Mar 23, 2022

Copy link
Copy Markdown
Contributor

@ThomasGoulet73 - I'm preparing a better fix in .NET Framework, which we'll port to .NET Core when it's ready (probably this week). I started out doing something similar to yours, but discovered it had numerical instability and performance issues, both arising from the many layers of transforms involved. Fortunately, there's a way to avoid all that.

We should have announced that we were working on this, to save you some trouble. Sorry about that.

BTW, your diagnosis is backwards - the points in the convex hull use a physical pixel coordinate system (i.e. not DPI-aware), whereas the mouse point uses logical pixels (i.e. DPI-aware). Or maybe we just differ in what "DPI-aware" means. Not a big deal - the important thing is that they use different coordinate systems when scaling is > 100%, and that's what causes the bug.

@ThomasGoulet73

Copy link
Copy Markdown
Contributor Author

@ThomasGoulet73 - I'm preparing a better fix in .NET Framework, which we'll port to .NET Core when it's ready (probably this week). I started out doing something similar to yours, but discovered it had numerical instability and performance issues, both arising from the many layers of transforms involved. Fortunately, there's a way to avoid all that.

That's great, I'm looking forward to see what the right fix is. I didn't notice "numerical instability and performance issues" but this might be because I only did manual testing for this PR.

We should have announced that we were working on this, to save you some trouble. Sorry about that.

No worries. But yes, in the future, a quick "We're working on this" would be nice to avoid having the WPF team and people from the community work on the same thing at the same time.

BTW, your diagnosis is backwards - the points in the convex hull use a physical pixel coordinate system (i.e. not DPI-aware), whereas the mouse point uses logical pixels (i.e. DPI-aware). Or maybe we just differ in what "DPI-aware" means. Not a big deal - the important thing is that they use different coordinate systems when scaling is > 100%, and that's what causes the bug.

That makes sense. We have the same meaning of "DPI-aware", I just thought that the convex hull was dpi scaled and the mouse was not dpi scaled. Thank you for the explanation!

Closing this PR since it's being worked on by the WPF team.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After updating to .Net 6.0.3 through VS2022 Tooltips in WPF immediately vanish

2 participants