mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-14 13:56:00 +00:00
cocoa: Restore fullscreen state on the window regaining key status
Ensure that fullscreen state is restored if a non-minimized fullscreen window regains key status. This can happen if a fullscreen window was requested to minimize on loss of key status, but the minimization didn't actually occur.
This commit is contained in:
@@ -1203,6 +1203,14 @@ static NSCursor *Cocoa_GetDesiredCursor(void)
|
||||
_data.videodata.modifierFlags = (_data.videodata.modifierFlags & ~NSEventModifierFlagCapsLock) | newflags;
|
||||
SDL_ToggleModState(SDL_KMOD_CAPS, newflags ? true : false);
|
||||
}
|
||||
|
||||
/* Restore fullscreen mode unless the window is deminiaturizing.
|
||||
* If it is, fullscreen will be restored when deminiaturization is complete.
|
||||
*/
|
||||
if (!(window->flags & SDL_WINDOW_MINIMIZED) &&
|
||||
[self windowOperationIsPending:PENDING_OPERATION_ENTER_FULLSCREEN]) {
|
||||
SDL_UpdateFullscreenMode(window, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:(NSNotification *)aNotification
|
||||
@@ -2733,6 +2741,8 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo
|
||||
NSWindow *nswindow = data.nswindow;
|
||||
NSRect rect;
|
||||
|
||||
[data.listener clearPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN];
|
||||
|
||||
// The view responder chain gets messed with during setStyleMask
|
||||
if ([data.sdlContentView nextResponder] == data.listener) {
|
||||
[data.sdlContentView setNextResponder:nil];
|
||||
@@ -2841,6 +2851,7 @@ SDL_FullscreenResult Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Windo
|
||||
if (!fullscreen && [data.listener windowOperationIsPending:PENDING_OPERATION_MINIMIZE]) {
|
||||
Cocoa_WaitForMiniaturizable(window);
|
||||
[data.listener addPendingWindowOperation:PENDING_OPERATION_ENTER_FULLSCREEN];
|
||||
[data.listener clearPendingWindowOperation:PENDING_OPERATION_MINIMIZE];
|
||||
[nswindow miniaturize:nil];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user