Folded SDL_WINDOW_FULLSCREEN_EXCLUSIVE and SDL_WINDOW_FULLSCREEN_DESKTOP into a single SDL_WINDOW_FULLSCREEN flag
The fullscreen video mode used by the window can be used to determine whether it's in exclusive fullscreen or fullscreen desktop mode.main
parent
14338ab459
commit
ac75fe9324
|
@ -1009,7 +1009,7 @@ SDL_GetDesktopDisplayMode() and SDL_GetCurrentDisplayMode() return pointers to d
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
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_WINDOW_FULLSCREEN_DESKTOP has been removed, and you can call SDL_GetWindowFullscreenMode() to see whether an exclusive fullscreen mode will be used or the fullscreen desktop mode will be used when the window is fullscreen.
|
||||||
|
|
||||||
SDL_SetWindowBrightness and SDL_SetWindowGammaRamp have been removed from the API, because they interact poorly with modern operating systems and aren't able to limit their effects to the SDL window.
|
SDL_SetWindowBrightness and SDL_SetWindowGammaRamp have been removed from the API, because they interact poorly with modern operating systems and aren't able to limit their effects to the SDL window.
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (SDL_CreateWindowAndRenderer(0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP, &window, &renderer) != 0) {
|
} else if (SDL_CreateWindowAndRenderer(0, 0, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,6 @@
|
||||||
#define SDL_GetWindowDisplayIndex SDL_GetDisplayForWindow
|
#define SDL_GetWindowDisplayIndex SDL_GetDisplayForWindow
|
||||||
#define SDL_GetWindowDisplayMode SDL_GetWindowFullscreenMode
|
#define SDL_GetWindowDisplayMode SDL_GetWindowFullscreenMode
|
||||||
#define SDL_SetWindowDisplayMode SDL_SetWindowFullscreenMode
|
#define SDL_SetWindowDisplayMode SDL_SetWindowFullscreenMode
|
||||||
#define SDL_WINDOW_FULLSCREEN SDL_WINDOW_FULLSCREEN_EXCLUSIVE
|
|
||||||
#define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_MOUSE_GRABBED
|
#define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_MOUSE_GRABBED
|
||||||
|
|
||||||
#elif !defined(SDL_DISABLE_OLD_NAMES)
|
#elif !defined(SDL_DISABLE_OLD_NAMES)
|
||||||
|
@ -805,7 +804,6 @@
|
||||||
#define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_renamed_SDL_GetDisplayForWindow
|
#define SDL_GetWindowDisplayIndex SDL_GetWindowDisplayIndex_renamed_SDL_GetDisplayForWindow
|
||||||
#define SDL_GetWindowDisplayMode SDL_GetWindowDisplayMode_renamed_SDL_GetWindowFullscreenMode
|
#define SDL_GetWindowDisplayMode SDL_GetWindowDisplayMode_renamed_SDL_GetWindowFullscreenMode
|
||||||
#define SDL_SetWindowDisplayMode SDL_SetWindowDisplayMode_renamed_SDL_SetWindowFullscreenMode
|
#define SDL_SetWindowDisplayMode SDL_SetWindowDisplayMode_renamed_SDL_SetWindowFullscreenMode
|
||||||
#define SDL_WINDOW_FULLSCREEN SDL_WINDOW_FULLSCREEN_renamed_SDL_WINDOW_FULLSCREEN_EXCLUSIVE
|
|
||||||
#define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_INPUT_GRABBED_renamed_SDL_WINDOW_MOUSE_GRABBED
|
#define SDL_WINDOW_INPUT_GRABBED SDL_WINDOW_INPUT_GRABBED_renamed_SDL_WINDOW_MOUSE_GRABBED
|
||||||
|
|
||||||
#endif /* SDL_ENABLE_OLD_NAMES */
|
#endif /* SDL_ENABLE_OLD_NAMES */
|
||||||
|
|
|
@ -59,7 +59,7 @@ extern "C" {
|
||||||
* ::SDL_WINDOW_MOUSE_GRABBED, ::SDL_WINDOW_HIDDEN,
|
* ::SDL_WINDOW_MOUSE_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_MASK is always unset.
|
* and ::SDL_WINDOW_FULLSCREEN 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.
|
||||||
|
|
|
@ -80,6 +80,7 @@ typedef struct
|
||||||
float scale;
|
float scale;
|
||||||
int depth;
|
int depth;
|
||||||
float refresh_rate;
|
float refresh_rate;
|
||||||
|
SDL_bool fullscreen_exclusive;
|
||||||
SDL_DisplayMode fullscreen_mode;
|
SDL_DisplayMode fullscreen_mode;
|
||||||
int num_windows;
|
int num_windows;
|
||||||
SDL_Window **windows;
|
SDL_Window **windows;
|
||||||
|
|
|
@ -107,7 +107,7 @@ typedef struct SDL_Window SDL_Window;
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SDL_WINDOW_FULLSCREEN_EXCLUSIVE = 0x00000001, /**< window is in fullscreen exclusive mode */
|
SDL_WINDOW_FULLSCREEN = 0x00000001, /**< window is in fullscreen 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 */
|
||||||
|
@ -118,7 +118,7 @@ typedef enum
|
||||||
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 = 0x00001000, /**< window is in fullscreen desktop mode */
|
/* 0x00001000 was SDL_WINDOW_FULLSCREEN_DESKTOP in SDL2, please reserve this bit for sdl2-compat. */
|
||||||
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) */
|
||||||
|
@ -133,8 +133,6 @@ typedef enum
|
||||||
|
|
||||||
} 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.
|
||||||
*/
|
*/
|
||||||
|
@ -614,9 +612,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_EXCLUSIVE`: fullscreen window, switching display
|
* - `SDL_WINDOW_FULLSCREEN`: fullscreen window at desktop resolution
|
||||||
* mode to the closest fullscreen 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
|
||||||
* - `SDL_WINDOW_METAL`: window usable with a Metal instance
|
* - `SDL_WINDOW_METAL`: window usable with a Metal instance
|
||||||
|
|
|
@ -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_MASK) != 0) {
|
if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) != 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? */
|
||||||
|
|
|
@ -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_MASK);
|
WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN);
|
||||||
|
|
||||||
/* 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 */
|
||||||
|
|
|
@ -931,7 +931,7 @@ static int SDL_SendKeyboardKeyInternal(Uint64 timestamp, SDL_KeyboardFlags flags
|
||||||
(keyboard->modstate & SDL_KMOD_ALT) &&
|
(keyboard->modstate & SDL_KMOD_ALT) &&
|
||||||
keyboard->focus &&
|
keyboard->focus &&
|
||||||
(keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0 &&
|
(keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) != 0 &&
|
||||||
(keyboard->focus->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0 &&
|
(keyboard->focus->flags & SDL_WINDOW_FULLSCREEN) != 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 */
|
||||||
|
|
|
@ -67,7 +67,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_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
window->windowed.x = data1;
|
window->windowed.x = data1;
|
||||||
window->windowed.y = data2;
|
window->windowed.y = data2;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ int SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent,
|
||||||
window->y = data2;
|
window->y = data2;
|
||||||
break;
|
break;
|
||||||
case SDL_EVENT_WINDOW_RESIZED:
|
case SDL_EVENT_WINDOW_RESIZED:
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
window->windowed.w = data1;
|
window->windowed.w = data1;
|
||||||
window->windowed.h = data2;
|
window->windowed.h = data2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
fullscreen_mode = SDL_GetWindowFullscreenMode(window);
|
fullscreen_mode = SDL_GetWindowFullscreenMode(window);
|
||||||
}
|
}
|
||||||
if (fullscreen_mode) {
|
if (fullscreen_mode) {
|
||||||
|
@ -1613,7 +1613,7 @@ D3D_CreateRenderer(SDL_Window *window, Uint32 flags)
|
||||||
renderer->driverdata = data;
|
renderer->driverdata = data;
|
||||||
|
|
||||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||||
if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
if ((SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
fullscreen_mode = SDL_GetWindowFullscreenMode(window);
|
fullscreen_mode = SDL_GetWindowFullscreenMode(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,12 +234,14 @@ 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_EXCLUSIVE;
|
state->window_flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
state->fullscreen_exclusive = SDL_TRUE;
|
||||||
state->num_windows = 1;
|
state->num_windows = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) {
|
if (SDL_strcasecmp(argv[index], "--fullscreen-desktop") == 0) {
|
||||||
state->window_flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
state->window_flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
state->fullscreen_exclusive = SDL_FALSE;
|
||||||
state->num_windows = 1;
|
state->num_windows = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +250,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_MASK) == 0) {
|
if ((state->window_flags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
state->num_windows = SDL_atoi(argv[index]);
|
state->num_windows = SDL_atoi(argv[index]);
|
||||||
}
|
}
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -668,8 +670,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_EXCLUSIVE:
|
case SDL_WINDOW_FULLSCREEN:
|
||||||
SDL_snprintfcat(text, maxlen, "FULLSCREEN_EXCLUSIVE");
|
SDL_snprintfcat(text, maxlen, "FULLSCREEN");
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOW_OPENGL:
|
case SDL_WINDOW_OPENGL:
|
||||||
SDL_snprintfcat(text, maxlen, "OPENGL");
|
SDL_snprintfcat(text, maxlen, "OPENGL");
|
||||||
|
@ -698,9 +700,6 @@ static void SDLTest_PrintWindowFlag(char *text, size_t maxlen, Uint32 flag)
|
||||||
case SDL_WINDOW_MOUSE_FOCUS:
|
case SDL_WINDOW_MOUSE_FOCUS:
|
||||||
SDL_snprintfcat(text, maxlen, "MOUSE_FOCUS");
|
SDL_snprintfcat(text, maxlen, "MOUSE_FOCUS");
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOW_FULLSCREEN_DESKTOP:
|
|
||||||
SDL_snprintfcat(text, maxlen, "FULLSCREEN_DESKTOP");
|
|
||||||
break;
|
|
||||||
case SDL_WINDOW_FOREIGN:
|
case SDL_WINDOW_FOREIGN:
|
||||||
SDL_snprintfcat(text, maxlen, "FOREIGN");
|
SDL_snprintfcat(text, maxlen, "FOREIGN");
|
||||||
break;
|
break;
|
||||||
|
@ -740,7 +739,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_EXCLUSIVE,
|
SDL_WINDOW_FULLSCREEN,
|
||||||
SDL_WINDOW_OPENGL,
|
SDL_WINDOW_OPENGL,
|
||||||
SDL_WINDOW_HIDDEN,
|
SDL_WINDOW_HIDDEN,
|
||||||
SDL_WINDOW_BORDERLESS,
|
SDL_WINDOW_BORDERLESS,
|
||||||
|
@ -750,7 +749,6 @@ static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags)
|
||||||
SDL_WINDOW_MOUSE_GRABBED,
|
SDL_WINDOW_MOUSE_GRABBED,
|
||||||
SDL_WINDOW_INPUT_FOCUS,
|
SDL_WINDOW_INPUT_FOCUS,
|
||||||
SDL_WINDOW_MOUSE_FOCUS,
|
SDL_WINDOW_MOUSE_FOCUS,
|
||||||
SDL_WINDOW_FULLSCREEN_DESKTOP,
|
|
||||||
SDL_WINDOW_FOREIGN,
|
SDL_WINDOW_FOREIGN,
|
||||||
SDL_WINDOW_MOUSE_CAPTURE,
|
SDL_WINDOW_MOUSE_CAPTURE,
|
||||||
SDL_WINDOW_ALWAYS_ON_TOP,
|
SDL_WINDOW_ALWAYS_ON_TOP,
|
||||||
|
@ -1265,11 +1263,9 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||||
state->window_w = w;
|
state->window_w = w;
|
||||||
state->window_h = h;
|
state->window_h = h;
|
||||||
}
|
}
|
||||||
if ((state->window_flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if ((state->window_flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
if ((state->window_flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
if (state->fullscreen_exclusive) {
|
||||||
SDL_SetWindowFullscreenMode(state->windows[i], &state->fullscreen_mode);
|
SDL_SetWindowFullscreenMode(state->windows[i], &state->fullscreen_mode);
|
||||||
} else {
|
|
||||||
SDL_SetWindowFullscreenMode(state->windows[i], NULL);
|
|
||||||
}
|
}
|
||||||
SDL_SetWindowFullscreen(state->windows[i], SDL_TRUE);
|
SDL_SetWindowFullscreen(state->windows[i], SDL_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -1737,7 +1733,7 @@ static void FullscreenTo(SDLTest_CommonState *state, int index, int windowId)
|
||||||
SDL_GetDisplayBounds(displays[index], &rect);
|
SDL_GetDisplayBounds(displays[index], &rect);
|
||||||
|
|
||||||
flags = SDL_GetWindowFlags(window);
|
flags = SDL_GetWindowFlags(window);
|
||||||
if ((flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||||
SDL_Delay(15);
|
SDL_Delay(15);
|
||||||
}
|
}
|
||||||
|
@ -2051,7 +2047,7 @@ 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_MASK) != 0) {
|
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||||
} else {
|
} else {
|
||||||
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||||
|
@ -2062,7 +2058,7 @@ 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_MASK) != 0) {
|
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||||
} else {
|
} else {
|
||||||
SDL_SetWindowFullscreenMode(window, NULL);
|
SDL_SetWindowFullscreenMode(window, NULL);
|
||||||
|
@ -2073,11 +2069,10 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done
|
||||||
/* Shift-Enter toggle fullscreen desktop / fullscreen */
|
/* Shift-Enter toggle fullscreen desktop / fullscreen */
|
||||||
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);
|
if (SDL_GetWindowFullscreenMode(window)) {
|
||||||
if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
|
|
||||||
SDL_SetWindowFullscreenMode(window, &state->fullscreen_mode);
|
|
||||||
} else {
|
|
||||||
SDL_SetWindowFullscreenMode(window, NULL);
|
SDL_SetWindowFullscreenMode(window, NULL);
|
||||||
|
} else {
|
||||||
|
SDL_SetWindowFullscreenMode(window, &state->fullscreen_mode);
|
||||||
}
|
}
|
||||||
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_MASK) & (~SDL_WINDOW_RESIZABLE));
|
result = SDL_CreateWindow(title, -1000, -1000, w, h, (flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~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);
|
||||||
|
|
|
@ -106,7 +106,8 @@ struct SDL_Window
|
||||||
int max_w, max_h;
|
int max_w, max_h;
|
||||||
int last_pixel_w, last_pixel_h;
|
int last_pixel_w, last_pixel_h;
|
||||||
Uint32 flags;
|
Uint32 flags;
|
||||||
Uint32 last_fullscreen_flags;
|
SDL_bool fullscreen_exclusive; /* The window is currently fullscreen exclusive */
|
||||||
|
SDL_bool last_fullscreen_exclusive; /* The last fullscreen_exclusive setting */
|
||||||
SDL_DisplayID last_displayID;
|
SDL_DisplayID last_displayID;
|
||||||
|
|
||||||
/* Stored position and size for windowed mode */
|
/* Stored position and size for windowed mode */
|
||||||
|
@ -138,7 +139,7 @@ struct SDL_Window
|
||||||
SDL_Window *next;
|
SDL_Window *next;
|
||||||
};
|
};
|
||||||
#define SDL_WINDOW_FULLSCREEN_VISIBLE(W) \
|
#define SDL_WINDOW_FULLSCREEN_VISIBLE(W) \
|
||||||
((((W)->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) && \
|
((((W)->flags & SDL_WINDOW_FULLSCREEN) != 0) && \
|
||||||
(((W)->flags & SDL_WINDOW_HIDDEN) == 0) && \
|
(((W)->flags & SDL_WINDOW_HIDDEN) == 0) && \
|
||||||
(((W)->flags & SDL_WINDOW_MINIMIZED) == 0))
|
(((W)->flags & SDL_WINDOW_MINIMIZED) == 0))
|
||||||
|
|
||||||
|
|
|
@ -1221,7 +1221,7 @@ SDL_DisplayID SDL_GetDisplayForWindow(SDL_Window *window)
|
||||||
* (for example if the window is off-screen), but other code may expect it
|
* (for example if the window is off-screen), but other code may expect it
|
||||||
* to succeed in that situation, so we fall back to a generic position-
|
* to succeed in that situation, so we fall back to a generic position-
|
||||||
* based implementation in that case. */
|
* based implementation in that case. */
|
||||||
if (!displayID && (window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if (!displayID && (window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
displayID = window->fullscreen_mode.displayID;
|
displayID = window->fullscreen_mode.displayID;
|
||||||
}
|
}
|
||||||
if (!displayID) {
|
if (!displayID) {
|
||||||
|
@ -1293,24 +1293,23 @@ static void SDL_RestoreMousePosition(SDL_Window *window)
|
||||||
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
{
|
{
|
||||||
SDL_VideoDisplay *display;
|
SDL_VideoDisplay *display;
|
||||||
SDL_DisplayMode *mode;
|
SDL_DisplayMode *mode = NULL;
|
||||||
|
|
||||||
CHECK_WINDOW_MAGIC(window, -1);
|
CHECK_WINDOW_MAGIC(window, -1);
|
||||||
|
|
||||||
|
window->fullscreen_exclusive = SDL_FALSE;
|
||||||
|
|
||||||
/* if we are in the process of hiding don't go back to fullscreen */
|
/* if we are in the process of hiding don't go back to fullscreen */
|
||||||
if (window->is_hiding && fullscreen) {
|
if (window->is_hiding && fullscreen) {
|
||||||
return 0;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
display = SDL_GetVideoDisplayForWindow(window);
|
display = SDL_GetVideoDisplayForWindow(window);
|
||||||
|
|
||||||
mode = NULL;
|
if (fullscreen) {
|
||||||
if (fullscreen && (window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
|
||||||
mode = (SDL_DisplayMode *)SDL_GetWindowFullscreenMode(window);
|
mode = (SDL_DisplayMode *)SDL_GetWindowFullscreenMode(window);
|
||||||
if (!mode || mode->displayID != display->id) {
|
if (mode != NULL) {
|
||||||
/* Couldn't find a matching mode, pop out of fullscreen mode */
|
window->fullscreen_exclusive = SDL_TRUE;
|
||||||
window->flags &= ~SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
|
|
||||||
fullscreen = SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,20 +1318,17 @@ 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 & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
|
if (window->is_destroying && !window->last_fullscreen_exclusive) {
|
||||||
return 0;
|
window->fullscreen_exclusive = SDL_FALSE;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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 exclusive fullscreen, we need to get back to normal first. */
|
||||||
if (fullscreen &&
|
if (fullscreen && !window->last_fullscreen_exclusive && window->fullscreen_exclusive) {
|
||||||
(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;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (fullscreen &&
|
} else if (fullscreen && window->last_fullscreen_exclusive && !window->fullscreen_exclusive) {
|
||||||
(window->last_fullscreen_flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0 &&
|
|
||||||
(window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
|
|
||||||
display = SDL_GetVideoDisplayForWindow(window);
|
display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_SetDisplayModeForDisplay(display, NULL);
|
SDL_SetDisplayModeForDisplay(display, NULL);
|
||||||
if (_this->SetWindowFullscreen) {
|
if (_this->SetWindowFullscreen) {
|
||||||
|
@ -1342,10 +1338,9 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
|
|
||||||
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
|
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
|
||||||
if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
|
if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
|
||||||
return -1;
|
goto error;
|
||||||
}
|
}
|
||||||
window->last_fullscreen_flags = window->flags;
|
goto done;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
|
#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
|
||||||
|
@ -1357,7 +1352,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) & SDL_WINDOW_FULLSCREEN_MASK)) {
|
if (fullscreen == !(WINRT_DetectWindowFlags(window) & SDL_WINDOW_FULLSCREEN)) {
|
||||||
/* 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
|
||||||
|
@ -1365,15 +1360,27 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
WinRT 8.x can't resolve either programmatically, so we're
|
WinRT 8.x can't resolve either programmatically, so we're
|
||||||
giving up.
|
giving up.
|
||||||
*/
|
*/
|
||||||
return -1;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
/* Whatever was requested, fullscreen or windowed mode, is already
|
/* Whatever was requested, fullscreen or windowed mode, is already
|
||||||
in-place.
|
in-place.
|
||||||
*/
|
*/
|
||||||
return 0;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Restore the video mode on other displays if needed */
|
||||||
|
if (window->last_fullscreen_exclusive) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < _this->num_displays; ++i) {
|
||||||
|
SDL_VideoDisplay *other = &_this->displays[i];
|
||||||
|
if (display != other && other->fullscreen_window == window) {
|
||||||
|
SDL_SetDisplayModeForDisplay(other, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
int mode_w = 0, mode_h = 0;
|
int mode_w = 0, mode_h = 0;
|
||||||
SDL_bool resized = SDL_FALSE;
|
SDL_bool resized = SDL_FALSE;
|
||||||
|
@ -1385,7 +1392,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_SetDisplayModeForDisplay(display, mode) < 0) {
|
if (SDL_SetDisplayModeForDisplay(display, mode) < 0) {
|
||||||
return -1;
|
goto error;
|
||||||
}
|
}
|
||||||
if (_this->SetWindowFullscreen) {
|
if (_this->SetWindowFullscreen) {
|
||||||
_this->SetWindowFullscreen(_this, window, display, SDL_TRUE);
|
_this->SetWindowFullscreen(_this, window, display, SDL_TRUE);
|
||||||
|
@ -1395,7 +1402,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
/* Android may not resize the window to exactly what our fullscreen mode is,
|
/* Android may not resize the window to exactly what our fullscreen mode is,
|
||||||
* especially on windowed Android environments like the Chromebook or Samsung DeX.
|
* especially on windowed Android environments like the Chromebook or Samsung DeX.
|
||||||
* Given this, we shouldn't use the mode size. As such, Android's SetWindowFullscreen
|
* Given this, we shouldn't use the mode size. Android's SetWindowFullscreen
|
||||||
* will generate the window event for us with the proper final size.
|
* will generate the window event for us with the proper final size.
|
||||||
*/
|
*/
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
@ -1424,7 +1431,6 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
SDL_RestoreMousePosition(window);
|
SDL_RestoreMousePosition(window);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (display->fullscreen_window == window) {
|
if (display->fullscreen_window == window) {
|
||||||
/* Restore the desktop mode */
|
/* Restore the desktop mode */
|
||||||
SDL_SetDisplayModeForDisplay(display, NULL);
|
SDL_SetDisplayModeForDisplay(display, NULL);
|
||||||
|
@ -1443,9 +1449,17 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
|
||||||
SDL_RestoreMousePosition(window);
|
SDL_RestoreMousePosition(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
window->last_fullscreen_flags = window->flags;
|
done:
|
||||||
|
window->last_fullscreen_exclusive = window->fullscreen_exclusive;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (fullscreen) {
|
||||||
|
/* Something went wrong and the window is no longer fullscreen. */
|
||||||
|
window->flags &= ~SDL_WINDOW_FULLSCREEN;
|
||||||
|
SDL_UpdateFullscreenMode(window, SDL_FALSE);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode)
|
int SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode)
|
||||||
|
@ -1459,18 +1473,8 @@ int SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode)
|
||||||
|
|
||||||
/* Save the mode so we can look up the closest match later */
|
/* Save the mode so we can look up the closest match later */
|
||||||
SDL_memcpy(&window->fullscreen_mode, mode, sizeof(window->fullscreen_mode));
|
SDL_memcpy(&window->fullscreen_mode, mode, sizeof(window->fullscreen_mode));
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
|
|
||||||
window->flags &= ~SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
window->flags |= SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
SDL_zero(window->fullscreen_mode);
|
SDL_zero(window->fullscreen_mode);
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
|
||||||
window->flags &= ~SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
|
|
||||||
window->flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_WINDOW_FULLSCREEN_VISIBLE(window)) {
|
if (SDL_WINDOW_FULLSCREEN_VISIBLE(window)) {
|
||||||
|
@ -1554,7 +1558,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_MASK) {
|
if (flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
SDL_SetWindowFullscreen(window, flags);
|
SDL_SetWindowFullscreen(window, flags);
|
||||||
}
|
}
|
||||||
if (flags & SDL_WINDOW_MOUSE_GRABBED) {
|
if (flags & SDL_WINDOW_MOUSE_GRABBED) {
|
||||||
|
@ -1698,14 +1702,10 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & SDL_WINDOW_FULLSCREEN_MASK) {
|
if (flags & SDL_WINDOW_FULLSCREEN) {
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_Rect bounds;
|
SDL_Rect bounds;
|
||||||
|
|
||||||
/* Fullscreen at window creation time is always fullscreen desktop */
|
|
||||||
flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
|
|
||||||
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
|
|
||||||
SDL_GetDisplayBounds(display->id, &bounds);
|
SDL_GetDisplayBounds(display->id, &bounds);
|
||||||
window->x = bounds.x;
|
window->x = bounds.x;
|
||||||
window->y = bounds.y;
|
window->y = bounds.y;
|
||||||
|
@ -1714,7 +1714,6 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
|
||||||
}
|
}
|
||||||
|
|
||||||
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
||||||
window->last_fullscreen_flags = window->flags;
|
|
||||||
window->opacity = 1.0f;
|
window->opacity = 1.0f;
|
||||||
window->next = _this->windows;
|
window->next = _this->windows;
|
||||||
window->is_destroying = SDL_FALSE;
|
window->is_destroying = SDL_FALSE;
|
||||||
|
@ -1810,7 +1809,6 @@ SDL_Window *SDL_CreateWindowFrom(const void *data)
|
||||||
window->magic = &_this->window_magic;
|
window->magic = &_this->window_magic;
|
||||||
window->id = _this->next_object_id++;
|
window->id = _this->next_object_id++;
|
||||||
window->flags = flags;
|
window->flags = flags;
|
||||||
window->last_fullscreen_flags = window->flags;
|
|
||||||
window->is_destroying = SDL_FALSE;
|
window->is_destroying = SDL_FALSE;
|
||||||
window->opacity = 1.0f;
|
window->opacity = 1.0f;
|
||||||
window->next = _this->windows;
|
window->next = _this->windows;
|
||||||
|
@ -1932,7 +1930,6 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
||||||
window->last_fullscreen_flags = window->flags;
|
|
||||||
window->is_destroying = SDL_FALSE;
|
window->is_destroying = SDL_FALSE;
|
||||||
|
|
||||||
if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
||||||
|
@ -2139,7 +2136,7 @@ void SDL_SetWindowPosition(SDL_Window *window, int x, int y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
|
if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
|
||||||
window->windowed.x = x;
|
window->windowed.x = x;
|
||||||
}
|
}
|
||||||
|
@ -2165,7 +2162,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_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
SDL_DisplayID displayID;
|
SDL_DisplayID displayID;
|
||||||
|
|
||||||
if (x) {
|
if (x) {
|
||||||
|
@ -2204,7 +2201,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_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 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)) {
|
||||||
|
@ -2221,7 +2218,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_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 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)) {
|
||||||
|
@ -2238,7 +2235,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_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 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)) {
|
||||||
|
@ -2350,7 +2347,7 @@ void SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h)
|
||||||
|
|
||||||
SDL_GetWindowSize(window, w, h);
|
SDL_GetWindowSize(window, w, h);
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
if (SDL_GetWindowFullscreenMode(window)) {
|
||||||
mode = SDL_GetCurrentDisplayMode(displayID);
|
mode = SDL_GetCurrentDisplayMode(displayID);
|
||||||
} else {
|
} else {
|
||||||
mode = SDL_GetDesktopDisplayMode(displayID);
|
mode = SDL_GetDesktopDisplayMode(displayID);
|
||||||
|
@ -2391,7 +2388,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_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
if (_this->SetWindowMinimumSize) {
|
if (_this->SetWindowMinimumSize) {
|
||||||
_this->SetWindowMinimumSize(_this, window);
|
_this->SetWindowMinimumSize(_this, window);
|
||||||
}
|
}
|
||||||
|
@ -2431,7 +2428,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_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
if (_this->SetWindowMaximumSize) {
|
if (_this->SetWindowMaximumSize) {
|
||||||
_this->SetWindowMaximumSize(_this, window);
|
_this->SetWindowMaximumSize(_this, window);
|
||||||
}
|
}
|
||||||
|
@ -2554,26 +2551,16 @@ void SDL_RestoreWindow(SDL_Window *window)
|
||||||
|
|
||||||
int SDL_SetWindowFullscreen(SDL_Window *window, SDL_bool fullscreen)
|
int SDL_SetWindowFullscreen(SDL_Window *window, SDL_bool fullscreen)
|
||||||
{
|
{
|
||||||
Uint32 flags;
|
Uint32 flags = fullscreen ? SDL_WINDOW_FULLSCREEN : 0;
|
||||||
|
|
||||||
CHECK_WINDOW_MAGIC(window, -1);
|
CHECK_WINDOW_MAGIC(window, -1);
|
||||||
|
|
||||||
if (fullscreen) {
|
if (flags == (window->flags & SDL_WINDOW_FULLSCREEN)) {
|
||||||
if (SDL_GetWindowFullscreenMode(window)) {
|
|
||||||
flags = SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
|
|
||||||
} else {
|
|
||||||
flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
flags = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 */
|
||||||
window->flags = (window->flags & ~SDL_WINDOW_FULLSCREEN_MASK) | flags;
|
window->flags = (window->flags & ~SDL_WINDOW_FULLSCREEN) | flags;
|
||||||
|
|
||||||
return SDL_UpdateFullscreenMode(window, SDL_WINDOW_FULLSCREEN_VISIBLE(window));
|
return SDL_UpdateFullscreenMode(window, SDL_WINDOW_FULLSCREEN_VISIBLE(window));
|
||||||
}
|
}
|
||||||
|
@ -2930,20 +2917,13 @@ void SDL_OnWindowHidden(SDL_Window *window)
|
||||||
|
|
||||||
void SDL_OnWindowDisplayChanged(SDL_Window *window)
|
void SDL_OnWindowDisplayChanged(SDL_Window *window)
|
||||||
{
|
{
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
if (SDL_WINDOW_FULLSCREEN_VISIBLE(window) && (window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
|
||||||
window->last_fullscreen_flags = 0;
|
|
||||||
|
|
||||||
if (SDL_UpdateFullscreenMode(window, SDL_TRUE) != 0) {
|
|
||||||
/* Something went wrong and the window is no longer fullscreen. */
|
|
||||||
window->flags &= ~SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
|
|
||||||
|
if (SDL_WINDOW_FULLSCREEN_VISIBLE(window) && window->fullscreen_exclusive) {
|
||||||
|
SDL_UpdateFullscreenMode(window, SDL_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If mode switching is being emulated, the display bounds don't necessarily reflect the
|
* If mode switching is being emulated, the display bounds don't necessarily reflect the
|
||||||
* emulated mode dimensions since the window is just being scaled.
|
* emulated mode dimensions since the window is just being scaled.
|
||||||
|
@ -3047,7 +3027,7 @@ static SDL_bool SDL_ShouldMinimizeOnFocusLoss(SDL_Window *window)
|
||||||
{
|
{
|
||||||
const char *hint;
|
const char *hint;
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0 || window->is_destroying) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0 || window->is_destroying) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3071,11 +3051,10 @@ 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) != 0 ||
|
if (window->fullscreen_exclusive && !ModeSwitchingEmulated(_this)) {
|
||||||
ModeSwitchingEmulated(_this) == SDL_TRUE) {
|
|
||||||
return SDL_FALSE;
|
|
||||||
} else {
|
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
|
} else {
|
||||||
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SDL_GetHintBoolean(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_FALSE);
|
return SDL_GetHintBoolean(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, SDL_FALSE);
|
||||||
|
|
|
@ -103,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_MASK) != 0) {
|
} else if ((window->flags & SDL_WINDOW_FULLSCREEN) != 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;
|
||||||
|
@ -323,7 +323,7 @@ static NSUInteger GetWindowStyle(SDL_Window *window)
|
||||||
{
|
{
|
||||||
NSUInteger style = 0;
|
NSUInteger style = 0;
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
style = NSWindowStyleMaskBorderless;
|
style = NSWindowStyleMaskBorderless;
|
||||||
} else {
|
} else {
|
||||||
style = GetWindowWindowedStyle(window);
|
style = GetWindowWindowedStyle(window);
|
||||||
|
@ -568,10 +568,10 @@ 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) == 0) {
|
} else if (state && window->fullscreen_exclusive) {
|
||||||
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) == 0) {
|
} else if (!state && window->last_fullscreen_exclusive) {
|
||||||
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. */
|
||||||
}
|
}
|
||||||
|
@ -740,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 & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
|
BOOL fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
||||||
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
|
||||||
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ 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]];
|
||||||
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
|
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
||||||
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
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;
|
||||||
|
@ -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) != 0) {
|
if (isFullscreenSpace && !window->fullscreen_exclusive) {
|
||||||
[NSMenu setMenuBarVisible:NO];
|
[NSMenu setMenuBarVisible:NO];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -967,7 +967,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) != 0) {
|
if (window->fullscreen_exclusive) {
|
||||||
[NSMenu setMenuBarVisible:NO];
|
[NSMenu setMenuBarVisible:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1112,7 +1112,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) != 0) {
|
if (_data.window->fullscreen_exclusive) {
|
||||||
return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
|
return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar;
|
||||||
} else {
|
} else {
|
||||||
return proposedOptions;
|
return proposedOptions;
|
||||||
|
@ -1640,7 +1640,7 @@ 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]];
|
||||||
BOOL fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
|
BOOL fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
||||||
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
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;
|
||||||
|
@ -1730,7 +1730,7 @@ 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;
|
||||||
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
|
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
||||||
ConvertNSRect([screens objectAtIndex:0], fullscreen, &rect);
|
ConvertNSRect([screens objectAtIndex:0], fullscreen, &rect);
|
||||||
|
|
||||||
style = GetWindowStyle(window);
|
style = GetWindowStyle(window);
|
||||||
|
@ -1765,7 +1765,7 @@ int Cocoa_CreateWindow(_THIS, SDL_Window *window)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (videodata.allow_spaces) {
|
if (videodata.allow_spaces) {
|
||||||
/* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */
|
/* we put fullscreen desktop windows in their own Space, without a toggle button or menubar, later */
|
||||||
if (window->flags & SDL_WINDOW_RESIZABLE) {
|
if (window->flags & SDL_WINDOW_RESIZABLE) {
|
||||||
/* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
|
/* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
|
||||||
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
[nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||||
|
@ -1912,7 +1912,7 @@ void Cocoa_SetWindowPosition(_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;
|
||||||
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
|
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
||||||
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
||||||
|
|
||||||
moveHack = s_moveHack;
|
moveHack = s_moveHack;
|
||||||
|
@ -1941,7 +1941,7 @@ 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;
|
||||||
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_MASK) ? YES : NO;
|
fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN) ? YES : NO;
|
||||||
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
ConvertNSRect([nswindow screen], fullscreen, &rect);
|
||||||
|
|
||||||
moveHack = s_moveHack;
|
moveHack = s_moveHack;
|
||||||
|
@ -2298,7 +2298,7 @@ void Cocoa_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed)
|
||||||
|
|
||||||
Cocoa_UpdateClipCursor(window);
|
Cocoa_UpdateClipCursor(window);
|
||||||
|
|
||||||
if (data && (window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if (data && (window->flags & SDL_WINDOW_FULLSCREEN) != 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) */
|
||||||
|
|
|
@ -840,7 +840,7 @@ static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const Emscripten
|
||||||
|
|
||||||
window_data->fullscreen_mode_flags = 0;
|
window_data->fullscreen_mode_flags = 0;
|
||||||
} else {
|
} else {
|
||||||
window_data->window->flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
|
window_data->window->flags &= ~SDL_WINDOW_FULLSCREEN;
|
||||||
|
|
||||||
/* reset fullscreen window if the browser left fullscreen */
|
/* reset fullscreen window if the browser left fullscreen */
|
||||||
display = SDL_GetVideoDisplayForWindow(window_data->window);
|
display = SDL_GetVideoDisplayForWindow(window_data->window);
|
||||||
|
@ -866,7 +866,7 @@ static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *u
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((window_data->window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
|
if ((window_data->window->flags & SDL_WINDOW_FULLSCREEN) == 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;
|
||||||
|
|
|
@ -315,12 +315,12 @@ 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) != 0) ? SDL_TRUE : SDL_FALSE;
|
SDL_bool is_fullscreen_desktop = window->fullscreen_exclusive ? SDL_FALSE : SDL_TRUE;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT;
|
strategy.scaleMode = is_fullscreen_desktop ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT;
|
||||||
|
|
||||||
if (!is_desktop_fullscreen) {
|
if (!is_fullscreen_desktop) {
|
||||||
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE;
|
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE;
|
||||||
} else if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
} else if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
|
||||||
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF;
|
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF;
|
||||||
|
@ -333,13 +333,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->fullscreen_mode_flags = (window->flags & SDL_WINDOW_FULLSCREEN_MASK);
|
data->fullscreen_mode_flags = (window->flags & SDL_WINDOW_FULLSCREEN);
|
||||||
data->fullscreen_resize = is_desktop_fullscreen;
|
data->fullscreen_resize = is_fullscreen_desktop;
|
||||||
|
|
||||||
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_MASK;
|
window->flags &= ~SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
emscripten_exit_fullscreen();
|
emscripten_exit_fullscreen();
|
||||||
|
|
|
@ -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_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
/* TODO: Add support for this flag */
|
/* TODO: Add support for this flag */
|
||||||
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
|
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1115,7 +1115,7 @@ static void KMSDRM_GetModeToSet(SDL_Window *window, drmModeModeInfo *out_mode)
|
||||||
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
|
||||||
SDL_DisplayData *dispdata = display->driverdata;
|
SDL_DisplayData *dispdata = display->driverdata;
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
if (window->fullscreen_exclusive) {
|
||||||
*out_mode = dispdata->fullscreen_mode;
|
*out_mode = dispdata->fullscreen_mode;
|
||||||
} else {
|
} else {
|
||||||
drmModeModeInfo *mode = KMSDRM_GetClosestDisplayMode(display, window->windowed.w, window->windowed.h);
|
drmModeModeInfo *mode = KMSDRM_GetClosestDisplayMode(display, window->windowed.w, window->windowed.h);
|
||||||
|
|
|
@ -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_DESKTOP;
|
window->flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
|
||||||
/* Setup the config based on SDL's current values. */
|
/* Setup the config based on SDL's current values. */
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
|
@ -40,7 +40,7 @@ int RISCOS_CreateWindow(_THIS, SDL_Window *window)
|
||||||
}
|
}
|
||||||
driverdata->window = window;
|
driverdata->window = window;
|
||||||
|
|
||||||
window->flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
window->flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
|
||||||
SDL_SetMouseFocus(window);
|
SDL_SetMouseFocus(window);
|
||||||
|
|
||||||
|
|
|
@ -556,7 +556,7 @@ void SDL_OnApplicationDidChangeStatusBarOrientation()
|
||||||
|
|
||||||
/* The desktop display mode should be kept in sync with the screen
|
/* The desktop display mode should be kept in sync with the screen
|
||||||
* orientation so that updating a window's fullscreen state to
|
* orientation so that updating a window's fullscreen state to
|
||||||
* SDL_WINDOW_FULLSCREEN_DESKTOP keeps the window dimensions in the
|
* fullscreen desktop keeps the window dimensions in the
|
||||||
* correct orientation. */
|
* correct orientation. */
|
||||||
if (isLandscape != (mode->pixel_w > mode->pixel_h)) {
|
if (isLandscape != (mode->pixel_w > mode->pixel_h)) {
|
||||||
int height = mode->pixel_w;
|
int height = mode->pixel_w;
|
||||||
|
|
|
@ -212,7 +212,7 @@ static void SDLCALL SDL_HideHomeIndicatorHintChanged(void *userdata, const char
|
||||||
|
|
||||||
- (BOOL)prefersStatusBarHidden
|
- (BOOL)prefersStatusBarHidden
|
||||||
{
|
{
|
||||||
BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_BORDERLESS)) != 0;
|
BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN | 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_MASK | SDL_WINDOW_BORDERLESS)) != 0) {
|
if ((window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) != 0) {
|
||||||
return UIRectEdgeAll;
|
return UIRectEdgeAll;
|
||||||
} else {
|
} else {
|
||||||
return UIRectEdgeNone;
|
return UIRectEdgeNone;
|
||||||
|
|
|
@ -182,7 +182,7 @@ int UIKit_CreateWindow(_THIS, SDL_Window *window)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.uiscreen == [UIScreen mainScreen]) {
|
if (data.uiscreen == [UIScreen mainScreen]) {
|
||||||
if (window->flags & (SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_BORDERLESS)) {
|
if (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) {
|
||||||
[UIApplication sharedApplication].statusBarHidden = YES;
|
[UIApplication sharedApplication].statusBarHidden = YES;
|
||||||
} else {
|
} else {
|
||||||
[UIApplication sharedApplication].statusBarHidden = NO;
|
[UIApplication sharedApplication].statusBarHidden = NO;
|
||||||
|
@ -255,7 +255,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_MASK | SDL_WINDOW_BORDERLESS)) {
|
if (window->flags & (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS)) {
|
||||||
[UIApplication sharedApplication].statusBarHidden = YES;
|
[UIApplication sharedApplication].statusBarHidden = YES;
|
||||||
} else {
|
} else {
|
||||||
[UIApplication sharedApplication].statusBarHidden = NO;
|
[UIApplication sharedApplication].statusBarHidden = NO;
|
||||||
|
|
|
@ -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_DESKTOP;
|
window->flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
|
|
||||||
EGLCHK(eglBindAPI(EGL_OPENGL_ES_API));
|
EGLCHK(eglBindAPI(EGL_OPENGL_ES_API));
|
||||||
|
|
||||||
|
|
|
@ -64,12 +64,23 @@ static void GetFullScreenDimensions(SDL_Window *window, int *width, int *height,
|
||||||
const int output_width = wind->fs_output_width ? wind->fs_output_width : output->screen_width;
|
const int output_width = wind->fs_output_width ? wind->fs_output_width : output->screen_width;
|
||||||
const int output_height = wind->fs_output_height ? wind->fs_output_height : output->screen_height;
|
const int output_height = wind->fs_output_height ? wind->fs_output_height : output->screen_height;
|
||||||
|
|
||||||
/*
|
if (window->fullscreen_exclusive) {
|
||||||
* Fullscreen desktop mandates a desktop sized window, so that's what applications will get.
|
/* If a mode was set, use it, otherwise use the native resolution. */
|
||||||
* If the application is DPI aware, it will need to handle the transformations between the
|
const SDL_DisplayMode *mode = SDL_GetWindowFullscreenMode(window);
|
||||||
* differently sized window and backbuffer spaces on its own.
|
if (!mode) {
|
||||||
*/
|
mode = &disp->desktop_mode;
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
|
}
|
||||||
|
fs_width = mode->screen_w;
|
||||||
|
fs_height = mode->screen_h;
|
||||||
|
buf_width = mode->pixel_w;
|
||||||
|
buf_height = mode->pixel_h;
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Fullscreen desktop mandates a desktop sized window, so that's what
|
||||||
|
* applications will get. If the application is DPI aware, it will need
|
||||||
|
* to handle the transformations between the differently sized window
|
||||||
|
* and backbuffer spaces on its own.
|
||||||
|
*/
|
||||||
fs_width = output_width;
|
fs_width = output_width;
|
||||||
fs_height = output_height;
|
fs_height = output_height;
|
||||||
|
|
||||||
|
@ -81,16 +92,6 @@ static void GetFullScreenDimensions(SDL_Window *window, int *width, int *height,
|
||||||
buf_width = fs_width;
|
buf_width = fs_width;
|
||||||
buf_height = fs_height;
|
buf_height = fs_height;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* If a mode was set, use it, otherwise use the native resolution. */
|
|
||||||
const SDL_DisplayMode *mode = SDL_GetWindowFullscreenMode(window);
|
|
||||||
if (!mode) {
|
|
||||||
mode = &disp->desktop_mode;
|
|
||||||
}
|
|
||||||
fs_width = mode->screen_w;
|
|
||||||
fs_height = mode->screen_h;
|
|
||||||
buf_width = mode->pixel_w;
|
|
||||||
buf_height = mode->pixel_h;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (width) {
|
if (width) {
|
||||||
|
@ -109,7 +110,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_EXCLUSIVE) != 0);
|
return window->fullscreen_exclusive;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool SurfaceScaleIsFractional(SDL_Window *window)
|
SDL_bool SurfaceScaleIsFractional(SDL_Window *window)
|
||||||
|
@ -325,7 +326,7 @@ static void SetMinMaxDimensions(SDL_Window *window, SDL_bool commit)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_EXCLUSIVE) != 0) {
|
if (window->fullscreen_exclusive) {
|
||||||
min_width = 0;
|
min_width = 0;
|
||||||
min_height = 0;
|
min_height = 0;
|
||||||
max_width = 0;
|
max_width = 0;
|
||||||
|
@ -438,40 +439,19 @@ static void UpdateWindowFullscreen(SDL_Window *window, SDL_bool fullscreen)
|
||||||
SDL_WindowData *wind = window->driverdata;
|
SDL_WindowData *wind = window->driverdata;
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
/*
|
|
||||||
* 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_EXCLUSIVE,
|
|
||||||
* otherwise, use SDL_WINDOW_FULLSCREEN_DESKTOP.
|
|
||||||
*
|
|
||||||
* If the previous flag was SDL_WINDOW_FULLSCREEN_EXCLUSIVE, make sure a mode is still set,
|
|
||||||
* otherwise, fall back to SDL_WINDOW_FULLSCREEN_DESKTOP.
|
|
||||||
*/
|
|
||||||
if (!wind->fullscreen_flags) {
|
|
||||||
if (window->fullscreen_mode.pixel_w && window->fullscreen_mode.pixel_h) {
|
|
||||||
wind->fullscreen_flags = SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
|
|
||||||
} else {
|
|
||||||
wind->fullscreen_flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
}
|
|
||||||
} else if (wind->fullscreen_flags != SDL_WINDOW_FULLSCREEN_DESKTOP &&
|
|
||||||
(!window->fullscreen_mode.pixel_w || !window->fullscreen_mode.pixel_h)) {
|
|
||||||
wind->fullscreen_flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
wind->is_fullscreen = SDL_TRUE;
|
wind->is_fullscreen = SDL_TRUE;
|
||||||
|
|
||||||
wind->in_fullscreen_transition = SDL_TRUE;
|
wind->in_fullscreen_transition = SDL_TRUE;
|
||||||
SDL_SetWindowFullscreen(window, wind->fullscreen_flags);
|
SDL_SetWindowFullscreen(window, SDL_TRUE);
|
||||||
wind->in_fullscreen_transition = SDL_FALSE;
|
wind->in_fullscreen_transition = SDL_FALSE;
|
||||||
}
|
}
|
||||||
} 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_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
wind->is_fullscreen = SDL_FALSE;
|
wind->is_fullscreen = SDL_FALSE;
|
||||||
|
|
||||||
wind->in_fullscreen_transition = SDL_TRUE;
|
wind->in_fullscreen_transition = SDL_TRUE;
|
||||||
SDL_SetWindowFullscreen(window, 0);
|
SDL_SetWindowFullscreen(window, SDL_FALSE);
|
||||||
wind->in_fullscreen_transition = SDL_FALSE;
|
wind->in_fullscreen_transition = SDL_FALSE;
|
||||||
SetMinMaxDimensions(window, SDL_FALSE);
|
SetMinMaxDimensions(window, SDL_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -1670,11 +1650,6 @@ void Wayland_SetWindowFullscreen(_THIS, SDL_Window *window,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the last fullscreen flags for future requests by the compositor. */
|
|
||||||
if (fullscreen) {
|
|
||||||
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. */
|
||||||
if (wind->is_fullscreen != fullscreen) {
|
if (wind->is_fullscreen != fullscreen) {
|
||||||
wind->is_fullscreen = fullscreen;
|
wind->is_fullscreen = fullscreen;
|
||||||
|
|
|
@ -116,7 +116,6 @@ struct SDL_WindowData
|
||||||
SDL_bool was_floating;
|
SDL_bool was_floating;
|
||||||
SDL_bool is_fullscreen;
|
SDL_bool is_fullscreen;
|
||||||
SDL_bool in_fullscreen_transition;
|
SDL_bool in_fullscreen_transition;
|
||||||
Uint32 fullscreen_flags;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void Wayland_ShowWindow(_THIS, SDL_Window *window);
|
extern void Wayland_ShowWindow(_THIS, SDL_Window *window);
|
||||||
|
|
|
@ -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) != 0 && (window_flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
|
if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) != 0 && (window_flags & SDL_WINDOW_FULLSCREEN) == 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;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static DWORD GetWindowStyle(SDL_Window *window)
|
||||||
{
|
{
|
||||||
DWORD style = 0;
|
DWORD style = 0;
|
||||||
|
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
style |= STYLE_FULLSCREEN;
|
style |= STYLE_FULLSCREEN;
|
||||||
} else {
|
} else {
|
||||||
if ((window->flags & SDL_WINDOW_BORDERLESS) != 0) {
|
if ((window->flags & SDL_WINDOW_BORDERLESS) != 0) {
|
||||||
|
@ -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_MASK) != 0) {
|
if (!fullscreen && (window->flags & SDL_WINDOW_FULLSCREEN) != 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.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -411,8 +411,8 @@ static int WINRT_AddDisplaysForAdapter(_THIS, IDXGIFactory2 *dxgiFactory2, int a
|
||||||
#if (NTDDI_VERSION >= NTDDI_WIN10) || (SDL_WINRT_USE_APPLICATIONVIEW && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
|
#if (NTDDI_VERSION >= NTDDI_WIN10) || (SDL_WINRT_USE_APPLICATIONVIEW && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
|
||||||
mode.pixel_w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width);
|
mode.pixel_w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width);
|
||||||
mode.pixel_h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height);
|
mode.pixel_h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height);
|
||||||
mode.screen_w = appView->VisibleBounds.Width;
|
mode.screen_w = (int)SDL_floorf(appView->VisibleBounds.Width);
|
||||||
mode.screen_h = appView->VisibleBounds.Height;
|
mode.screen_h = (int)SDL_floorf(appView->VisibleBounds.Height);
|
||||||
mode.display_scale = WINRT_DISPLAY_PROPERTY(LogicalDpi) / 96.0f;
|
mode.display_scale = WINRT_DISPLAY_PROPERTY(LogicalDpi) / 96.0f;
|
||||||
#else
|
#else
|
||||||
/* On platform(s) that do not support VisibleBounds, such as Windows 8.1,
|
/* On platform(s) that do not support VisibleBounds, such as Windows 8.1,
|
||||||
|
@ -420,8 +420,8 @@ static int WINRT_AddDisplaysForAdapter(_THIS, IDXGIFactory2 *dxgiFactory2, int a
|
||||||
*/
|
*/
|
||||||
mode.pixel_w = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Width);
|
mode.pixel_w = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Width);
|
||||||
mode.pixel_h = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Height);
|
mode.pixel_h = WINRT_DIPS_TO_PHYSICAL_PIXELS(coreWin->Bounds.Height);
|
||||||
mode.screen_w = coreWin->Bounds.Width;
|
mode.screen_w = (int)SDL_floorf(coreWin->Bounds.Width);
|
||||||
mode.screen_h = coreWin->Bounds.Height;
|
mode.screen_h = (int)SDL_floorf(coreWin->Bounds.Height);
|
||||||
mode.display_scale = WINRT_DISPLAY_PROPERTY(LogicalDpi) / 96.0f;
|
mode.display_scale = WINRT_DISPLAY_PROPERTY(LogicalDpi) / 96.0f;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ void WINRT_VideoQuit(_THIS)
|
||||||
WINRT_QuitMouse(_this);
|
WINRT_QuitMouse(_this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Uint32 WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN_MASK | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS;
|
static const Uint32 WINRT_DetectableFlags = SDL_WINDOW_MAXIMIZED | SDL_WINDOW_FULLSCREEN | SDL_WINDOW_HIDDEN | SDL_WINDOW_MOUSE_FOCUS;
|
||||||
|
|
||||||
extern "C" Uint32
|
extern "C" Uint32
|
||||||
WINRT_DetectWindowFlags(SDL_Window *window)
|
WINRT_DetectWindowFlags(SDL_Window *window)
|
||||||
|
@ -532,7 +532,7 @@ WINRT_DetectWindowFlags(SDL_Window *window)
|
||||||
if (display->desktop_mode.pixel_w != w || display->desktop_mode.pixel_h != h) {
|
if (display->desktop_mode.pixel_w != w || display->desktop_mode.pixel_h != h) {
|
||||||
latestFlags |= SDL_WINDOW_MAXIMIZED;
|
latestFlags |= SDL_WINDOW_MAXIMIZED;
|
||||||
} else {
|
} else {
|
||||||
latestFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
latestFlags |= SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,9 +561,6 @@ 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_MASK) != 0) {
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,8 +706,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_MASK) == 0) {
|
if ((requestedFlags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
const Windows::Foundation::Size size(window->w, window->h);
|
const Windows::Foundation::Size size((float)window->w, (float)window->h);
|
||||||
didSetSize = data->appView->TryResizeView(size);
|
didSetSize = data->appView->TryResizeView(size);
|
||||||
}
|
}
|
||||||
if (!didSetSize) {
|
if (!didSetSize) {
|
||||||
|
@ -747,7 +744,7 @@ void WINRT_SetWindowSize(_THIS, SDL_Window *window)
|
||||||
{
|
{
|
||||||
#if NTDDI_VERSION >= NTDDI_WIN10
|
#if NTDDI_VERSION >= NTDDI_WIN10
|
||||||
SDL_WindowData *data = window->driverdata;
|
SDL_WindowData *data = window->driverdata;
|
||||||
const Windows::Foundation::Size size(window->w, window->h);
|
const Windows::Foundation::Size size((float)window->w, (float)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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_MASK) == 0) {
|
if ((data->window->flags & SDL_WINDOW_FULLSCREEN) == 0) {
|
||||||
X11_SetWindowKeyboardGrab(_this, data->window, SDL_FALSE);
|
X11_SetWindowKeyboardGrab(_this, data->window, SDL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1464,7 +1464,7 @@ 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 | SDL_WINDOW_FULLSCREEN_MASK)) != 0) {
|
if ((changed & (SDL_WINDOW_HIDDEN | SDL_WINDOW_FULLSCREEN)) != 0) {
|
||||||
if ((flags & SDL_WINDOW_HIDDEN) != 0) {
|
if ((flags & SDL_WINDOW_HIDDEN) != 0) {
|
||||||
X11_DispatchUnmapNotify(data);
|
X11_DispatchUnmapNotify(data);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -152,7 +152,7 @@ void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags)
|
||||||
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_MASK) != 0) {
|
if ((flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
atoms[count++] = _NET_WM_STATE_FULLSCREEN;
|
atoms[count++] = _NET_WM_STATE_FULLSCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,12 +207,12 @@ X11_GetNetWMState(_THIS, SDL_Window *window, Window xwindow)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullscreen == 1) {
|
if (fullscreen == 1) {
|
||||||
if ((window->flags & SDL_WINDOW_FULLSCREEN_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 0) {
|
||||||
/* Pick whatever state the window expects */
|
/* Pick whatever state the window expects */
|
||||||
flags |= (window->flags & SDL_WINDOW_FULLSCREEN_MASK);
|
flags |= (window->flags & SDL_WINDOW_FULLSCREEN);
|
||||||
} else {
|
} else {
|
||||||
/* Assume we're fullscreen desktop */
|
/* Assume we're fullscreen desktop */
|
||||||
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1234,7 +1234,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_MASK) != 0) {
|
if ((window->flags & SDL_WINDOW_FULLSCREEN) != 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.
|
||||||
|
@ -1414,11 +1414,9 @@ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window *window, SDL_VideoDis
|
||||||
|
|
||||||
flags = window->flags;
|
flags = window->flags;
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
if ((flags & SDL_WINDOW_FULLSCREEN_MASK) == 0) {
|
flags |= SDL_WINDOW_FULLSCREEN;
|
||||||
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
flags &= ~SDL_WINDOW_FULLSCREEN_MASK;
|
flags &= ~SDL_WINDOW_FULLSCREEN;
|
||||||
}
|
}
|
||||||
X11_SetNetWMState(_this, data->xwindow, flags);
|
X11_SetNetWMState(_this, data->xwindow, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,16 +249,11 @@ int video_createWindowVariousFlags(void *arg)
|
||||||
w = SDLTest_RandomIntegerInRange(320, 1024);
|
w = SDLTest_RandomIntegerInRange(320, 1024);
|
||||||
h = SDLTest_RandomIntegerInRange(320, 768);
|
h = SDLTest_RandomIntegerInRange(320, 768);
|
||||||
|
|
||||||
for (fVariation = 0; fVariation < 14; fVariation++) {
|
for (fVariation = 1; fVariation < 14; fVariation++) {
|
||||||
switch (fVariation) {
|
switch (fVariation) {
|
||||||
default:
|
default:
|
||||||
case 0:
|
|
||||||
flags = SDL_WINDOW_FULLSCREEN_EXCLUSIVE;
|
|
||||||
/* Skip - blanks screen; comment out next line to run test */
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
flags = SDL_WINDOW_FULLSCREEN_DESKTOP;
|
flags = SDL_WINDOW_FULLSCREEN;
|
||||||
/* Skip - blanks screen; comment out next line to run test */
|
/* Skip - blanks screen; comment out next line to run test */
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
|
@ -1630,7 +1625,7 @@ cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Tests the functionality of the SDL_WINDOWPOS_CENTERED_DISPLAY along with SDL_WINDOW_FULLSCREEN_DESKTOP.
|
* @brief Tests the functionality of the SDL_WINDOWPOS_CENTERED_DISPLAY along with SDL_WINDOW_FULLSCREEN.
|
||||||
*
|
*
|
||||||
* Espeically useful when run on a multi-monitor system with different DPI scales per monitor,
|
* Espeically useful when run on a multi-monitor system with different DPI scales per monitor,
|
||||||
* to test that the window size is maintained when moving between monitors.
|
* to test that the window size is maintained when moving between monitors.
|
||||||
|
|
|
@ -95,7 +95,7 @@ int main(int argc, char **argv)
|
||||||
SDL_bool done = SDL_FALSE;
|
SDL_bool done = SDL_FALSE;
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
SDL_CreateWindow("Sensor Test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);
|
SDL_CreateWindow("Sensor Test", 0, 0, 0, 0, SDL_WINDOW_FULLSCREEN);
|
||||||
while (!done) {
|
while (!done) {
|
||||||
/* Update to get the current event state */
|
/* Update to get the current event state */
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
|
@ -87,7 +87,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_EXCLUSIVE", sizeof text);
|
SDL_strlcpy(text, "Press Ctrl+Enter to toggle SDL_WINDOW_FULLSCREEN", 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;
|
||||||
|
|
Loading…
Reference in New Issue