mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-03 07:29:37 +01:00
[KMS/DRM] Restore all-windows-are-fullscreen functionality, since there is no window manager in KMSDRM.
This commit is contained in:
parent
f4d58689e0
commit
7beba05013
@ -1116,6 +1116,7 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
|
SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */
|
||||||
SDL_bool vulkan_mode = viddata->vulkan_mode; /* Do we have any Vulkan windows? */
|
SDL_bool vulkan_mode = viddata->vulkan_mode; /* Do we have any Vulkan windows? */
|
||||||
NativeDisplayType egl_display;
|
NativeDisplayType egl_display;
|
||||||
|
drmModeModeInfo *mode;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
/* Allocate window internal data */
|
/* Allocate window internal data */
|
||||||
@ -1189,9 +1190,19 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
are considered "windowed" at this point of their life.
|
are considered "windowed" at this point of their life.
|
||||||
If a window is fullscreen, SDL internals will call
|
If a window is fullscreen, SDL internals will call
|
||||||
KMSDRM_SetWindowFullscreen() to reconfigure it if necessary. */
|
KMSDRM_SetWindowFullscreen() to reconfigure it if necessary. */
|
||||||
windata->surface_w = dispdata->original_mode.hdisplay;
|
|
||||||
windata->surface_h = dispdata->original_mode.vdisplay;
|
mode = KMSDRM_GetClosestDisplayMode(display,
|
||||||
dispdata->mode = dispdata->original_mode;
|
window->windowed.w, window->windowed.h, 0 );
|
||||||
|
|
||||||
|
if (mode) {
|
||||||
|
windata->surface_w = mode->hdisplay;
|
||||||
|
windata->surface_h = mode->vdisplay;
|
||||||
|
dispdata->mode = *mode;
|
||||||
|
} else {
|
||||||
|
windata->surface_w = dispdata->original_mode.hdisplay;
|
||||||
|
windata->surface_h = dispdata->original_mode.vdisplay;
|
||||||
|
dispdata->mode = dispdata->original_mode;
|
||||||
|
}
|
||||||
|
|
||||||
/* Take note to do the modesettng on the CRTC in SwapWindow. */
|
/* Take note to do the modesettng on the CRTC in SwapWindow. */
|
||||||
dispdata->modeset_pending = SDL_TRUE;
|
dispdata->modeset_pending = SDL_TRUE;
|
||||||
@ -1202,6 +1213,11 @@ KMSDRM_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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,
|
||||||
|
windata->surface_w, windata->surface_h);
|
||||||
|
|
||||||
} /* NON-Vulkan block ends. */
|
} /* NON-Vulkan block ends. */
|
||||||
|
|
||||||
/* Add window to the internal list of tracked windows. Note, while it may
|
/* Add window to the internal list of tracked windows. Note, while it may
|
||||||
@ -1259,17 +1275,29 @@ KMSDRM_ReconfigureWindow( _THIS, SDL_Window * window) {
|
|||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->driverdata;
|
||||||
uint32_t refresh_rate = 0;
|
uint32_t refresh_rate = 0;
|
||||||
|
|
||||||
/* Only change videomode for FULLSCREEN windows, not for normal
|
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) ==
|
||||||
windows or for FULLSCREEN_DESKTOP windows. */
|
SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||||
if( (window->flags & SDL_WINDOW_FULLSCREEN) == SDL_WINDOW_FULLSCREEN &&
|
|
||||||
!( (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/* Update the current mode to the desktop mode. */
|
||||||
|
windata->surface_w = dispdata->original_mode.hdisplay;
|
||||||
|
windata->surface_h = dispdata->original_mode.vdisplay;
|
||||||
|
dispdata->mode = dispdata->original_mode;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
drmModeModeInfo *mode;
|
drmModeModeInfo *mode;
|
||||||
refresh_rate = (uint32_t)window->fullscreen_mode.refresh_rate;
|
|
||||||
|
/* 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. */
|
/* Try to find a valid video mode matching the size of the window. */
|
||||||
mode = KMSDRM_GetClosestDisplayMode(display,
|
mode = KMSDRM_GetClosestDisplayMode(display,
|
||||||
window->fullscreen_mode.w, window->fullscreen_mode.h, refresh_rate );
|
window->windowed.w, window->windowed.h, refresh_rate );
|
||||||
|
|
||||||
if (mode) {
|
if (mode) {
|
||||||
/* If matching mode found, recreate the GBM surface with the size
|
/* If matching mode found, recreate the GBM surface with the size
|
||||||
@ -1290,18 +1318,17 @@ KMSDRM_ReconfigureWindow( _THIS, SDL_Window * window) {
|
|||||||
so SDL pre-scales to that size for us. */
|
so SDL pre-scales to that size for us. */
|
||||||
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
|
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED,
|
||||||
windata->surface_w, windata->surface_h);
|
windata->surface_w, windata->surface_h);
|
||||||
|
|
||||||
} else {
|
|
||||||
/* This is a normal window or a FULLSCREEN_DESKTOP window. */
|
|
||||||
windata->surface_w = dispdata->original_mode.hdisplay;
|
|
||||||
windata->surface_h = dispdata->original_mode.vdisplay;
|
|
||||||
dispdata->mode = dispdata->original_mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recreate the GBM (and EGL) surfaces, and mark the CRTC mode/fb setting
|
/* Recreate the GBM (and EGL) surfaces, and mark the CRTC mode/fb setting
|
||||||
as pending so it's done on SwapWindow. */
|
as pending so it's done on SwapWindow. */
|
||||||
KMSDRM_CreateSurfaces(_this, window);
|
KMSDRM_CreateSurfaces(_this, window);
|
||||||
dispdata->modeset_pending = SDL_TRUE;
|
dispdata->modeset_pending = SDL_TRUE;
|
||||||
|
|
||||||
|
/* 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,
|
||||||
|
windata->surface_w, windata->surface_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
Reference in New Issue
Block a user