-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Document DPI awareness quirks on Windows #4908
Comments
I'd consider #2119 related to this – @ericwa is probably the expert in the room for SDL+highdpi on Windows (and has some related branches for it at https://github.com/ericwa/SDL/branches). As for why SDL doesn't just use the Windows DPI awareness stuff by default, I suppose one reason is since everything else related to highdpi-on-Windows isn't hooked up in SDL, things inside the window would look tiny on high pixel density screens and SDL wouldn't provide ways to let developers use their intended size (without Eric's work, anyway). |
Sorry it's taking so long!
Found an interesting quirk related to this today.. What I'm seeing is, the first time I enter exclusive fullscreen mode for a given .exe, Windows will flag the .exe as DPI aware (in a way that persists across future launches) - so from that point onwards the .exe will look tiny on high DPI displays anyway. Specifically, this checkbox is getting checked, and I'm not doing it manually: (If anyone wants to try reproducing this:
I'm not too surprised Windows is doing this (assuming it's real and not a mistake in my testing) - I guess the logic is "only games would change the display mode, and games don't want blurry OS scaling, so if we (the OS) see a non-DPI-aware app change the display mode, flag it as DPI aware." I also recall MS's highdpi documentation saying something to the effect of "games should always declare themselves DPI aware". It does make me wonder, when we're ready to merge my Windows highdpi patches, should we have SDL, at startup, call the Windows functions to declare highdpi awareness unconditionally (since Windows appears to be forcing it on apps under some conditions, anyway - namely the first time they change display modes)? Also, glfw and SFML both do the same from what I can see. |
Yes, that seems like a good idea. |
We automatically mark applications as DPI aware in SDL 3.0. :) |
I keep forgetting to write this down and it came up again today so I'm doing it before I forget one more time...
Other platforms like macOS/iOS/tvOS/Wayland all support high-DPI surfaces by using the
ALLOW_HIGHDPI
flag, and this can be done on a per-window basis. Windows on the other hand tooka slightlyseveral very different approaches that all require some kind of weird process on startup. The ways that I'm aware of:As far as I know, we can't do this in SDL for the developer, but I always forget why we can't do it, both in SDL and SDLmain. It would be nice to have this written down in docs/ somewhere so it's easy to link to, we could possibly include a code snippet for those who don't want to put up with manifest files.
The text was updated successfully, but these errors were encountered: