We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3709 - Assertion failure in WIN_GetDisplayUsableBounds on highdpi display
Summary: Assertion failure in WIN_GetDisplayUsableBounds on highdpi display
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.1
Hardware: x86_64 Windows 10
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-21 23:21 UTC by Eric Wasylishen
Modified: 2017-08-11 17:19 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Wasylishen 2017-07-21 23:21:06 UTC
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
Comment 1 Eric Wasylishen 2017-08-11 07:22:33 UTC
The patch I added in https://bugzilla.libsdl.org/show_bug.cgi?id=3714 fixes this.
Comment 2 Sam Lantinga 2017-08-11 17:19:45 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/0060bcf673e8