Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process Cocoa events after window close #1814

Merged
merged 2 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/SFML/Window/OSX/SFWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
7 changes: 7 additions & 0 deletions src/SFML/Window/OSX/SFWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ -(BOOL)canBecomeKeyWindow
}


////////////////////////////////////////////////////////
-(BOOL)canBecomeMainWindow
{
return YES;
}


////////////////////////////////////////////////////////
-(void)keyDown:(NSEvent*)theEvent
{
Expand Down
1 change: 1 addition & 0 deletions src/SFML/Window/OSX/SFWindowController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ -(void)closeWindow
[m_window close];
[m_window setDelegate:nil];
[self setRequesterTo:0];
[SFApplication processEvent];
}


Expand Down
6 changes: 5 additions & 1 deletion src/SFML/Window/OSX/WindowImplCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ void showMouseCursor()
// 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
Expand Down