mirror of https://github.com/encounter/SDL.git
Allow switching between FS and desktop FS.
This should fix bug #2057 (https://bugzilla.libsdl.org/show_bug.cgi?id=2057)
This commit is contained in:
parent
a442f121e6
commit
a0c9e649f5
|
@ -79,6 +79,7 @@ struct SDL_Window
|
||||||
int min_w, min_h;
|
int min_w, min_h;
|
||||||
int max_w, max_h;
|
int max_w, max_h;
|
||||||
Uint32 flags;
|
Uint32 flags;
|
||||||
|
Uint32 last_fullscreen_flags;
|
||||||
|
|
||||||
/* Stored position and size for windowed mode */
|
/* Stored position and size for windowed mode */
|
||||||
SDL_Rect windowed;
|
SDL_Rect windowed;
|
||||||
|
|
|
@ -115,6 +115,7 @@ static SDL_VideoDevice *_this = NULL;
|
||||||
return retval; \
|
return retval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN )
|
||||||
|
|
||||||
#ifdef __MACOSX__
|
#ifdef __MACOSX__
|
||||||
/* Support for Mac OS X fullscreen spaces */
|
/* Support for Mac OS X fullscreen spaces */
|
||||||
|
@ -1096,6 +1097,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||||
|
|
||||||
#ifdef __MACOSX__
|
#ifdef __MACOSX__
|
||||||
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
|
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
|
||||||
|
window->last_fullscreen_flags = window->flags;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1112,7 +1114,9 @@ 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) {
|
||||||
return;
|
if ((window->last_fullscreen_flags & FULLSCREEN_MASK) == (window->flags & FULLSCREEN_MASK)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if there are any fullscreen windows */
|
/* See if there are any fullscreen windows */
|
||||||
|
@ -1157,6 +1161,8 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_RestoreMousePosition(other);
|
SDL_RestoreMousePosition(other);
|
||||||
|
|
||||||
|
window->last_fullscreen_flags = window->flags;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1175,6 +1181,8 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||||
|
|
||||||
/* Restore the cursor position */
|
/* Restore the cursor position */
|
||||||
SDL_RestoreMousePosition(window);
|
SDL_RestoreMousePosition(window);
|
||||||
|
|
||||||
|
window->last_fullscreen_flags = window->flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CREATE_FLAGS \
|
#define CREATE_FLAGS \
|
||||||
|
@ -1277,6 +1285,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, 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->brightness = 1.0f;
|
window->brightness = 1.0f;
|
||||||
window->next = _this->windows;
|
window->next = _this->windows;
|
||||||
|
|
||||||
|
@ -1318,6 +1327,7 @@ 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 = SDL_WINDOW_FOREIGN;
|
window->flags = SDL_WINDOW_FOREIGN;
|
||||||
|
window->last_fullscreen_flags = window->flags;
|
||||||
window->brightness = 1.0f;
|
window->brightness = 1.0f;
|
||||||
window->next = _this->windows;
|
window->next = _this->windows;
|
||||||
if (_this->windows) {
|
if (_this->windows) {
|
||||||
|
@ -1378,6 +1388,7 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||||
window->title = NULL;
|
window->title = NULL;
|
||||||
window->icon = NULL;
|
window->icon = NULL;
|
||||||
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
|
||||||
|
window->last_fullscreen_flags = window->flags;
|
||||||
|
|
||||||
if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) {
|
||||||
if (_this->CreateWindow(_this, window) < 0) {
|
if (_this->CreateWindow(_this, window) < 0) {
|
||||||
|
@ -1857,7 +1868,6 @@ SDL_RestoreWindow(SDL_Window * window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FULLSCREEN_MASK ( SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN )
|
|
||||||
int
|
int
|
||||||
SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
|
SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue