Fix zombie windows in Mac OS when switching to/from fullscreen

This commit is contained in:
jqdg 2021-08-08 23:00:51 -07:00 committed by Lukas Dürrenberger
parent 7ff34cdc86
commit 86617c0550
3 changed files with 24 additions and 1 deletions

View File

@ -57,6 +57,18 @@
////////////////////////////////////////////////////////////
-(BOOL)canBecomeKeyWindow;
////////////////////////////////////////////////////////////
/// \brief Allow fullscreen windows to become the main window
///
/// By default, fullscreen windows (using NSBorderlessWindowMask)
/// cannot become the main window, so this method is changed to
/// always return YES.
///
/// \return YES
///
////////////////////////////////////////////////////////////
-(BOOL)canBecomeMainWindow;
////////////////////////////////////////////////////////////
/// \brief Prevent system alert
///

View File

@ -45,6 +45,13 @@
}
////////////////////////////////////////////////////////
-(BOOL)canBecomeMainWindow
{
return YES;
}
////////////////////////////////////////////////////////
-(void)keyDown:(NSEvent*)theEvent
{

View File

@ -154,7 +154,11 @@ WindowImplCocoa::~WindowImplCocoa()
// Put the next window in front, if any.
NSArray* windows = [NSApp orderedWindows];
if ([windows count] > 0)
[[windows objectAtIndex:0] makeKeyAndOrderFront:nil];
{
NSWindow *nextWindow = [windows objectAtIndex:0];
if ([nextWindow isVisible])
[nextWindow makeKeyAndOrderFront:nil];
}
drainThreadPool(); // Make sure everything was freed
// This solve some issue when sf::Window::Create is called for the