mirror of
https://github.com/love2d/megasource.git
synced 2026-08-19 04:05:09 +02:00
Update SDL2 to the latest hg revision of 2.0.4.
This commit is contained in:
@@ -1125,6 +1125,10 @@ SDL_RestoreMousePosition(SDL_Window *window)
|
||||
}
|
||||
}
|
||||
|
||||
#if __WINRT__
|
||||
extern Uint32 WINRT_DetectWindowFlags(SDL_Window * window);
|
||||
#endif
|
||||
|
||||
static int
|
||||
SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||
{
|
||||
@@ -1136,12 +1140,58 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||
/* if we are in the process of hiding don't go back to fullscreen */
|
||||
if ( window->is_hiding && fullscreen )
|
||||
return 0;
|
||||
|
||||
|
||||
#ifdef __MACOSX__
|
||||
/* if the window is going away and no resolution change is necessary,
|
||||
do nothing, or else we may trigger an ugly double-transition
|
||||
*/
|
||||
if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)
|
||||
return 0;
|
||||
|
||||
/* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */
|
||||
if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) {
|
||||
if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) {
|
||||
return -1;
|
||||
}
|
||||
} else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) {
|
||||
display = SDL_GetDisplayForWindow(window);
|
||||
SDL_SetDisplayModeForDisplay(display, NULL);
|
||||
if (_this->SetWindowFullscreen) {
|
||||
_this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) {
|
||||
if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) {
|
||||
return -1;
|
||||
}
|
||||
window->last_fullscreen_flags = window->flags;
|
||||
return 0;
|
||||
}
|
||||
#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
|
||||
/* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
|
||||
or not. The user can choose this, via OS-provided UI, but this can't
|
||||
be set programmatically.
|
||||
|
||||
Just look at what SDL's WinRT video backend code detected with regards
|
||||
to fullscreen (being active, or not), and figure out a return/error code
|
||||
from that.
|
||||
*/
|
||||
if (fullscreen == !(WINRT_DetectWindowFlags(window) & FULLSCREEN_MASK)) {
|
||||
/* Uh oh, either:
|
||||
1. fullscreen was requested, and we're already windowed
|
||||
2. windowed-mode was requested, and we're already fullscreen
|
||||
|
||||
WinRT 8.x can't resolve either programmatically, so we're
|
||||
giving up.
|
||||
*/
|
||||
return -1;
|
||||
} else {
|
||||
/* Whatever was requested, fullscreen or windowed mode, is already
|
||||
in-place.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
display = SDL_GetDisplayForWindow(window);
|
||||
@@ -1355,6 +1405,18 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10)
|
||||
/* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen
|
||||
or not. The user can choose this, via OS-provided UI, but this can't
|
||||
be set programmatically.
|
||||
|
||||
Just look at what SDL's WinRT video backend code detected with regards
|
||||
to fullscreen (being active, or not), and figure out a return/error code
|
||||
from that.
|
||||
*/
|
||||
flags = window->flags;
|
||||
#endif
|
||||
|
||||
if (title) {
|
||||
SDL_SetWindowTitle(window, title);
|
||||
}
|
||||
@@ -1964,6 +2026,7 @@ SDL_RestoreWindow(SDL_Window * window)
|
||||
int
|
||||
SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
|
||||
{
|
||||
Uint32 oldflags;
|
||||
CHECK_WINDOW_MAGIC(window, -1);
|
||||
|
||||
flags &= FULLSCREEN_MASK;
|
||||
@@ -1973,10 +2036,17 @@ SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
|
||||
}
|
||||
|
||||
/* clear the previous flags and OR in the new ones */
|
||||
oldflags = window->flags & FULLSCREEN_MASK;
|
||||
window->flags &= ~FULLSCREEN_MASK;
|
||||
window->flags |= flags;
|
||||
|
||||
return SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window));
|
||||
if (SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
window->flags &= ~FULLSCREEN_MASK;
|
||||
window->flags |= oldflags;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static SDL_Surface *
|
||||
|
||||
Reference in New Issue
Block a user