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

Monitor DPI transition on latest Windows 10 causes infinite window growth #3286

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 1 comment
Closed
Assignees
Labels
waiting Waiting on user response
Milestone

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.1
Reported for operating system, platform: Windows 10, x86

Comments on the original bug report:

On 2019-06-17 21:04:10 +0000, Katelyn Gadd wrote:

Created attachment 3827
before (ideal resolution, on 150% dpi monitor)

If you enable the new 'permonitorv2' DPI awareness mode using an app manifest (app.manifest) in recent versions of Windows 10, SDL windows will grow infinitely on mousemove once they transition to a monitor with lower DPI. I'll attach two comparison screenshots.

I wasn't able to build a reduced repro yet, but from what I can tell the problem is that V2 scales non-client portions of the window and SDL appears to use integer pixels for non client and client size calculations. If the base windows DPI is say 150% (like my 4k monitor) and the window transitions to a 100% DPI window, the values are no longer integral pixel counts and as a result SDL produces rounding errors. When that happens every mouse move causes large vertical growth (because the titlebar is big) and slow horizontal growth. Moving back to the original monitor stops the growth but leaves the size incorrect.

Set component to events since it happens during mousemove event processing.

On 2019-06-17 21:04:28 +0000, Katelyn Gadd wrote:

Created attachment 3828
After a few mousemove events on the 100% dpi monitor

On 2019-06-17 21:44:17 +0000, Sam Lantinga wrote:

Do you have a patch to fix this that we can include in SDL 2.0.10?

Thanks!

On 2019-06-18 06:17:52 +0000, Katelyn Gadd wrote:

I honestly don't know SDL well enough to fix this. I could look into it some. Is there a particular SDL sample or testcase I should use to verify all the DPI-related stuff? I don't want to just end up fixing it for my scenario and breaking it for others.

@slouken
Copy link
Collaborator

slouken commented Nov 10, 2021

It looks like this has either been fixed in Windows or in SDL since this bug was reported. I'm testing on Windows 11 Version 10.0.22000 Build 22000, and I am not able to reproduce it.

If this is still active, please add a link to a project I can download and steps to repro.

Thanks!

@slouken slouken closed this as completed Nov 10, 2021
ericwa added a commit to ericwa/SDL that referenced this issue Mar 10, 2022
The hint allows setting a specific DPI awareness ("unaware", "system", "permonitor", "permonitorv2").

This is the first part of High-DPI support on Windows ( libsdl-org#2119 ).
It doesn't implement a virtualized SDL coordinate system, which will be
addressed in a later commit. (This hint could be useful for SDL apps
that want 1 SDL unit = 1 pixel, though.)

Detecting and behaving correctly under per-monitor V2
(calling AdjustWindowRectExForDpi where needed) should fix the
following issues:

libsdl-org#3286
libsdl-org#4712
slouken pushed a commit that referenced this issue Jun 11, 2022
The hint allows setting a specific DPI awareness ("unaware", "system", "permonitor", "permonitorv2").

This is the first part of High-DPI support on Windows ( #2119 ).
It doesn't implement a virtualized SDL coordinate system, which will be
addressed in a later commit. (This hint could be useful for SDL apps
that want 1 SDL unit = 1 pixel, though.)

Detecting and behaving correctly under per-monitor V2
(calling AdjustWindowRectExForDpi where needed) should fix the
following issues:

#3286
#4712
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting on user response
Projects
None yet
Development

No branches or pull requests

2 participants