From 4b5d7361cd9389f24506e562b563fcc3f5298783 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 15 Nov 2014 11:47:05 +0200 Subject: [PATCH] Fixed exiting when window is closed by clicking close button This happened on 10.6 and later when fullscreen mode was used before windowed --- src/cocoa/i_backend_cocoa.mm | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/cocoa/i_backend_cocoa.mm b/src/cocoa/i_backend_cocoa.mm index 39b6642e2..3d24fe8b5 100644 --- a/src/cocoa/i_backend_cocoa.mm +++ b/src/cocoa/i_backend_cocoa.mm @@ -1163,6 +1163,8 @@ static bool s_fullscreenNewAPI; // Hide window as nothing will be rendered at this point [m_window orderOut:nil]; + + I_ShutdownJoysticks(); } @@ -1187,10 +1189,6 @@ static bool s_fullscreenNewAPI; [window makeFirstResponder:self]; [window setAcceptsMouseMovedEvents:YES]; - NSButton* closeButton = [window standardWindowButton:NSWindowCloseButton]; - [closeButton setAction:@selector(closeWindow:)]; - [closeButton setTarget:self]; - return window; } @@ -1297,6 +1295,10 @@ static bool s_fullscreenNewAPI; [m_window setContentSize:windowSize]; [m_window center]; + + NSButton* closeButton = [m_window standardWindowButton:NSWindowCloseButton]; + [closeButton setAction:@selector(terminate:)]; + [closeButton setTarget:NSApp]; } - (void)changeVideoResolution:(bool)fullscreen width:(int)width height:(int)height useHiDPI:(bool)hiDPI @@ -1496,14 +1498,6 @@ static bool s_fullscreenNewAPI; m_window = tempWindow; } - -- (void)closeWindow:(id)sender -{ - I_ShutdownJoysticks(); - - [NSApp terminate:sender]; -} - @end