mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-23 22:58:57 +00:00
WinRT: lots of display and windowing related fixes
This change-set fixes a lot of windowing related bugs, especially with regards to Windows 8.x apps running on Windows 10 (which was the driver for this work). The primary fixes include: * listed display modes were wrong, especially when launching apps into a non-fullscreen space * reported window flags were often wrong, especially on Windows 10 * fullscreen/windowed mode switches weren't failing (they are not programmatically possible in Win 8.x apps).
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)
|
||||
{
|
||||
@@ -1164,6 +1168,30 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
||||
window->last_fullscreen_flags = window->flags;
|
||||
return 0;
|
||||
}
|
||||
#elif __WINRT__
|
||||
/* 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);
|
||||
@@ -1377,6 +1405,18 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if __WINRT__
|
||||
/* 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user