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 4373 - SDL_WINDOW_ALLOW_HIGHDPI flag is not unset on failure
Summary: SDL_WINDOW_ALLOW_HIGHDPI flag is not unset on failure
Status: NEW
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.9
Hardware: x86_64 Mac OS X (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-09 02:58 UTC by Caleb Cornett
Modified: 2018-11-09 12:11 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Caleb Cornett 2018-11-09 02:58:31 UTC
On macOS, if SDL cannot create a high-DPI window (e.g. because of an insufficient screen resolution), the SDL_WINDOW_ALLOW_HIGHDPI window flag is never turned off. This makes it difficult to determine at runtime if high-dpi window creation has been successful.

The snippet responsible for this behavior (or lack thereof) appears to be this:
https://hg.libsdl.org/SDL/file/a4d730631698/src/video/cocoa/SDL_cocoawindow.m#l1360

What's the best way to fix this? I suspect there's a simple solution, but I'm not familiar with Cocoa so I have no idea what it would be.
Comment 1 Alex Szpakowski 2018-11-09 12:11:21 UTC
As the flag's name implies, it just makes SDL windows capable of being high-dpi, it isn't really meant to fail to create the window if it isn't high dpi - you can use SDL_GL_GetDrawableSize (if you're using OpenGL directly), or SDL_GetRendererOutputSize (if you're using SDL_Render) and compare that to SDL_GetWindowSize, to determine if the window is currently high dpi.