kmsdrm: honor mode previously set by SDL_SetWindowDisplayMode when enabling fullscreen and remove duplicate SDL_WINDOWEVENT_RESIZED event commit 2067a7db8e4a36ba40ab34a55b3166ca28638a60 made SDL_SetWindowSize and SDL_SetWindowFullscreen modify the display mode previously set by a call to SDL_SetWindowDisplayMode as far as I understand the SDL API, calling SDL_SetWindowDisplayMode followed by calling SDL_SetWindowFullscreen(..., SDL_WINDOW_FULLSCREEN) is the correct way to mode set / switch to fullscreen this change restores that functionaliy when switching to SDL_WINDOW_FULLSCREEN, but other cases are still modifying the display mode set by the user. rather than modifying the display mode set by the user, it seems this logic inside of KMSDRM_ReconfigureWindow should be pushed further down into KMSDRM_CreateSurfaces (as it was originally) to only modify the final mode that's set (based on the fullscreen flags), but not override the mode requested by the user
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 6f23e92..9704d0e 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -1312,29 +1312,23 @@ KMSDRM_ReconfigureWindow( _THIS, SDL_Window * window)
{
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *dispdata = display->driverdata;
- uint32_t refresh_rate = 0;
- if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) ==
- SDL_WINDOW_FULLSCREEN_DESKTOP)
+ if ((window->flags & SDL_WINDOW_FULLSCREEN) ==
+ SDL_WINDOW_FULLSCREEN)
+ {
+ /* Nothing to do, honor the most recent mode requested by the user */
+ }
+ else if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) ==
+ SDL_WINDOW_FULLSCREEN_DESKTOP)
{
-
/* Update the current mode to the desktop mode. */
dispdata->mode = dispdata->original_mode;
-
} else {
-
drmModeModeInfo *mode;
- /* Refresh rate is only important for fullscreen windows. */
- if ((window->flags & SDL_WINDOW_FULLSCREEN) ==
- SDL_WINDOW_FULLSCREEN)
- {
- refresh_rate = (uint32_t)window->fullscreen_mode.refresh_rate;
- }
-
/* Try to find a valid video mode matching the size of the window. */
mode = KMSDRM_GetClosestDisplayMode(display,
- window->windowed.w, window->windowed.h, refresh_rate );
+ window->windowed.w, window->windowed.h, 0);
if (mode) {
/* If matching mode found, recreate the GBM surface with the size
@@ -1346,11 +1340,6 @@ KMSDRM_ReconfigureWindow( _THIS, SDL_Window * window)
and setup that mode on the CRTC. */
dispdata->mode = dispdata->original_mode;
}
-
- /* Tell app about the size we have determined for the window,
- so SDL pre-scales to that size for us. */
- SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
- dispdata->mode.hdisplay, dispdata->mode.vdisplay);
}
/* Recreate the GBM (and EGL) surfaces, and mark the CRTC mode/fb setting