mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
WinRT: Fixed bug 3210, "alt-tab doesn't work correctly with full-screened, UWP (Win10 Store) apps"
This commit is contained in:
parent
8ddcc63ac7
commit
8281cc72ba
@ -505,6 +505,32 @@ WINRT_UpdateWindowFlags(SDL_Window * window, Uint32 mask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
WINRT_IsCoreWindowActive(CoreWindow ^ coreWindow)
|
||||||
|
{
|
||||||
|
/* WinRT does not appear to offer API(s) to determine window-activation state,
|
||||||
|
at least not that I am aware of in Win8 - Win10. As such, SDL tracks this
|
||||||
|
itself, via window-activation events.
|
||||||
|
|
||||||
|
If there *is* an API to track this, it should probably get used instead
|
||||||
|
of the following hack (that uses "SDLHelperWindowActivationState").
|
||||||
|
-- DavidL.
|
||||||
|
*/
|
||||||
|
if (coreWindow->CustomProperties->HasKey("SDLHelperWindowActivationState")) {
|
||||||
|
CoreWindowActivationState activationState = \
|
||||||
|
safe_cast<CoreWindowActivationState>(coreWindow->CustomProperties->Lookup("SDLHelperWindowActivationState"));
|
||||||
|
return (activationState != CoreWindowActivationState::Deactivated);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Assume that non-SDL tracked windows are active, although this should
|
||||||
|
probably be avoided, if possible.
|
||||||
|
|
||||||
|
This might not even be possible, in normal SDL use, at least as of
|
||||||
|
this writing (Dec 22, 2015; via latest hg.libsdl.org/SDL clone) -- DavidL
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
WINRT_CreateWindow(_THIS, SDL_Window * window)
|
WINRT_CreateWindow(_THIS, SDL_Window * window)
|
||||||
{
|
{
|
||||||
@ -645,12 +671,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* Try detecting if the window is active */
|
/* Try detecting if the window is active */
|
||||||
bool isWindowActive = true; /* Presume the window is active, unless we've been told otherwise */
|
bool isWindowActive = WINRT_IsCoreWindowActive(data->coreWindow.Get());
|
||||||
if (data->coreWindow->CustomProperties->HasKey("SDLHelperWindowActivationState")) {
|
|
||||||
CoreWindowActivationState activationState = \
|
|
||||||
safe_cast<CoreWindowActivationState>(data->coreWindow->CustomProperties->Lookup("SDLHelperWindowActivationState"));
|
|
||||||
isWindowActive = (activationState != CoreWindowActivationState::Deactivated);
|
|
||||||
}
|
|
||||||
if (isWindowActive) {
|
if (isWindowActive) {
|
||||||
SDL_SetKeyboardFocus(window);
|
SDL_SetKeyboardFocus(window);
|
||||||
}
|
}
|
||||||
@ -681,13 +702,16 @@ WINRT_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
|||||||
{
|
{
|
||||||
#if NTDDI_VERSION >= NTDDI_WIN10
|
#if NTDDI_VERSION >= NTDDI_WIN10
|
||||||
SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
|
SDL_WindowData * data = (SDL_WindowData *)window->driverdata;
|
||||||
if (fullscreen) {
|
bool isWindowActive = WINRT_IsCoreWindowActive(data->coreWindow.Get());
|
||||||
if (!data->appView->IsFullScreenMode) {
|
if (isWindowActive) {
|
||||||
data->appView->TryEnterFullScreenMode(); // TODO, WinRT: return failure (to caller?) from TryEnterFullScreenMode()
|
if (fullscreen) {
|
||||||
}
|
if (!data->appView->IsFullScreenMode) {
|
||||||
} else {
|
data->appView->TryEnterFullScreenMode(); // TODO, WinRT: return failure (to caller?) from TryEnterFullScreenMode()
|
||||||
if (data->appView->IsFullScreenMode) {
|
}
|
||||||
data->appView->ExitFullScreenMode();
|
} else {
|
||||||
|
if (data->appView->IsFullScreenMode) {
|
||||||
|
data->appView->ExitFullScreenMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user