mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-11 05:01:09 +00:00
- added native fullscreen mode option to Cocoa backend (#1154)
This commit is contained in:
parent
b6f0c4071d
commit
86cf5c9e53
1 changed files with 12 additions and 3 deletions
|
@ -102,6 +102,7 @@ EXTERN_CVAR(Int, vid_preferbackend)
|
||||||
EXTERN_CVAR(Bool, vk_debug)
|
EXTERN_CVAR(Bool, vk_debug)
|
||||||
|
|
||||||
CVAR(Bool, mvk_debug, false, 0)
|
CVAR(Bool, mvk_debug, false, 0)
|
||||||
|
CVAR(Bool, vid_nativefullscreen, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
CUSTOM_CVAR(Bool, vid_autoswitch, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
|
||||||
{
|
{
|
||||||
|
@ -290,6 +291,7 @@ CocoaWindow* CreateWindow(const NSUInteger styleMask)
|
||||||
[window setOpaque:YES];
|
[window setOpaque:YES];
|
||||||
[window makeFirstResponder:appCtrl];
|
[window makeFirstResponder:appCtrl];
|
||||||
[window setAcceptsMouseMovedEvents:YES];
|
[window setAcceptsMouseMovedEvents:YES];
|
||||||
|
[window exitAppOnClose];
|
||||||
|
|
||||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||||
[nc addObserver:window
|
[nc addObserver:window
|
||||||
|
@ -633,7 +635,6 @@ void SystemBaseFrameBuffer::SetWindowedMode()
|
||||||
const NSRect frameSize = NSMakeRect(win_x, win_y, win_w, win_h);
|
const NSRect frameSize = NSMakeRect(win_x, win_y, win_w, win_h);
|
||||||
[m_window setFrame:frameSize display:YES];
|
[m_window setFrame:frameSize display:YES];
|
||||||
[m_window enterFullscreenOnZoom];
|
[m_window enterFullscreenOnZoom];
|
||||||
[m_window exitAppOnClose];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemBaseFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
|
void SystemBaseFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
|
||||||
|
@ -650,7 +651,11 @@ void SystemBaseFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
|
||||||
[m_window.contentView layer].contentsScale = hiDPI ? m_window.screen.backingScaleFactor : 1.0;
|
[m_window.contentView layer].contentsScale = hiDPI ? m_window.screen.backingScaleFactor : 1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fullscreen)
|
if (vid_nativefullscreen && fullscreen != m_fullscreen)
|
||||||
|
{
|
||||||
|
[m_window toggleFullScreen:(nil)];
|
||||||
|
}
|
||||||
|
else if (fullscreen)
|
||||||
{
|
{
|
||||||
SetFullscreenMode();
|
SetFullscreenMode();
|
||||||
}
|
}
|
||||||
|
@ -742,7 +747,11 @@ void SystemGLFrameBuffer::SetMode(const bool fullscreen, const bool hiDPI)
|
||||||
NSOpenGLView* const glView = [m_window contentView];
|
NSOpenGLView* const glView = [m_window contentView];
|
||||||
[glView setWantsBestResolutionOpenGLSurface:hiDPI];
|
[glView setWantsBestResolutionOpenGLSurface:hiDPI];
|
||||||
|
|
||||||
if (fullscreen)
|
if (vid_nativefullscreen && fullscreen != m_fullscreen)
|
||||||
|
{
|
||||||
|
[m_window toggleFullScreen:(nil)];
|
||||||
|
}
|
||||||
|
else if (fullscreen)
|
||||||
{
|
{
|
||||||
SetFullscreenMode();
|
SetFullscreenMode();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue