SDL messes up Windows desktop

Hello everybody,
I’m working on Windows 10 with a resolution of 3840x2160 and a resizing of icons and windows by 200%. When I create an SDL window in fullscreen mode everything works fine, but when I close that window some windows previously open on the desktop are reduced by half, in some of them even the font is reduced and some icons on the system tray are blurred. I noticed that the same problem occurs with some games and retro emulators but with many others don’t. Is there any way to correct this behavior?

I’ve noticed the same thing happening (I use a DPI scale factor of 150%). I assume it’s a bug in Windows 10. I thought it happens when you set a screen mode smaller than the desktop resolution?

So, what resolution is your SDL2 window actually? It might be 50% smaller than your requested size if you’re creating the window as a desktop fullscreen window due to WIndows’ DPI scaling?

If you can make your app DPI aware, this will be a start in the right direction. Visual Studio has an option for this, otherwise you can link a manifest file that’ll set it.

I don’t use Visual Studio but after a search I found “mt.exe” from MicroSoft that allows me to link a manifest to an executable. Once this is done everything works properly. The window size is as requested (both in window and fullscreen mode). I don’t think it’s a Windows bug but rather a SDL limit that doesn’t take into account the DPI scaling factor. But not being an expert I’m not sure.

1 Like

this can be done in code, see https://github.com/yquake2/yquake2/blob/master/src/backends/windows/system.c#L721-L763

(call that once at startup)