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

Assertion failure in WIN_GetDisplayUsableBounds on highdpi display #2508

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

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

Comments on the original bug report:

On 2017-07-21 23:21:06 +0000, Eric Wasylishen wrote:

  1. have a monitor with scaling set in Windows display settings. I have 2880x1800 with 200% scaling.
  2. run testgl2 with "--info all". You should get the SDL_assert(hmon != NULL); assertion failing in WIN_GetDisplayUsableBounds.

Unfortunately I think the code in SDL_windowsmodes.c is fundamentally broken wherever it attempts to convert coordinates in the DEVMODE struct (which are always in pixels, even under DPI virtualization) to virtual screen coordinates (what MonitorFromPoint takes).
I think the only correct fix is to get a HMONITOR by doing a EnumDisplayMonitors and looking for a monitor name matching the DEVMODE.dmDeviceName , but I'm not sure about this as the msdn docs don't seem to say how to get a HMONITOR from a DEVMODE.

Tested on SDL2 7cfe088fafba, Windows 10 1703, build 15063.447

On 2017-08-11 07:22:33 +0000, Eric Wasylishen wrote:

The patch I added in https://bugzilla.libsdl.org/show_bug.cgi?id=3714 fixes this.

On 2017-08-11 17:19:45 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL/rev/0060bcf673e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant