SDL_WINDOW_FULLSCREEN and SDL_WINDOW_FULLSCREEN_DESKTOP are now distinct flags

This commit is contained in:
Sam Lantinga 2023-01-28 09:52:31 -08:00
parent 67037f064b
commit e83c54f271
34 changed files with 193 additions and 167 deletions

View file

@ -2326,3 +2326,7 @@ expression e;
- SDL_GetDisplayDPI - SDL_GetDisplayDPI
+ SDL_GetDisplayPhysicalDPI + SDL_GetDisplayPhysicalDPI
(...) (...)
@@
@@
- SDL_WINDOW_FULLSCREEN
+ SDL_WINDOW_FULLSCREEN_EXCLUSIVE

View file

@ -977,6 +977,7 @@ The following functions have been renamed:
SDL_Window id type is named SDL_WindowID SDL_Window id type is named SDL_WindowID
SDL_WINDOW_FULLSCREEN has been renamed SDL_WINDOW_FULLSCREEN_EXCLUSIVE, and SDL_WINDOW_FULLSCREEN_DESKTOP no longer includes the old SDL_WINDOW_FULLSCREEN flag. You can use `(SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_MASK) != 0` if you want to check for either state.
## SDL_vulkan.h ## SDL_vulkan.h

View file

@ -343,7 +343,7 @@ int main(int argc, char **argv)
return 1; return 1;
} else if (SDL_GetCurrentDisplayMode(0, &mode) != 0) { } else if (SDL_GetCurrentDisplayMode(0, &mode) != 0) {
return 1; return 1;
} else if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) { } else if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN_EXCLUSIVE, &window, &renderer) != 0) {
return 1; return 1;
} }

View file

@ -415,6 +415,7 @@
#define SDL_GetDisplayDPI SDL_GetDisplayPhysicalDPI #define SDL_GetDisplayDPI SDL_GetDisplayPhysicalDPI
#define SDL_GetPointDisplayIndex SDL_GetDisplayIndexForPoint #define SDL_GetPointDisplayIndex SDL_GetDisplayIndexForPoint
#define SDL_GetRectDisplayIndex SDL_GetDisplayIndexForRect #define SDL_GetRectDisplayIndex SDL_GetDisplayIndexForRect
#define SDL_WINDOW_FULLSCREEN SDL_WINDOW_FULLSCREEN_EXCLUSIVE
#elif !defined(SDL_DISABLE_OLD_NAMES) #elif !defined(SDL_DISABLE_OLD_NAMES)
@ -795,6 +796,7 @@
#define SDL_GetDisplayDPI SDL_GetDisplayDPI_renamed_SDL_GetDisplayPhysicalDPI #define SDL_GetDisplayDPI SDL_GetDisplayDPI_renamed_SDL_GetDisplayPhysicalDPI
#define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayIndexForPoint #define SDL_GetPointDisplayIndex SDL_GetPointDisplayIndex_renamed_SDL_GetDisplayIndexForPoint
#define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayIndexForRect #define SDL_GetRectDisplayIndex SDL_GetRectDisplayIndex_renamed_SDL_GetDisplayIndexForRect
#define SDL_WINDOW_FULLSCREEN SDL_WINDOW_FULLSCREEN_renamed_SDL_WINDOW_FULLSCREEN_EXCLUSIVE
#endif /* SDL_ENABLE_OLD_NAMES */ #endif /* SDL_ENABLE_OLD_NAMES */

View file

@ -59,7 +59,7 @@ extern "C" {
* ::SDL_WINDOW_INPUT_GRABBED, ::SDL_WINDOW_HIDDEN, * ::SDL_WINDOW_INPUT_GRABBED, ::SDL_WINDOW_HIDDEN,
* ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
* ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_BORDERLESS is always set, * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_BORDERLESS is always set,
* and ::SDL_WINDOW_FULLSCREEN is always unset. * and ::SDL_WINDOW_FULLSCREEN_MASK is always unset.
* \return the window created, or NULL if window creation failed. * \return the window created, or NULL if window creation failed.
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.

View file

@ -107,33 +107,35 @@ typedef struct SDL_Window SDL_Window;
*/ */
typedef enum typedef enum
{ {
SDL_WINDOW_FULLSCREEN = 0x00000001, /**< fullscreen window */ SDL_WINDOW_FULLSCREEN_EXCLUSIVE = 0x00000001, /**< window is in fullscreen exclusive mode */
SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */ SDL_WINDOW_OPENGL = 0x00000002, /**< window usable with OpenGL context */
/* 0x00000004 was SDL_WINDOW_SHOWN in SDL2, please reserve this bit for sdl2-compat. */ /* 0x00000004 was SDL_WINDOW_SHOWN in SDL2, please reserve this bit for sdl2-compat. */
SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */ SDL_WINDOW_HIDDEN = 0x00000008, /**< window is not visible */
SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */ SDL_WINDOW_BORDERLESS = 0x00000010, /**< no window decoration */
SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */ SDL_WINDOW_RESIZABLE = 0x00000020, /**< window can be resized */
SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */ SDL_WINDOW_MINIMIZED = 0x00000040, /**< window is minimized */
SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */ SDL_WINDOW_MAXIMIZED = 0x00000080, /**< window is maximized */
SDL_WINDOW_MOUSE_GRABBED = 0x00000100, /**< window has grabbed mouse input */ SDL_WINDOW_MOUSE_GRABBED = 0x00000100, /**< window has grabbed mouse input */
SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */
SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */
SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FULLSCREEN_DESKTOP = 0x00001000, /**< window is in fullscreen desktop mode */
SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */
/* 0x00002000 was SDL_WINDOW_ALLOW_HIGHDPI in SDL2, please reserve this bit for sdl2-compat. */ /* 0x00002000 was SDL_WINDOW_ALLOW_HIGHDPI in SDL2, please reserve this bit for sdl2-compat. */
SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to MOUSE_GRABBED) */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to MOUSE_GRABBED) */
SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /**< window has grabbed keyboard input */ SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /**< window has grabbed keyboard input */
SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */ SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */
SDL_WINDOW_METAL = 0x20000000, /**< window usable for Metal view */ SDL_WINDOW_METAL = 0x20000000, /**< window usable for Metal view */
SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED /**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility */ SDL_WINDOW_INPUT_GRABBED = SDL_WINDOW_MOUSE_GRABBED /**< equivalent to SDL_WINDOW_MOUSE_GRABBED for compatibility */
} SDL_WindowFlags; } SDL_WindowFlags;
#define SDL_WINDOW_FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_EXCLUSIVE | SDL_WINDOW_FULLSCREEN_DESKTOP)
/** /**
* \brief Used to indicate that you don't care what the window position is. * \brief Used to indicate that you don't care what the window position is.
*/ */
@ -646,7 +648,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window *window);
* *
* `flags` may be any of the following OR'd together: * `flags` may be any of the following OR'd together:
* *
* - `SDL_WINDOW_FULLSCREEN`: fullscreen window * - `SDL_WINDOW_FULLSCREEN_EXCLUSIVE`: fullscreen window, switching display mode to the closest fullscreen resolution
* - `SDL_WINDOW_FULLSCREEN_DESKTOP`: fullscreen window at desktop resolution * - `SDL_WINDOW_FULLSCREEN_DESKTOP`: fullscreen window at desktop resolution
* - `SDL_WINDOW_OPENGL`: window usable with an OpenGL context * - `SDL_WINDOW_OPENGL`: window usable with an OpenGL context
* - `SDL_WINDOW_VULKAN`: window usable with a Vulkan instance * - `SDL_WINDOW_VULKAN`: window usable with a Vulkan instance
@ -1157,12 +1159,12 @@ extern DECLSPEC void SDLCALL SDL_RestoreWindow(SDL_Window *window);
/** /**
* Set a window's fullscreen state. * Set a window's fullscreen state.
* *
* `flags` may be `SDL_WINDOW_FULLSCREEN`, for "real" fullscreen with a * `flags` may be `SDL_WINDOW_FULLSCREEN_EXCLUSIVE`, for "real" fullscreen with a
* videomode change; `SDL_WINDOW_FULLSCREEN_DESKTOP` for "fake" fullscreen * videomode change; `SDL_WINDOW_FULLSCREEN_DESKTOP` for "fake" fullscreen
* that takes the size of the desktop; and 0 for windowed mode. * that takes the size of the desktop; and 0 for windowed mode.
* *
* \param window the window to change * \param window the window to change
* \param flags `SDL_WINDOW_FULLSCREEN`, `SDL_WINDOW_FULLSCREEN_DESKTOP` or 0 * \param flags `SDL_WINDOW_FULLSCREEN_EXCLUSIVE`, `SDL_WINDOW_FULLSCREEN_DESKTOP` or 0
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *

View file

@ -213,7 +213,7 @@ static SDL_AssertState SDLCALL SDL_PromptAssertion(const SDL_AssertData *data, v
/* Leave fullscreen mode, if possible (scary!) */ /* Leave fullscreen mode, if possible (scary!) */
window = SDL_GetFocusWindow(); window = SDL_GetFocusWindow();
if (window) { if (window) {
if (SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) { if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
SDL_MinimizeWindow(window); SDL_MinimizeWindow(window);
} else { } else {
/* !!! FIXME: ungrab the input if we're not fullscreen? */ /* !!! FIXME: ungrab the input if we're not fullscreen? */

View file

@ -150,7 +150,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0); SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0);
} }
WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN_DESKTOP); WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN_MASK);
/* The window can move during a resize event, such as when maximizing /* The window can move during a resize event, such as when maximizing
or resizing from a corner */ or resizing from a corner */

View file

@ -930,8 +930,8 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags
state == SDL_PRESSED && state == SDL_PRESSED &&
(keyboard->modstate & SDL_KMOD_ALT) && (keyboard->modstate & SDL_KMOD_ALT) &&
keyboard->focus && keyboard->focus &&
(keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) && (keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0 &&
(keyboard->focus->flags & SDL_WINDOW_FULLSCREEN) && (keyboard->focus->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0 &&
SDL_GetHintBoolean(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, SDL_TRUE)) { SDL_GetHintBoolean(SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED, SDL_TRUE)) {
/* We will temporarily forfeit our grab by minimizing our window, /* We will temporarily forfeit our grab by minimizing our window,
allowing the user to escape the application */ allowing the user to escape the application */

View file

@ -102,7 +102,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
SDL_WINDOWPOS_ISUNDEFINED(data2)) { SDL_WINDOWPOS_ISUNDEFINED(data2)) {
return 0; return 0;
} }
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
window->windowed.x = data1; window->windowed.x = data1;
window->windowed.y = data2; window->windowed.y = data2;
} }
@ -114,7 +114,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
SDL_OnWindowMoved(window); SDL_OnWindowMoved(window);
break; break;
case SDL_EVENT_WINDOW_RESIZED: case SDL_EVENT_WINDOW_RESIZED:
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
window->windowed.w = data1; window->windowed.w = data1;
window->windowed.h = data2; window->windowed.h = data2;
} }

View file

@ -294,7 +294,7 @@ static int D3D_ActivateRenderer(SDL_Renderer *renderer)
SDL_GetWindowSizeInPixels(window, &w, &h); SDL_GetWindowSizeInPixels(window, &w, &h);
data->pparams.BackBufferWidth = w; data->pparams.BackBufferWidth = w;
data->pparams.BackBufferHeight = h; data->pparams.BackBufferHeight = h;
if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((window_flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
SDL_DisplayMode fullscreen_mode; SDL_DisplayMode fullscreen_mode;
SDL_GetWindowDisplayMode(window, &fullscreen_mode); SDL_GetWindowDisplayMode(window, &fullscreen_mode);
data->pparams.Windowed = FALSE; data->pparams.Windowed = FALSE;
@ -1623,7 +1623,7 @@ D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
pparams.BackBufferCount = 1; pparams.BackBufferCount = 1;
pparams.SwapEffect = D3DSWAPEFFECT_DISCARD; pparams.SwapEffect = D3DSWAPEFFECT_DISCARD;
if (window_flags & SDL_WINDOW_FULLSCREEN && (window_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((window_flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
pparams.Windowed = FALSE; pparams.Windowed = FALSE;
pparams.BackBufferFormat = PixelFormatToD3DFMT(fullscreen_mode.format); pparams.BackBufferFormat = PixelFormatToD3DFMT(fullscreen_mode.format);
pparams.FullScreen_RefreshRateInHz = (UINT)SDL_ceilf(fullscreen_mode.refresh_rate); pparams.FullScreen_RefreshRateInHz = (UINT)SDL_ceilf(fullscreen_mode.refresh_rate);

View file

@ -242,7 +242,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
return 1; return 1;
} }
if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) { if (SDL_strcasecmp(argv[index], "--fullscreen") == 0) {
state->window_flags |= SDL_WINDOW_FULLSCREEN; state->window_flags |= SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
state->num_windows = 1; state->num_windows = 1;
return 1; return 1;
} }
@ -256,7 +256,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index)
if (!argv[index] || !SDL_isdigit((unsigned char)*argv[index])) { if (!argv[index] || !SDL_isdigit((unsigned char)*argv[index])) {
return -1; return -1;
} }
if (!(state->window_flags & SDL_WINDOW_FULLSCREEN)) { if ((state->window_flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
state->num_windows = SDL_atoi(argv[index]); state->num_windows = SDL_atoi(argv[index]);
} }
return 2; return 2;
@ -676,8 +676,8 @@ static void SDLTest_PrintDisplayOrientation(char *text, size_t maxlen, SDL_Displ
static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag) static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag)
{ {
switch (flag) { switch (flag) {
case SDL_WINDOW_FULLSCREEN: case SDL_WINDOW_FULLSCREEN_EXCLUSIVE:
SDL_snprintfcat(text, maxlen, "FULLSCREEN"); SDL_snprintfcat(text, maxlen, "FULLSCREEN_EXCLUSIVE");
break; break;
case SDL_WINDOW_OPENGL: case SDL_WINDOW_OPENGL:
SDL_snprintfcat(text, maxlen, "OPENGL"); SDL_snprintfcat(text, maxlen, "OPENGL");
@ -748,7 +748,7 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag)
static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags) static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags)
{ {
const Uint32 window_flags[] = { const Uint32 window_flags[] = {
SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_EXCLUSIVE,
SDL_WINDOW_OPENGL, SDL_WINDOW_OPENGL,
SDL_WINDOW_HIDDEN, SDL_WINDOW_HIDDEN,
SDL_WINDOW_BORDERLESS, SDL_WINDOW_BORDERLESS,
@ -1730,13 +1730,13 @@ static void FullscreenTo(int index, int windowId)
SDL_GetDisplayBounds(index, &rect); SDL_GetDisplayBounds(index, &rect);
flags = SDL_GetWindowFlags(window); flags = SDL_GetWindowFlags(window);
if (flags & SDL_WINDOW_FULLSCREEN) { if ((flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
SDL_SetWindowFullscreen(window, 0); SDL_SetWindowFullscreen(window, 0);
SDL_Delay(15); SDL_Delay(15);
} }
SDL_SetWindowPosition(window, rect.x, rect.y); SDL_SetWindowPosition(window, rect.x, rect.y);
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_EXCLUSIVE);
} }
void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done) void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done)
@ -2015,10 +2015,10 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) { if (window) {
Uint32 flags = SDL_GetWindowFlags(window); Uint32 flags = SDL_GetWindowFlags(window);
if (flags & SDL_WINDOW_FULLSCREEN) { if ((flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
SDL_SetWindowFullscreen(window, SDL_FALSE); SDL_SetWindowFullscreen(window, 0);
} else { } else {
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_EXCLUSIVE);
} }
} }
} else if (withAlt) { } else if (withAlt) {
@ -2026,8 +2026,8 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) { if (window) {
Uint32 flags = SDL_GetWindowFlags(window); Uint32 flags = SDL_GetWindowFlags(window);
if (flags & SDL_WINDOW_FULLSCREEN) { if ((flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
SDL_SetWindowFullscreen(window, SDL_FALSE); SDL_SetWindowFullscreen(window, 0);
} else { } else {
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
} }
@ -2037,8 +2037,8 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
if (window) { if (window) {
Uint32 flags = SDL_GetWindowFlags(window); Uint32 flags = SDL_GetWindowFlags(window);
if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN); SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_EXCLUSIVE);
} else { } else {
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP);
} }

View file

@ -27,7 +27,7 @@ SDL_Window *
SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags) SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags)
{ {
SDL_Window *result = NULL; SDL_Window *result = NULL;
result = SDL_CreateWindow(title, -1000, -1000, w, h, (flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE)); result = SDL_CreateWindow(title, -1000, -1000, w, h, (flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN_MASK) & (~SDL_WINDOW_RESIZABLE));
if (result != NULL) { if (result != NULL) {
if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) { if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) {
SDL_DestroyWindow(result); SDL_DestroyWindow(result);

View file

@ -108,10 +108,10 @@ struct SDL_Window
SDL_Window *prev; SDL_Window *prev;
SDL_Window *next; SDL_Window *next;
}; };
#define FULLSCREEN_VISIBLE(W) \ #define SDL_WINDOW_FULLSCREEN_VISIBLE(W) \
(((W)->flags & SDL_WINDOW_FULLSCREEN) && \ ((((W)->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) && \
!((W)->flags & SDL_WINDOW_HIDDEN) && \ (((W)->flags & SDL_WINDOW_HIDDEN) == 0) && \
!((W)->flags & SDL_WINDOW_MINIMIZED)) (((W)->flags & SDL_WINDOW_MINIMIZED) == 0))
/* /*
* Define the SDL display structure. * Define the SDL display structure.

View file

@ -151,8 +151,6 @@ static VideoBootStrap *bootstrap[] = {
return retval; \ return retval; \
} }
#define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
#if defined(__MACOS__) && defined(SDL_VIDEO_DRIVER_COCOA) #if defined(__MACOS__) && defined(SDL_VIDEO_DRIVER_COCOA)
/* Support for macOS fullscreen spaces */ /* Support for macOS fullscreen spaces */
extern SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window); extern SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window *window);
@ -1298,7 +1296,7 @@ int SDL_SetWindowDisplayMode(SDL_Window *window, const SDL_DisplayMode *mode)
SDL_zero(window->fullscreen_mode); SDL_zero(window->fullscreen_mode);
} }
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { if (SDL_WINDOW_FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
SDL_DisplayMode fullscreen_mode; SDL_DisplayMode fullscreen_mode;
if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) { if (SDL_GetWindowDisplayMode(window, &fullscreen_mode) == 0) {
if (SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode) == 0) { if (SDL_SetDisplayModeForDisplay(SDL_GetDisplayForWindow(window), &fullscreen_mode) == 0) {
@ -1338,7 +1336,7 @@ int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode)
display = SDL_GetDisplayForWindow(window); display = SDL_GetDisplayForWindow(window);
/* if in desktop size mode, just return the size of the desktop */ /* if in desktop size mode, just return the size of the desktop */
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
fullscreen_mode = display->desktop_mode; fullscreen_mode = display->desktop_mode;
} else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window), } else if (!SDL_GetClosestDisplayModeForDisplay(SDL_GetDisplayForWindow(window),
&fullscreen_mode, &fullscreen_mode,
@ -1403,16 +1401,20 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
do nothing, or else we may trigger an ugly double-transition do nothing, or else we may trigger an ugly double-transition
*/ */
if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */
if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) { if (window->is_destroying && (window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
return 0; return 0;
} }
/* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { if (fullscreen &&
(window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0 &&
(window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
return -1; return -1;
} }
} else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { } else if (fullscreen &&
(window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0 &&
(window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
display = SDL_GetDisplayForWindow(window); display = SDL_GetDisplayForWindow(window);
SDL_SetDisplayModeForDisplay(display, NULL); SDL_SetDisplayModeForDisplay(display, NULL);
if (_this->SetWindowFullscreen) { if (_this->SetWindowFullscreen) {
@ -1437,7 +1439,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
to fullscreen (being active, or not), and figure out a return/error code to fullscreen (being active, or not), and figure out a return/error code
from that. from that.
*/ */
if (fullscreen == !(WINRT_DetectWindowFlags(window) & FULLSCREEN_MASK)) { if (fullscreen == !(WINRT_DetectWindowFlags(window) & SDL_WINDOW_FULLSCREEN_MASK)) {
/* Uh oh, either: /* Uh oh, either:
1. fullscreen was requested, and we're already windowed 1. fullscreen was requested, and we're already windowed
2. windowed-mode was requested, and we're already fullscreen 2. windowed-mode was requested, and we're already fullscreen
@ -1466,7 +1468,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
/* See if anything needs to be done now */ /* See if anything needs to be done now */
if ((display->fullscreen_window == window) == fullscreen) { if ((display->fullscreen_window == window) == fullscreen) {
if ((window->last_fullscreen_flags & FULLSCREEN_MASK) == (window->flags & FULLSCREEN_MASK)) { if ((window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_MASK) == (window->flags & SDL_WINDOW_FULLSCREEN_MASK)) {
return 0; return 0;
} }
} }
@ -1477,7 +1479,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
if (other == window) { if (other == window) {
setDisplayMode = fullscreen; setDisplayMode = fullscreen;
} else if (FULLSCREEN_VISIBLE(other) && } else if (SDL_WINDOW_FULLSCREEN_VISIBLE(other) &&
SDL_GetDisplayForWindow(other) == display) { SDL_GetDisplayForWindow(other) == display) {
setDisplayMode = SDL_TRUE; setDisplayMode = SDL_TRUE;
} }
@ -1495,7 +1497,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
} }
/* only do the mode change if we want exclusive fullscreen */ /* only do the mode change if we want exclusive fullscreen */
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) { if (SDL_SetDisplayModeForDisplay(display, &fullscreen_mode) < 0) {
return -1; return -1;
} }
@ -1599,7 +1601,7 @@ static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
if (flags & SDL_WINDOW_MINIMIZED) { if (flags & SDL_WINDOW_MINIMIZED) {
SDL_MinimizeWindow(window); SDL_MinimizeWindow(window);
} }
if (flags & SDL_WINDOW_FULLSCREEN) { if (flags & SDL_WINDOW_FULLSCREEN_MASK) {
SDL_SetWindowFullscreen(window, flags); SDL_SetWindowFullscreen(window, flags);
} }
if (flags & SDL_WINDOW_MOUSE_GRABBED) { if (flags & SDL_WINDOW_MOUSE_GRABBED) {
@ -1749,7 +1751,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
window->windowed.w = window->w; window->windowed.w = window->w;
window->windowed.h = window->h; window->windowed.h = window->h;
if (flags & SDL_WINDOW_FULLSCREEN) { if (flags & SDL_WINDOW_FULLSCREEN_MASK) {
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
int displayIndex; int displayIndex;
SDL_Rect bounds; SDL_Rect bounds;
@ -1760,7 +1762,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
/* for real fullscreen we might switch the resolution, so get width and height /* for real fullscreen we might switch the resolution, so get width and height
* from closest supported mode and use that instead of current resolution * from closest supported mode and use that instead of current resolution
*/ */
if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP && (bounds.w != w || bounds.h != h)) { if ((flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0 && (bounds.w != w || bounds.h != h)) {
SDL_DisplayMode fullscreen_mode, closest_mode; SDL_DisplayMode fullscreen_mode, closest_mode;
SDL_zero(fullscreen_mode); SDL_zero(fullscreen_mode);
fullscreen_mode.screen_w = w; fullscreen_mode.screen_w = w;
@ -1822,7 +1824,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
SDL_FinishWindowCreation(window, flags); SDL_FinishWindowCreation(window, flags);
/* If the window was created fullscreen, make sure the mode code matches */ /* If the window was created fullscreen, make sure the mode code matches */
SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)); SDL_UpdateFullscreenMode(window, SDL_WINDOW_FULLSCREEN_VISIBLE(window));
return window; return window;
} }
@ -2201,7 +2203,7 @@ void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
} }
} }
if ((window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
if (!SDL_WINDOWPOS_ISUNDEFINED(x)) { if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
window->windowed.x = x; window->windowed.x = x;
} }
@ -2227,7 +2229,7 @@ void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
CHECK_WINDOW_MAGIC(window, ); CHECK_WINDOW_MAGIC(window, );
/* Fullscreen windows are always at their display's origin */ /* Fullscreen windows are always at their display's origin */
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
int displayIndex; int displayIndex;
if (x) { if (x) {
@ -2266,7 +2268,7 @@ void SDL_GetWindowPosition(SDL_Window *window, int *x, int *y)
void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered) void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
{ {
CHECK_WINDOW_MAGIC(window, ); CHECK_WINDOW_MAGIC(window, );
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
const int want = (bordered != SDL_FALSE); /* normalize the flag. */ const int want = (bordered != SDL_FALSE); /* normalize the flag. */
const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0); const int have = ((window->flags & SDL_WINDOW_BORDERLESS) == 0);
if ((want != have) && (_this->SetWindowBordered)) { if ((want != have) && (_this->SetWindowBordered)) {
@ -2283,7 +2285,7 @@ void SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered)
void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable) void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
{ {
CHECK_WINDOW_MAGIC(window, ); CHECK_WINDOW_MAGIC(window, );
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
const int want = (resizable != SDL_FALSE); /* normalize the flag. */ const int want = (resizable != SDL_FALSE); /* normalize the flag. */
const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0); const int have = ((window->flags & SDL_WINDOW_RESIZABLE) != 0);
if ((want != have) && (_this->SetWindowResizable)) { if ((want != have) && (_this->SetWindowResizable)) {
@ -2300,7 +2302,7 @@ void SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable)
void SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top) void SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top)
{ {
CHECK_WINDOW_MAGIC(window, ); CHECK_WINDOW_MAGIC(window, );
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
const int want = (on_top != SDL_FALSE); /* normalize the flag. */ const int want = (on_top != SDL_FALSE); /* normalize the flag. */
const int have = ((window->flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0); const int have = ((window->flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0);
if ((want != have) && (_this->SetWindowAlwaysOnTop)) { if ((want != have) && (_this->SetWindowAlwaysOnTop)) {
@ -2344,8 +2346,9 @@ void SDL_SetWindowSize(SDL_Window *window, int w, int h)
window->windowed.w = w; window->windowed.w = w;
window->windowed.h = h; window->windowed.h = h;
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { if (SDL_WINDOW_FULLSCREEN_VISIBLE(window) &&
(window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
window->last_fullscreen_flags = 0; window->last_fullscreen_flags = 0;
SDL_UpdateFullscreenMode(window, SDL_TRUE); SDL_UpdateFullscreenMode(window, SDL_TRUE);
} }
@ -2462,7 +2465,7 @@ void SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h)
window->min_w = min_w; window->min_w = min_w;
window->min_h = min_h; window->min_h = min_h;
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
if (_this->SetWindowMinimumSize) { if (_this->SetWindowMinimumSize) {
_this->SetWindowMinimumSize(_this, window); _this->SetWindowMinimumSize(_this, window);
} }
@ -2502,7 +2505,7 @@ void SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h)
window->max_w = max_w; window->max_w = max_w;
window->max_h = max_h; window->max_h = max_h;
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
if (_this->SetWindowMaximumSize) { if (_this->SetWindowMaximumSize) {
_this->SetWindowMaximumSize(_this, window); _this->SetWindowMaximumSize(_this, window);
} }
@ -2628,22 +2631,27 @@ int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags)
Uint32 oldflags; Uint32 oldflags;
CHECK_WINDOW_MAGIC(window, -1); CHECK_WINDOW_MAGIC(window, -1);
flags &= FULLSCREEN_MASK; flags &= SDL_WINDOW_FULLSCREEN_MASK;
if (flags == (window->flags & FULLSCREEN_MASK)) { /* If both fullscreen exclusive and desktop flags are set, default to desktop */
if ((flags & SDL_WINDOW_FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_MASK) {
flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
}
if (flags == (window->flags & SDL_WINDOW_FULLSCREEN_MASK)) {
return 0; return 0;
} }
/* clear the previous flags and OR in the new ones */ /* clear the previous flags and OR in the new ones */
oldflags = window->flags & FULLSCREEN_MASK; oldflags = window->flags & SDL_WINDOW_FULLSCREEN_MASK;
window->flags &= ~FULLSCREEN_MASK; window->flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
window->flags |= flags; window->flags |= flags;
if (SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)) == 0) { if (SDL_UpdateFullscreenMode(window, SDL_WINDOW_FULLSCREEN_VISIBLE(window)) == 0) {
return 0; return 0;
} }
window->flags &= ~FULLSCREEN_MASK; window->flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
window->flags |= oldflags; window->flags |= oldflags;
return -1; return -1;
} }
@ -3000,15 +3008,15 @@ void SDL_OnWindowHidden(SDL_Window *window)
void SDL_OnWindowDisplayChanged(SDL_Window *window) void SDL_OnWindowDisplayChanged(SDL_Window *window)
{ {
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
SDL_Rect rect; SDL_Rect rect;
if (FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP) { if (SDL_WINDOW_FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
window->last_fullscreen_flags = 0; window->last_fullscreen_flags = 0;
if (SDL_UpdateFullscreenMode(window, SDL_TRUE) != 0) { if (SDL_UpdateFullscreenMode(window, SDL_TRUE) != 0) {
/* Something went wrong and the window is no longer fullscreen. */ /* Something went wrong and the window is no longer fullscreen. */
window->flags &= ~FULLSCREEN_MASK; window->flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
return; return;
} }
} }
@ -3080,7 +3088,7 @@ void SDL_OnWindowRestored(SDL_Window *window)
*/ */
/*SDL_RaiseWindow(window);*/ /*SDL_RaiseWindow(window);*/
if (FULLSCREEN_VISIBLE(window)) { if (SDL_WINDOW_FULLSCREEN_VISIBLE(window)) {
SDL_UpdateFullscreenMode(window, SDL_TRUE); SDL_UpdateFullscreenMode(window, SDL_TRUE);
} }
} }
@ -3114,7 +3122,7 @@ static SDL_bool SDL_ShouldMinimizeOnFocusLoss(SDL_Window *window)
{ {
const char *hint; const char *hint;
if (!(window->flags & SDL_WINDOW_FULLSCREEN) || window->is_destroying) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0 || window->is_destroying) {
return SDL_FALSE; return SDL_FALSE;
} }
@ -3138,7 +3146,7 @@ static SDL_bool SDL_ShouldMinimizeOnFocusLoss(SDL_Window *window)
/* Real fullscreen windows should minimize on focus loss so the desktop video mode is restored */ /* Real fullscreen windows should minimize on focus loss so the desktop video mode is restored */
hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS); hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS);
if (hint == NULL || !*hint || SDL_strcasecmp(hint, "auto") == 0) { if (hint == NULL || !*hint || SDL_strcasecmp(hint, "auto") == 0) {
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP || if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0 ||
ModeSwitchingEmulated(_this) == SDL_TRUE) { ModeSwitchingEmulated(_this) == SDL_TRUE) {
return SDL_FALSE; return SDL_FALSE;
} else { } else {

View file

@ -53,8 +53,6 @@
} while (0) } while (0)
#endif #endif
#define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
#ifndef MAC_OS_X_VERSION_10_12 #ifndef MAC_OS_X_VERSION_10_12
#define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask #define NSEventModifierFlagCapsLock NSAlphaShiftKeyMask
#endif #endif
@ -105,7 +103,7 @@
SDL_Window *window = [self findSDLWindow]; SDL_Window *window = [self findSDLWindow];
if (window == NULL) { if (window == NULL) {
return NO; return NO;
} else if ((window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) { } else if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
return NO; return NO;
} else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) { } else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) {
return NO; return NO;
@ -325,7 +323,7 @@ static NSUInteger GetWindowStyle(SDL_Window *window)
{ {
NSUInteger style = 0; NSUInteger style = 0;
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
style = NSWindowStyleMaskBorderless; style = NSWindowStyleMaskBorderless;
} else { } else {
style = GetWindowWindowedStyle(window); style = GetWindowWindowedStyle(window);
@ -570,9 +568,9 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
if (!videodata.allow_spaces) { if (!videodata.allow_spaces) {
return NO; /* Spaces are forcibly disabled. */ return NO; /* Spaces are forcibly disabled. */
} else if (state && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) { } else if (state && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
return NO; /* we only allow you to make a Space on FULLSCREEN_DESKTOP windows. */ return NO; /* we only allow you to make a Space on FULLSCREEN_DESKTOP windows. */
} else if (!state && ((window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP)) { } else if (!state && (window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == 0) {
return NO; /* we only handle leaving the Space on windows that were previously FULLSCREEN_DESKTOP. */ return NO; /* we only handle leaving the Space on windows that were previously FULLSCREEN_DESKTOP. */
} else if (state == isFullscreenSpace) { } else if (state == isFullscreenSpace) {
return YES; /* already there. */ return YES; /* already there. */
@ -742,7 +740,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
int x, y; int x, y;
SDL_Window *window = _data.window; SDL_Window *window = _data.window;
NSWindow *nswindow = _data.nswindow; NSWindow *nswindow = _data.nswindow;
BOOL fullscreen = window->flags & FULLSCREEN_MASK; BOOL fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
ConvertNSRect([nswindow screen], fullscreen, &rect); ConvertNSRect([nswindow screen], fullscreen, &rect);
@ -781,6 +779,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
NSRect rect; NSRect rect;
int x, y, w, h; int x, y, w, h;
BOOL zoomed; BOOL zoomed;
BOOL fullscreen;
if (inFullscreenTransition) { if (inFullscreenTransition) {
/* We'll take care of this at the end of the transition */ /* We'll take care of this at the end of the transition */
return; return;
@ -794,7 +793,8 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
window = _data.window; window = _data.window;
nswindow = _data.nswindow; nswindow = _data.nswindow;
rect = [nswindow contentRectForFrameRect:[nswindow frame]]; rect = [nswindow contentRectForFrameRect:[nswindow frame]];
ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect); fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
ConvertNSRect([nswindow screen], fullscreen, &rect);
x = (int)rect.origin.x; x = (int)rect.origin.x;
y = (int)rect.origin.y; y = (int)rect.origin.y;
w = (int)rect.size.width; w = (int)rect.size.width;
@ -863,7 +863,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
/* Check to see if someone updated the clipboard */ /* Check to see if someone updated the clipboard */
Cocoa_CheckClipboardUpdate(_data.videodata); Cocoa_CheckClipboardUpdate(_data.videodata);
if ((isFullscreenSpace) && ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { if (isFullscreenSpace && (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
[NSMenu setMenuBarVisible:NO]; [NSMenu setMenuBarVisible:NO];
} }
{ {
@ -962,7 +962,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
pendingWindowOperation = PENDING_OPERATION_NONE; pendingWindowOperation = PENDING_OPERATION_NONE;
[self setFullscreenSpace:NO]; [self setFullscreenSpace:NO];
} else { } else {
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
[NSMenu setMenuBarVisible:NO]; [NSMenu setMenuBarVisible:NO];
} }
@ -1107,7 +1107,7 @@ static void Cocoa_UpdateClipCursor(SDL_Window *window)
- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions - (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
{ {
if ((_data.window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((_data.window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar; return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
} else { } else {
return proposedOptions; return proposedOptions;
@ -1635,7 +1635,8 @@ static int SetupWindowData(_THIS, SDL_Window *window, NSWindow *nswindow, NSView
/* Fill in the SDL window with the window data */ /* Fill in the SDL window with the window data */
{ {
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect); BOOL fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
ConvertNSRect([nswindow screen], fullscreen, &rect);
window->x = (int)rect.origin.x; window->x = (int)rect.origin.x;
window->y = (int)rect.origin.y; window->y = (int)rect.origin.y;
window->w = (int)rect.size.width; window->w = (int)rect.size.width;
@ -1711,6 +1712,7 @@ int Cocoa_CreateWindow(_THIS, SDL_Window *window)
NSWindow *nswindow; NSWindow *nswindow;
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
NSRect rect; NSRect rect;
BOOL fullscreen;
SDL_Rect bounds; SDL_Rect bounds;
NSUInteger style; NSUInteger style;
NSArray *screens = [NSScreen screens]; NSArray *screens = [NSScreen screens];
@ -1723,7 +1725,8 @@ int Cocoa_CreateWindow(_THIS, SDL_Window *window)
rect.origin.y = window->y; rect.origin.y = window->y;
rect.size.width = window->w; rect.size.width = window->w;
rect.size.height = window->h; rect.size.height = window->h;
ConvertNSRect([screens objectAtIndex:0], (window->flags & FULLSCREEN_MASK), &rect); fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
ConvertNSRect([screens objectAtIndex:0], fullscreen, &rect);
style = GetWindowStyle(window); style = GetWindowStyle(window);
@ -1897,13 +1900,15 @@ void Cocoa_SetWindowPosition(_THIS, SDL_Window *window)
SDL_WindowData *windata = (__bridge SDL_WindowData *)window->driverdata; SDL_WindowData *windata = (__bridge SDL_WindowData *)window->driverdata;
NSWindow *nswindow = windata.nswindow; NSWindow *nswindow = windata.nswindow;
NSRect rect; NSRect rect;
BOOL fullscreen;
Uint64 moveHack; Uint64 moveHack;
rect.origin.x = window->x; rect.origin.x = window->x;
rect.origin.y = window->y; rect.origin.y = window->y;
rect.size.width = window->w; rect.size.width = window->w;
rect.size.height = window->h; rect.size.height = window->h;
ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect); fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
ConvertNSRect([nswindow screen], fullscreen, &rect);
moveHack = s_moveHack; moveHack = s_moveHack;
s_moveHack = 0; s_moveHack = 0;
@ -1920,6 +1925,7 @@ void Cocoa_SetWindowSize(_THIS, SDL_Window *window)
SDL_WindowData *windata = (__bridge SDL_WindowData *)window->driverdata; SDL_WindowData *windata = (__bridge SDL_WindowData *)window->driverdata;
NSWindow *nswindow = windata.nswindow; NSWindow *nswindow = windata.nswindow;
NSRect rect; NSRect rect;
BOOL fullscreen;
Uint64 moveHack; Uint64 moveHack;
/* Cocoa will resize the window from the bottom-left rather than the /* Cocoa will resize the window from the bottom-left rather than the
@ -1930,7 +1936,8 @@ void Cocoa_SetWindowSize(_THIS, SDL_Window *window)
rect.origin.y = window->y; rect.origin.y = window->y;
rect.size.width = window->w; rect.size.width = window->w;
rect.size.height = window->h; rect.size.height = window->h;
ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect); fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
ConvertNSRect([nswindow screen], fullscreen, &rect);
moveHack = s_moveHack; moveHack = s_moveHack;
s_moveHack = 0; s_moveHack = 0;
@ -2289,7 +2296,7 @@ void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
Cocoa_UpdateClipCursor(window); Cocoa_UpdateClipCursor(window);
if (data && (window->flags & SDL_WINDOW_FULLSCREEN)) { if (data && (window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS) && ![data.listener isInFullscreenSpace]) { if (SDL_ShouldAllowTopmost() && (window->flags & SDL_WINDOW_INPUT_FOCUS) && ![data.listener isInFullscreenSpace]) {
/* OpenGL is rendering to the window, so make it visible! */ /* OpenGL is rendering to the window, so make it visible! */
/* Doing this in 10.11 while in a Space breaks things (bug #3152) */ /* Doing this in 10.11 while in a Space breaks things (bug #3152) */

View file

@ -33,8 +33,6 @@
#include "SDL_emscriptenevents.h" #include "SDL_emscriptenevents.h"
#include "SDL_emscriptenvideo.h" #include "SDL_emscriptenvideo.h"
#define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN)
/* /*
.keyCode to SDL keycode .keyCode to SDL keycode
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
@ -838,11 +836,11 @@ static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const Emscripten
SDL_VideoDisplay *display; SDL_VideoDisplay *display;
if (fullscreenChangeEvent->isFullscreen) { if (fullscreenChangeEvent->isFullscreen) {
window_data->window->flags |= window_data->requested_fullscreen_mode; window_data->window->flags |= window_data->fullscreen_mode_flags;
window_data->requested_fullscreen_mode = 0; window_data->fullscreen_mode_flags = 0;
} else { } else {
window_data->window->flags &= ~FULLSCREEN_MASK; window_data->window->flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
/* reset fullscreen window if the browser left fullscreen */ /* reset fullscreen window if the browser left fullscreen */
display = SDL_GetDisplayForWindow(window_data->window); display = SDL_GetDisplayForWindow(window_data->window);
@ -868,7 +866,7 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u
} }
} }
if (!(window_data->window->flags & FULLSCREEN_MASK)) { if ((window_data->window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
/* this will only work if the canvas size is set through css */ /* this will only work if the canvas size is set through css */
if (window_data->window->flags & SDL_WINDOW_RESIZABLE) { if (window_data->window->flags & SDL_WINDOW_RESIZABLE) {
double w = window_data->window->w; double w = window_data->window->w;

View file

@ -317,7 +317,7 @@ static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoD
if (fullscreen) { if (fullscreen) {
EmscriptenFullscreenStrategy strategy; EmscriptenFullscreenStrategy strategy;
SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP; SDL_bool is_desktop_fullscreen = ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) ? SDL_TRUE : SDL_FALSE;
int res; int res;
strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT; strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT;
@ -335,13 +335,13 @@ static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoD
strategy.canvasResizedCallback = Emscripten_HandleCanvasResize; strategy.canvasResizedCallback = Emscripten_HandleCanvasResize;
strategy.canvasResizedCallbackUserData = data; strategy.canvasResizedCallbackUserData = data;
data->requested_fullscreen_mode = window->flags & (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN); data->fullscreen_mode_flags = (window->flags & SDL_WINDOW_FULLSCREEN_MASK);
data->fullscreen_resize = is_desktop_fullscreen; data->fullscreen_resize = is_desktop_fullscreen;
res = emscripten_request_fullscreen_strategy(data->canvas_id, 1, &strategy); res = emscripten_request_fullscreen_strategy(data->canvas_id, 1, &strategy);
if (res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) { if (res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) {
/* unset flags, fullscreen failed */ /* unset flags, fullscreen failed */
window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN); window->flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
} }
} else } else
emscripten_exit_fullscreen(); emscripten_exit_fullscreen();

View file

@ -41,7 +41,7 @@ typedef struct SDL_WindowData
SDL_bool external_size; SDL_bool external_size;
int requested_fullscreen_mode; Uint32 fullscreen_mode_flags;
SDL_bool fullscreen_resize; SDL_bool fullscreen_resize;
SDL_bool has_pointer_lock; SDL_bool has_pointer_lock;

View file

@ -52,7 +52,7 @@ static int _InitWindow(_THIS, SDL_Window *window) {
window->y + window->h - 1 window->y + window->h - 1
); );
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
/* TODO: Add support for this flag */ /* TODO: Add support for this flag */
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__); printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
} }

View file

@ -1117,7 +1117,7 @@ static void KMSDRM_GetModeToSet(SDL_Window *window, drmModeModeInfo *out_mode)
SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
SDL_DisplayData *dispdata = (SDL_DisplayData *)display->driverdata; SDL_DisplayData *dispdata = (SDL_DisplayData *)display->driverdata;
if ((window->flags & SDL_WINDOW_FULLSCREEN) == SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
*out_mode = dispdata->fullscreen_mode; *out_mode = dispdata->fullscreen_mode;
} else { } else {
drmModeModeInfo *mode; drmModeModeInfo *mode;

View file

@ -84,7 +84,7 @@ SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window *window)
EGLCHK(display = eglGetDisplay(0)); EGLCHK(display = eglGetDisplay(0));
EGLCHK(eglInitialize(display, NULL, NULL)); EGLCHK(eglInitialize(display, NULL, NULL));
wdata->uses_gles = SDL_TRUE; wdata->uses_gles = SDL_TRUE;
window->flags |= SDL_WINDOW_FULLSCREEN; window->flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
/* Setup the config based on SDL's current values. */ /* Setup the config based on SDL's current values. */
i = 0; i = 0;

View file

@ -40,7 +40,7 @@ int RISCOS_CreateWindow(_THIS, SDL_Window *window)
} }
driverdata->window = window; driverdata->window = window;
window->flags |= SDL_WINDOW_FULLSCREEN; window->flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
SDL_SetMouseFocus(window); SDL_SetMouseFocus(window);

View file

@ -212,7 +212,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
- (BOOL)prefersStatusBarHidden - (BOOL)prefersStatusBarHidden
{ {
BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) != 0; BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_BORDERLESS)) != 0;
return hidden; return hidden;
} }
@ -236,7 +236,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
} }
/* By default, fullscreen and borderless windows get all screen gestures */ /* By default, fullscreen and borderless windows get all screen gestures */
if ((window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) != 0) { if ((window->flags & (SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_BORDERLESS)) != 0) {
return UIRectEdgeAll; return UIRectEdgeAll;
} else { } else {
return UIRectEdgeNone; return UIRectEdgeNone;

View file

@ -194,7 +194,7 @@ int UIKit_CreateWindow(_THIS, SDL_Window *window)
} }
if (data.uiscreen == [UIScreen mainScreen]) { if (data.uiscreen == [UIScreen mainScreen]) {
if (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) { if (window->flags & (SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_BORDERLESS)) {
[UIApplication sharedApplication].statusBarHidden = YES; [UIApplication sharedApplication].statusBarHidden = YES;
} else { } else {
[UIApplication sharedApplication].statusBarHidden = NO; [UIApplication sharedApplication].statusBarHidden = NO;
@ -267,7 +267,7 @@ static void UIKit_UpdateWindowBorder(_THIS, SDL_Window *window)
#if !TARGET_OS_TV #if !TARGET_OS_TV
if (data.uiwindow.screen == [UIScreen mainScreen]) { if (data.uiwindow.screen == [UIScreen mainScreen]) {
if (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) { if (window->flags & (SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_BORDERLESS)) {
[UIApplication sharedApplication].statusBarHidden = YES; [UIApplication sharedApplication].statusBarHidden = YES;
} else { } else {
[UIApplication sharedApplication].statusBarHidden = NO; [UIApplication sharedApplication].statusBarHidden = NO;

View file

@ -100,7 +100,7 @@ SDL_GLContext VITA_GLES_CreateContext(_THIS, SDL_Window *window)
EGLCHK(eglInitialize(display, NULL, NULL)); EGLCHK(eglInitialize(display, NULL, NULL));
wdata->uses_gles = SDL_TRUE; wdata->uses_gles = SDL_TRUE;
window->flags |= SDL_WINDOW_FULLSCREEN; window->flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
EGLCHK(eglBindAPI(EGL_OPENGL_ES_API)); EGLCHK(eglBindAPI(EGL_OPENGL_ES_API));

View file

@ -44,7 +44,6 @@
#include <libdecor.h> #include <libdecor.h>
#endif #endif
#define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)
SDL_FORCE_INLINE SDL_bool FloatEqual(float a, float b) SDL_FORCE_INLINE SDL_bool FloatEqual(float a, float b)
{ {
@ -70,7 +69,7 @@ static void GetFullScreenDimensions(SDL_Window *window, int *width, int *height,
* If the application is DPI aware, it will need to handle the transformations between the * If the application is DPI aware, it will need to handle the transformations between the
* differently sized window and backbuffer spaces on its own. * differently sized window and backbuffer spaces on its own.
*/ */
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
fs_width = output_width; fs_width = output_width;
fs_height = output_height; fs_height = output_height;
@ -113,8 +112,7 @@ static void GetFullScreenDimensions(SDL_Window *window, int *width, int *height,
SDL_FORCE_INLINE SDL_bool FullscreenModeEmulation(SDL_Window *window) SDL_FORCE_INLINE SDL_bool FullscreenModeEmulation(SDL_Window *window)
{ {
return (window->flags & SDL_WINDOW_FULLSCREEN) && return ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0);
((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != SDL_WINDOW_FULLSCREEN_DESKTOP);
} }
SDL_bool SurfaceScaleIsFractional(SDL_Window *window) SDL_bool SurfaceScaleIsFractional(SDL_Window *window)
@ -330,12 +328,12 @@ static void SetMinMaxDimensions(SDL_Window *window, SDL_bool commit)
return; return;
} }
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
min_width = 0; min_width = 0;
min_height = 0; min_height = 0;
max_width = 0; max_width = 0;
max_height = 0; max_height = 0;
} else if (window->flags & SDL_WINDOW_RESIZABLE) { } else if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) {
min_width = window->min_w; min_width = window->min_w;
min_height = window->min_h; min_height = window->min_h;
max_width = window->max_w; max_width = window->max_w;
@ -443,18 +441,18 @@ static void UpdateWindowFullscreen(SDL_Window *window, SDL_bool fullscreen)
SDL_WindowData *wind = (SDL_WindowData *)window->driverdata; SDL_WindowData *wind = (SDL_WindowData *)window->driverdata;
if (fullscreen) { if (fullscreen) {
if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
/* /*
* If the window was never previously made full screen, check if a particular * If the window was never previously made full screen, check if a particular
* fullscreen mode has been set for the window. If one is found, use SDL_WINDOW_FULLSCREEN, * fullscreen mode has been set for the window. If one is found, use SDL_WINDOW_FULLSCREEN_EXCLUSIVE,
* otherwise, use SDL_WINDOW_FULLSCREEN_DESKTOP. * otherwise, use SDL_WINDOW_FULLSCREEN_DESKTOP.
* *
* If the previous flag was SDL_WINDOW_FULLSCREEN, make sure a mode is still set, * If the previous flag was SDL_WINDOW_FULLSCREEN_EXCLUSIVE, make sure a mode is still set,
* otherwise, fall back to SDL_WINDOW_FULLSCREEN_DESKTOP. * otherwise, fall back to SDL_WINDOW_FULLSCREEN_DESKTOP.
*/ */
if (!wind->fullscreen_flags) { if (!wind->fullscreen_flags) {
if (window->fullscreen_mode.pixel_w && window->fullscreen_mode.pixel_h) { if (window->fullscreen_mode.pixel_w && window->fullscreen_mode.pixel_h) {
wind->fullscreen_flags = SDL_WINDOW_FULLSCREEN; wind->fullscreen_flags = SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
} else { } else {
wind->fullscreen_flags = SDL_WINDOW_FULLSCREEN_DESKTOP; wind->fullscreen_flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
} }
@ -472,7 +470,7 @@ static void UpdateWindowFullscreen(SDL_Window *window, SDL_bool fullscreen)
} else { } else {
/* Don't change the fullscreen flags if the window is hidden or being hidden. */ /* Don't change the fullscreen flags if the window is hidden or being hidden. */
if (!window->is_hiding && !(window->flags & SDL_WINDOW_HIDDEN)) { if (!window->is_hiding && !(window->flags & SDL_WINDOW_HIDDEN)) {
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
wind->is_fullscreen = SDL_FALSE; wind->is_fullscreen = SDL_FALSE;
wind->in_fullscreen_transition = SDL_TRUE; wind->in_fullscreen_transition = SDL_TRUE;
@ -1672,7 +1670,7 @@ void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window,
/* Save the last fullscreen flags for future requests by the compositor. */ /* Save the last fullscreen flags for future requests by the compositor. */
if (fullscreen) { if (fullscreen) {
wind->fullscreen_flags = window->flags & FULLSCREEN_MASK; wind->fullscreen_flags = (window->flags & SDL_WINDOW_FULLSCREEN_MASK);
} }
/* Don't send redundant fullscreen set/unset events. */ /* Don't send redundant fullscreen set/unset events. */

View file

@ -1491,7 +1491,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case WM_NCCALCSIZE: case WM_NCCALCSIZE:
{ {
Uint32 window_flags = SDL_GetWindowFlags(data->window); Uint32 window_flags = SDL_GetWindowFlags(data->window);
if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) { if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) != 0 && (window_flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
/* When borderless, need to tell windows that the size of the non-client area is 0 */ /* When borderless, need to tell windows that the size of the non-client area is 0 */
if (!(window_flags & SDL_WINDOW_RESIZABLE)) { if (!(window_flags & SDL_WINDOW_RESIZABLE)) {
int w, h; int w, h;

View file

@ -73,27 +73,27 @@ static DWORD GetWindowStyle(SDL_Window *window)
{ {
DWORD style = 0; DWORD style = 0;
if (window->flags & SDL_WINDOW_FULLSCREEN) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
style |= STYLE_FULLSCREEN; style |= STYLE_FULLSCREEN;
} else { } else {
if (window->flags & SDL_WINDOW_BORDERLESS) { if ((window->flags & SDL_WINDOW_BORDERLESS) != 0) {
style |= STYLE_BORDERLESS_WINDOWED; style |= STYLE_BORDERLESS_WINDOWED;
} else { } else {
style |= STYLE_NORMAL; style |= STYLE_NORMAL;
} }
if (window->flags & SDL_WINDOW_RESIZABLE) { if ((window->flags & SDL_WINDOW_RESIZABLE) != 0) {
/* You can have a borderless resizable window, but Windows doesn't always draw it correctly, /* You can have a borderless resizable window, but Windows doesn't always draw it correctly,
see https://bugzilla.libsdl.org/show_bug.cgi?id=4466 see https://bugzilla.libsdl.org/show_bug.cgi?id=4466
*/ */
if (!(window->flags & SDL_WINDOW_BORDERLESS) || if ((window->flags & SDL_WINDOW_BORDERLESS) == 0 ||
SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_FALSE)) { SDL_GetHintBoolean("SDL_BORDERLESS_RESIZABLE_STYLE", SDL_FALSE)) {
style |= STYLE_RESIZABLE; style |= STYLE_RESIZABLE;
} }
} }
/* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */ /* Need to set initialize minimize style, or when we call ShowWindow with WS_MINIMIZE it will activate a random window */
if (window->flags & SDL_WINDOW_MINIMIZED) { if ((window->flags & SDL_WINDOW_MINIMIZED) != 0) {
style |= WS_MINIMIZE; style |= WS_MINIMIZE;
} }
} }
@ -908,7 +908,7 @@ void WIN_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *displa
int x, y; int x, y;
int w, h; int w, h;
if (!fullscreen && (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) { if (!fullscreen && (window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
/* Resizing the window on hide causes problems restoring it in Wine, and it's unnecessary. /* Resizing the window on hide causes problems restoring it in Wine, and it's unnecessary.
* Also, Windows would preview the minimized window with the wrong size. * Also, Windows would preview the minimized window with the wrong size.
*/ */

View file

@ -492,7 +492,7 @@ void WINRT_VideoQuit(_THIS)
WINRT_QuitMouse(_this); WINRT_QuitMouse(_this);
} }
static const Uint32 WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS; static const Uint32 WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS;
extern "C" Uint32 extern "C" Uint32
WINRT_DetectWindowFlags(SDL_Window *window) WINRT_DetectWindowFlags(SDL_Window *window)
@ -568,7 +568,7 @@ void WINRT_UpdateWindowFlags(SDL_Window *window, Uint32 mask)
mask &= WINRT_DetectableFlags; mask &= WINRT_DetectableFlags;
if (window) { if (window) {
Uint32 apply = WINRT_DetectWindowFlags(window); Uint32 apply = WINRT_DetectWindowFlags(window);
if ((apply & mask) & SDL_WINDOW_FULLSCREEN) { if (((apply & mask) & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
window->last_fullscreen_flags = window->flags; // seems necessary to programmatically un-fullscreen, via SDL APIs window->last_fullscreen_flags = window->flags; // seems necessary to programmatically un-fullscreen, via SDL APIs
} }
window->flags = (window->flags & ~mask) | (apply & mask); window->flags = (window->flags & ~mask) | (apply & mask);
@ -716,9 +716,8 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window)
mode apps, try this. mode apps, try this.
*/ */
bool didSetSize = false; bool didSetSize = false;
if (!(requestedFlags & SDL_WINDOW_FULLSCREEN)) { if ((requestedFlags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w), const Windows::Foundation::Size size(window->w, window->h);
WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h));
didSetSize = data->appView->TryResizeView(size); didSetSize = data->appView->TryResizeView(size);
} }
if (!didSetSize) { if (!didSetSize) {
@ -755,8 +754,7 @@ void WINRT_SetWindowSize(_THIS, SDL_Window *window)
{ {
#if NTDDI_VERSION >= NTDDI_WIN10 #if NTDDI_VERSION >= NTDDI_WIN10
SDL_WindowData *data = (SDL_WindowData *)window->driverdata; SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
const Windows::Foundation::Size size(WINRT_PHYSICAL_PIXELS_TO_DIPS(window->w), const Windows::Foundation::Size size(window->w, window->h);
WINRT_PHYSICAL_PIXELS_TO_DIPS(window->h));
data->appView->TryResizeView(size); // TODO, WinRT: return failure (to caller?) from TryResizeView() data->appView->TryResizeView(size); // TODO, WinRT: return failure (to caller?) from TryResizeView()
#endif #endif
} }

View file

@ -962,7 +962,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
/* In order for interaction with the window decorations and menu to work properly /* In order for interaction with the window decorations and menu to work properly
on Mutter, we need to ungrab the keyboard when the the mouse leaves. */ on Mutter, we need to ungrab the keyboard when the the mouse leaves. */
if (!(data->window->flags & SDL_WINDOW_FULLSCREEN)) { if ((data->window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
X11_SetWindowKeyboardGrab(_this, data->window, SDL_FALSE); X11_SetWindowKeyboardGrab(_this, data->window, SDL_FALSE);
} }
@ -1464,16 +1464,16 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent)
const Uint32 flags = X11_GetNetWMState(_this, data->window, xevent->xproperty.window); const Uint32 flags = X11_GetNetWMState(_this, data->window, xevent->xproperty.window);
const Uint32 changed = flags ^ data->window->flags; const Uint32 changed = flags ^ data->window->flags;
if ((changed & SDL_WINDOW_HIDDEN) || (changed & SDL_WINDOW_FULLSCREEN)) { if ((changed & (SDL_WINDOW_HIDDEN | SDL_WINDOW_FULLSCREEN_MASK)) != 0) {
if (flags & SDL_WINDOW_HIDDEN) { if ((flags & SDL_WINDOW_HIDDEN) != 0) {
X11_DispatchUnmapNotify(data); X11_DispatchUnmapNotify(data);
} else { } else {
X11_DispatchMapNotify(data); X11_DispatchMapNotify(data);
} }
} }
if (changed & SDL_WINDOW_MAXIMIZED) { if ((changed & SDL_WINDOW_MAXIMIZED) != 0) {
if (flags & SDL_WINDOW_MAXIMIZED) { if ((flags & SDL_WINDOW_MAXIMIZED) != 0) {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0); SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0);
} else { } else {
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0); SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_RESTORED, 0, 0);

View file

@ -133,26 +133,26 @@ void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags)
If we did, this would indicate to the window manager that we don't If we did, this would indicate to the window manager that we don't
actually want to be mapped during X11_XMapRaised(), which would be bad. actually want to be mapped during X11_XMapRaised(), which would be bad.
* *
if (flags & SDL_WINDOW_HIDDEN) { if ((flags & SDL_WINDOW_HIDDEN) != 0) {
atoms[count++] = _NET_WM_STATE_HIDDEN; atoms[count++] = _NET_WM_STATE_HIDDEN;
} }
*/ */
if (flags & SDL_WINDOW_ALWAYS_ON_TOP) { if ((flags & SDL_WINDOW_ALWAYS_ON_TOP) != 0) {
atoms[count++] = _NET_WM_STATE_ABOVE; atoms[count++] = _NET_WM_STATE_ABOVE;
} }
if (flags & SDL_WINDOW_SKIP_TASKBAR) { if ((flags & SDL_WINDOW_SKIP_TASKBAR) != 0) {
atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR; atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR;
atoms[count++] = _NET_WM_STATE_SKIP_PAGER; atoms[count++] = _NET_WM_STATE_SKIP_PAGER;
} }
if (flags & SDL_WINDOW_INPUT_FOCUS) { if ((flags & SDL_WINDOW_INPUT_FOCUS) != 0) {
atoms[count++] = _NET_WM_STATE_FOCUSED; atoms[count++] = _NET_WM_STATE_FOCUSED;
} }
if (flags & SDL_WINDOW_MAXIMIZED) { if ((flags & SDL_WINDOW_MAXIMIZED) != 0) {
atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT; atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT;
atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ; atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ;
} }
if (flags & SDL_WINDOW_FULLSCREEN) { if ((flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
atoms[count++] = _NET_WM_STATE_FULLSCREEN; atoms[count++] = _NET_WM_STATE_FULLSCREEN;
} }
@ -207,7 +207,13 @@ X11_GetNetWMState(_THIS, SDL_Window *window, Window xwindow)
} }
if (fullscreen == 1) { if (fullscreen == 1) {
flags |= SDL_WINDOW_FULLSCREEN; if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
/* Pick whatever state the window expects */
flags |= (window->flags & SDL_WINDOW_FULLSCREEN_MASK);
} else {
/* Assume we're fullscreen desktop */
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
} }
if (maximized == 3) { if (maximized == 3) {
@ -1236,7 +1242,7 @@ static void X11_SetWindowMaximized(_THIS, SDL_Window *window, SDL_bool maximized
} else { } else {
window->flags &= ~SDL_WINDOW_MAXIMIZED; window->flags &= ~SDL_WINDOW_MAXIMIZED;
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) { if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
/* Fullscreen windows are maximized on some window managers, /* Fullscreen windows are maximized on some window managers,
and this is functional behavior, so don't remove that state and this is functional behavior, so don't remove that state
now, we'll take care of it when we leave fullscreen mode. now, we'll take care of it when we leave fullscreen mode.
@ -1417,9 +1423,11 @@ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window *window, SDL_VideoDis
flags = window->flags; flags = window->flags;
if (fullscreen) { if (fullscreen) {
flags |= SDL_WINDOW_FULLSCREEN; if ((flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
} else { } else {
flags &= ~SDL_WINDOW_FULLSCREEN; flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
} }
X11_SetNetWMState(_this, data->xwindow, flags); X11_SetNetWMState(_this, data->xwindow, flags);
} }

View file

@ -253,7 +253,7 @@ int video_createWindowVariousFlags(void *arg)
switch (fVariation) { switch (fVariation) {
default: default:
case 0: case 0:
flags = SDL_WINDOW_FULLSCREEN; flags = SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
/* Skip - blanks screen; comment out next line to run test */ /* Skip - blanks screen; comment out next line to run test */
continue; continue;
break; break;

View file

@ -88,7 +88,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_FRect viewport)
SDLTest_DrawString(renderer, x, y, text); SDLTest_DrawString(renderer, x, y, text);
y += lineHeight; y += lineHeight;
SDL_strlcpy(text, "Press Ctrl+Enter to toggle SDL_WINDOW_FULLSCREEN", sizeof text); SDL_strlcpy(text, "Press Ctrl+Enter to toggle SDL_WINDOW_FULLSCREEN_EXCLUSIVE", sizeof text);
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDLTest_DrawString(renderer, x, y, text); SDLTest_DrawString(renderer, x, y, text);
y += lineHeight; y += lineHeight;