fix(Metal): Fix invalid selector

Removed selector logic and wrapped in HAVE_METAL, given this is only
called when Metal is enabled.
This commit is contained in:
Stuart Carnie 2018-09-02 12:51:34 -07:00
parent 611e484633
commit f1ad1ff444

View File

@ -361,19 +361,16 @@ static char** waiting_argv;
return [NSApp isActive]; return [NSApp isActive];
} }
#define NS_FULLSCREEN_WINDOW_MASK (1 << 14)
- (void)setVideoMode:(gfx_ctx_mode_t)mode { - (void)setVideoMode:(gfx_ctx_mode_t)mode {
BOOL isFullScreen = (self.window.styleMask & NS_FULLSCREEN_WINDOW_MASK) == NS_FULLSCREEN_WINDOW_MASK; #ifdef HAVE_METAL
SEL fselector = NSSelectorFromString(BOXSTRING("toggleFullScreen")); BOOL isFullScreen = (self.window.styleMask & NSFullScreenWindowMask) == NSFullScreenWindowMask;
if (mode.fullscreen && !isFullScreen)
if (mode.fullscreen && !isFullScreen && [self.window respondsToSelector:fselector])
{ {
[self.window toggleFullScreen:self]; [self.window toggleFullScreen:self];
return; return;
} }
if (!mode.fullscreen && isFullScreen && [self.window respondsToSelector:fselector]) if (!mode.fullscreen && isFullScreen)
{ {
[self.window toggleFullScreen:self]; [self.window toggleFullScreen:self];
} }
@ -384,6 +381,7 @@ static char** waiting_argv;
[self.window setContentSize:NSMakeSize(mode.width-1, mode.height)]; [self.window setContentSize:NSMakeSize(mode.width-1, mode.height)];
} }
[self.window setContentSize:NSMakeSize(mode.width, mode.height)]; [self.window setContentSize:NSMakeSize(mode.width, mode.height)];
#endif
} }
- (void)setCursorVisible:(bool)v { - (void)setCursorVisible:(bool)v {