|
Description
Manuel Alfayate Corchete
2020-05-19 20:08:51 UTC
Please do not merge this patch yet. It is currently having some side-effects (pointer double-free) I am studying. Created attachment 4351 [details]
V2 of the patch that fixes SDL_SetWindowFullscreen() with the SDL_WINDOW_FULLSCREEN_DESKTOP flag on KMSDRM when a video mode change was previously made.
This patch fixes SDL_SetWindowFullscreen() with the SDL_WINDOW_FULLSCREEN_DESKTOP flag on KMSDRM.
Now it works as expected (previous patch was a mistake as I was initializing the driverdata field with a non-related pointer).
This patch can be merged without problems.
Created attachment 4353 [details]
V3 of the patch that fixes SDL_SetWindowFullscreen() with the SDL_WINDOW_FULLSCREEN_DESKTOP flag on KMSDRM when a video mode change was previously made.
I have made yet another version of this patch, that also removes the forced SDL_WINDOWN_FULLSCREEN and SDL_WINDOW_OPENGL flags on windows created on the KMSDRM backend.
That was confusing some programs that detected SDL_Window flags, and caused misbehaviours like them not toggling fullscreen (from fullscreen into SDL_WINDOW_FULLSCREEN_DESKTOP, for example) when they should.
I would like to comment about the V3 patch: Since SDL_WINDOW_FULLSCREEN is not stamped into all KMSDRM windows now, programs wanting to change physical video mode must pass the SDL_WINDOW_FULLSCREEN flag to SDL_CreateWindow() and SDL_SetWindowFullsreen(). This is because SDL_UpdateFullscreenMode() will only change fullscreen mode *if* the window is fullscreen: its perfectly reasonable, because it makes no sense to change the video mode for a non-fullscreen window. Previous behaviour was to change the video mode always, because the SDL_WINDOW_FULLSCREEN flag was FORCED into all KMSDRM windows, but forcing the SDL_WINDOW_FULLSCREEN flag into all windows confuses programs that use SDL_GetWindowFlags() to find out if a window is fullscreen or not. So I believe the new behaviour with this patch (changing video mode for fullscreen windows ONLY) is more coherent with SDL2 design and how is it supposed to work on non-windowed enviroments like KMSDRM. Any thoughts on this? (It can easily reverted later, anyway). Created attachment 4354 [details]
V4 of the patch that fixes SDL_SetWindowFullscreen() with the SDL_WINDOW_FULLSCREEN_DESKTOP flag on KMSDRM when a video mode change was previously made.
Create V4 and hopefully definitive version of this patch.
For total coherence with SDL2 desing and expected behaviour, programs that call SDL_CreateWindow() or SDL_SetWindowFullscreen() without SDL_WINDOW_FULLSCREEN or SDL_WINDOW_FULLSCREEN_DESKTOP will now appear on a window. No more stranbe behaviour now:
-If a program wants fullscreen, it has to pass SDL_WINDOW_FULLSCREEN or SDL_WINDOW_FULLSCREEN_DESKTOP. If that program passes a different resolution than the "desktop" one (there is no desktop in KMSDRM, so this means the mode-in-use by the system), a resolution change will be made.
-If a program wants to display in a window, a window it will get. But of course a non-fullscreen window does not allow display mode changes, as per SDL_UpdateFullscreenMode() and the most basic logic.
V4 of the patch doesn't apply cleanly to Mercurial. Can you updated it and verify? Thanks! Created attachment 4363 [details]
V5 of the patch that fixes SDL_SetWindowFullscreen() with the SDL_WINDOW_FULLSCREEN_DESKTOP flag on KMSDRM when a video mode change was previously made.
@Sam Lantiga
I have done a new patch that works against latest libSDL2 sources.
Please apply, verify and merge if possible. Thanks!
Patch added, thanks! https://hg.libsdl.org/SDL/rev/d495c4d822cc |