Fix alt-tabbing out of full screen on Windows. (#5288)
Signed-off-by: bosnichd <bosnichd@amazon.com>
This commit is contained in:
+23
@@ -54,6 +54,7 @@ namespace AzFramework
|
||||
RECT m_windowRectToRestoreOnFullScreenExit; //!< The position and size of the window to restore when exiting full screen.
|
||||
UINT m_windowStyleToRestoreOnFullScreenExit; //!< The style(s) of the window to restore when exiting full screen.
|
||||
bool m_isInBorderlessWindowFullScreenState = false; //!< Was a borderless window used to enter full screen state?
|
||||
bool m_shouldEnterFullScreenStateOnActivate = false; //!< Should we enter full screen state when the window is activated?
|
||||
|
||||
using GetDpiForWindowType = UINT(HWND hwnd);
|
||||
GetDpiForWindowType* m_getDpiFunction = nullptr;
|
||||
@@ -249,6 +250,28 @@ namespace AzFramework
|
||||
AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputCodeUnitUTF16Event, codeUnitUTF16);
|
||||
break;
|
||||
}
|
||||
case WM_ACTIVATE:
|
||||
{
|
||||
// Alt-tabbing out of the app while it is in a full screen state does not
|
||||
// work unless we explicitly exit the full screen state upon deactivation,
|
||||
// in which case we want to enter full screen state again upon activation.
|
||||
const bool windowIsNowInactive = (LOWORD(wParam) == WA_INACTIVE);
|
||||
const bool windowFullScreenState = nativeWindowImpl->GetFullScreenState();
|
||||
if (windowIsNowInactive &&
|
||||
windowFullScreenState)
|
||||
{
|
||||
nativeWindowImpl->m_shouldEnterFullScreenStateOnActivate = true;
|
||||
nativeWindowImpl->SetFullScreenState(false);
|
||||
}
|
||||
else if (!windowIsNowInactive &&
|
||||
!windowFullScreenState &&
|
||||
nativeWindowImpl->m_shouldEnterFullScreenStateOnActivate)
|
||||
{
|
||||
nativeWindowImpl->m_shouldEnterFullScreenStateOnActivate = false;
|
||||
nativeWindowImpl->SetFullScreenState(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_SYSKEYDOWN:
|
||||
{
|
||||
// Handle ALT+ENTER to toggle full screen unless exclsuive full screen
|
||||
|
||||
Reference in New Issue
Block a user