Windows default to fullscreen desktop mode if they don't pick an explicit video mode

Rather than iterating over display modes using an index, there is a new function SDL_GetFullscreenDisplayModes() to get the list of available fullscreen modes on a display.
{
    SDL_DisplayID display = SDL_GetPrimaryDisplay();
    int num_modes = 0;
    SDL_DisplayMode **modes = SDL_GetFullscreenDisplayModes(display, &num_modes);
    if (modes) {
        for (i = 0; i < num_modes; ++i) {
            SDL_DisplayMode *mode = modes[i];
            SDL_Log("Display %" SDL_PRIu32 " mode %d:  %dx%d@%gHz, %d%% scale\n",
                    display, i, mode->pixel_w, mode->pixel_h, mode->refresh_rate, (int)(mode->display_scale * 100.0f));
        }
        SDL_free(modes);
    }
}

SDL_GetDesktopDisplayMode() and SDL_GetCurrentDisplayMode() return pointers to display modes rather than filling in application memory.

Windows now have an explicit fullscreen mode that is set, using SDL_SetWindowFullscreenMode(). The fullscreen mode for a window can be queried with SDL_GetWindowFullscreenMode(), which returns a pointer to the mode, or NULL if the window will be fullscreen desktop. SDL_SetWindowFullscreen() just takes a boolean value, setting the correct fullscreen state based on the selected mode.
This commit is contained in:
Sam Lantinga 2023-01-31 21:23:14 -08:00
parent 048df6260c
commit 6b137579ea
50 changed files with 976 additions and 1190 deletions

View file

@ -153,7 +153,6 @@ SDL3_0.0.0 {
SDL_GetCPUCacheLineSize;
SDL_GetCPUCount;
SDL_GetClipboardText;
SDL_GetClosestDisplayMode;
SDL_GetCurrentAudioDriver;
SDL_GetCurrentDisplayMode;
SDL_GetCurrentVideoDriver;
@ -166,7 +165,6 @@ SDL3_0.0.0 {
SDL_GetDisplayPhysicalDPI;
SDL_GetDisplayForPoint;
SDL_GetDisplayForRect;
SDL_GetDisplayMode;
SDL_GetDisplayName;
SDL_GetDisplayOrientation;
SDL_GetDisplayUsableBounds;
@ -260,7 +258,6 @@ SDL3_0.0.0 {
SDL_GetNumAllocations;
SDL_GetNumAudioDevices;
SDL_GetNumAudioDrivers;
SDL_GetNumDisplayModes;
SDL_GetNumGamepadMappings;
SDL_GetNumJoystickAxes;
SDL_GetNumJoystickButtons;
@ -348,7 +345,7 @@ SDL3_0.0.0 {
SDL_GetWindowBordersSize;
SDL_GetWindowData;
SDL_GetDisplayForWindow;
SDL_GetWindowDisplayMode;
SDL_GetWindowFullscreenMode;
SDL_GetWindowFlags;
SDL_GetWindowFromID;
SDL_GetWindowGrab;
@ -613,7 +610,7 @@ SDL3_0.0.0 {
SDL_SetWindowAlwaysOnTop;
SDL_SetWindowBordered;
SDL_SetWindowData;
SDL_SetWindowDisplayMode;
SDL_SetWindowFullscreenMode;
SDL_SetWindowFullscreen;
SDL_SetWindowGrab;
SDL_SetWindowHitTest;
@ -840,6 +837,8 @@ SDL3_0.0.0 {
SDL_ConvertAudioSamples;
SDL_GetDisplays;
SDL_GetPrimaryDisplay;
SDL_GetFullscreenDisplayModes;
SDL_GetClosestFullscreenDisplayMode;
# extra symbols go here (don't modify this line)
local: *;
};