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