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

Fixed #1091 by reverting 7f0f89 #1180

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 0 additions & 20 deletions src/SFML/Window/OSX/SFWindow.h
Expand Up @@ -65,26 +65,6 @@
////////////////////////////////////////////////////////////
-(void)keyDown:(NSEvent*)theEvent;

////////////////////////////////////////////////////////////
/// \brief This action method simulates the user clicking the close button
///
/// Override NSWindow implementation, see implementation for details
///
/// \param sender The message's sender
///
////////////////////////////////////////////////////////////
-(void)performClose:(id)sender;

////////////////////////////////////////////////////////////
/// \brief Enabling or disabling a specific menu item
///
/// \param menuItem An NSMenuItem object that represents the menu item
///
/// \return YES to enable menuItem, NO to disable it.
///
////////////////////////////////////////////////////////////
-(BOOL)validateMenuItem:(NSMenuItem*)menuItem;

@end


Expand Down
39 changes: 0 additions & 39 deletions src/SFML/Window/OSX/SFWindow.m
Expand Up @@ -58,45 +58,6 @@ -(void)keyDown:(NSEvent*)theEvent
(void)theEvent;
}


////////////////////////////////////////////////////////
-(void)performClose:(id)sender
{
// From Apple documentation:
//
// > If the window's delegate or the window itself implements windowShouldClose:,
// > that message is sent with the window as the argument. (Only one such message is sent;
// > if both the delegate and the NSWindow object implement the method, only the delegate
// > receives the message.) If the windowShouldClose: method returns NO, the window isn't
// > closed. If it returns YES, or if it isn't implemented, performClose: invokes the
// > close method to close the window.
// >
// > If the window doesn't have a close button or can't be closed (for example, if the
// > delegate replies NO to a windowShouldClose: message), the system emits the alert sound.
//
// The last paragraph is problematic for SFML fullscreen window since they don't have
// a close button (style is NSBorderlessWindowMask). So we reimplement this function.

BOOL shouldClose = NO;

if ([self delegate] && [[self delegate] respondsToSelector:@selector(windowShouldClose:)])
shouldClose = [[self delegate] windowShouldClose:sender];
// else if ([self respondsToSelector:@selector(windowShouldClose:)])
// shouldClose = [self windowShouldClose:sender];
// error: no visible @interface for 'SFWindow' declares the selector 'windowShouldClose:'

if (shouldClose)
[self close];
}


////////////////////////////////////////////////////////
-(BOOL)validateMenuItem:(NSMenuItem*)menuItem
{
return [menuItem action] == @selector(performClose:);
}


@end


Expand Down