mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-27 14:22:13 +00:00
Extended NSWindow with ability to exit application upon closing by user
This commit is contained in:
parent
3676a42512
commit
15a269db9d
2 changed files with 18 additions and 4 deletions
|
@ -62,6 +62,11 @@ extern RenderBufferOptions rbOpts;
|
||||||
#define AppKit10_7 1138
|
#define AppKit10_7 1138
|
||||||
|
|
||||||
|
|
||||||
|
@interface NSWindow(ExitAppOnClose)
|
||||||
|
- (void)exitAppOnClose;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
inline bool I_IsHiDPISupported()
|
inline bool I_IsHiDPISupported()
|
||||||
{
|
{
|
||||||
return NSAppKitVersionNumber >= AppKit10_7;
|
return NSAppKitVersionNumber >= AppKit10_7;
|
||||||
|
|
|
@ -58,6 +58,18 @@
|
||||||
#undef Class
|
#undef Class
|
||||||
|
|
||||||
|
|
||||||
|
@implementation NSWindow(ExitAppOnClose)
|
||||||
|
|
||||||
|
- (void)exitAppOnClose
|
||||||
|
{
|
||||||
|
NSButton* closeButton = [self standardWindowButton:NSWindowCloseButton];
|
||||||
|
[closeButton setAction:@selector(terminate:)];
|
||||||
|
[closeButton setTarget:NSApp];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
EXTERN_CVAR(Bool, ticker )
|
EXTERN_CVAR(Bool, ticker )
|
||||||
EXTERN_CVAR(Bool, vid_vsync)
|
EXTERN_CVAR(Bool, vid_vsync)
|
||||||
EXTERN_CVAR(Bool, vid_hidpi)
|
EXTERN_CVAR(Bool, vid_hidpi)
|
||||||
|
@ -659,10 +671,7 @@ void CocoaVideo::SetWindowedMode(const int width, const int height)
|
||||||
|
|
||||||
[m_window setContentSize:windowSize];
|
[m_window setContentSize:windowSize];
|
||||||
[m_window center];
|
[m_window center];
|
||||||
|
[m_window exitAppOnClose];
|
||||||
NSButton* closeButton = [m_window standardWindowButton:NSWindowCloseButton];
|
|
||||||
[closeButton setAction:@selector(terminate:)];
|
|
||||||
[closeButton setTarget:NSApp];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CocoaVideo::SetMode(const int width, const int height, const bool fullscreen, const bool hiDPI)
|
void CocoaVideo::SetMode(const int width, const int height, const bool fullscreen, const bool hiDPI)
|
||||||
|
|
Loading…
Reference in a new issue