mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
feat(Metal): Full screen support
* I believe there is a race condition where the viewport is not set correctly on launch
This commit is contained in:
parent
01df2c5e88
commit
74e1f24e90
@ -77,7 +77,6 @@ static bool metal_frame(void *data, const void *frame,
|
||||
|
||||
static void metal_set_nonblock_state(void *data, bool non_block)
|
||||
{
|
||||
RARCH_LOG("[Metal]: set non block: %s\n", non_block ? "ON" : "OFF");
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
md.context.displaySyncEnabled = !non_block;
|
||||
}
|
||||
@ -87,6 +86,11 @@ static bool metal_alive(void *data)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool metal_has_windowed(void *data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool metal_focus(void *data)
|
||||
{
|
||||
return apple_platform.hasFocus;
|
||||
@ -129,7 +133,10 @@ static void metal_free(void *data)
|
||||
static void metal_set_viewport(void *data, unsigned viewport_width,
|
||||
unsigned viewport_height, bool force_full, bool allow_rotate)
|
||||
{
|
||||
//RARCH_LOG("[Metal]: set_viewport %dx%d\n", viewport_width, viewport_height);
|
||||
// RARCH_LOG("[Metal]: set_viewport size: %dx%d full: %s rotate: %s\n",
|
||||
// viewport_width, viewport_height,
|
||||
// force_full ? "YES" : "NO",
|
||||
// allow_rotate ? "YES" : "NO");
|
||||
}
|
||||
|
||||
static void metal_set_rotation(void *data, unsigned rotation)
|
||||
@ -174,6 +181,9 @@ static void metal_set_video_mode(void *data,
|
||||
unsigned width, unsigned height,
|
||||
bool fullscreen)
|
||||
{
|
||||
RARCH_LOG("[Metal]: set_video_mode res=%dx%d fullscreen=%s\n",
|
||||
width, height,
|
||||
fullscreen ? "YES" : "NO");
|
||||
MetalDriver *md = (__bridge MetalDriver *)data;
|
||||
gfx_ctx_mode_t mode = {
|
||||
.width = width,
|
||||
@ -397,6 +407,7 @@ video_driver_t video_metal = {
|
||||
.frame = metal_frame,
|
||||
.set_nonblock_state = metal_set_nonblock_state,
|
||||
.alive = metal_alive,
|
||||
.has_windowed = metal_has_windowed,
|
||||
.focus = metal_focus,
|
||||
.suppress_screensaver = metal_suppress_screensaver,
|
||||
.set_shader = metal_set_shader,
|
||||
|
@ -357,6 +357,21 @@
|
||||
05A8E23720A63CB40084ABDA /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
|
||||
05A8E23920A63CED0084ABDA /* IOSurface.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOSurface.framework; path = System/Library/Frameworks/IOSurface.framework; sourceTree = SDKROOT; };
|
||||
05A8E23B20A63CF50084ABDA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
|
||||
05B5F90D20ED6A03009C521F /* content.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = content.h; path = ../../content.h; sourceTree = "<group>"; };
|
||||
05B5F90E20ED6A03009C521F /* core_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core_type.h; path = ../../core_type.h; sourceTree = "<group>"; };
|
||||
05B5F90F20ED6A03009C521F /* command.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = command.c; path = ../../command.c; sourceTree = "<group>"; };
|
||||
05B5F91120ED6AAE009C521F /* retroarch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = retroarch.c; path = ../../retroarch.c; sourceTree = "<group>"; };
|
||||
05B5F91220ED6AAF009C521F /* retroarch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = retroarch.h; path = ../../retroarch.h; sourceTree = "<group>"; };
|
||||
05BF821420ED69D100D95B19 /* config.def.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = config.def.h; path = ../../config.def.h; sourceTree = "<group>"; };
|
||||
05BF821520ED69D100D95B19 /* core_impl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = core_impl.c; path = ../../core_impl.c; sourceTree = "<group>"; };
|
||||
05BF821620ED69D100D95B19 /* config.features.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = config.features.h; path = ../../config.features.h; sourceTree = "<group>"; };
|
||||
05BF821720ED69D100D95B19 /* command.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = command.h; path = ../../command.h; sourceTree = "<group>"; };
|
||||
05BF821820ED69D100D95B19 /* core_info.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = core_info.c; path = ../../core_info.c; sourceTree = "<group>"; };
|
||||
05BF821920ED69D100D95B19 /* core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../../core.h; sourceTree = "<group>"; };
|
||||
05BF821A20ED69D100D95B19 /* configuration.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = configuration.c; path = ../../configuration.c; sourceTree = "<group>"; };
|
||||
05BF821B20ED69D100D95B19 /* core_info.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = core_info.h; path = ../../core_info.h; sourceTree = "<group>"; };
|
||||
05BF821C20ED69D100D95B19 /* config.def.keybinds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = config.def.keybinds.h; path = ../../config.def.keybinds.h; sourceTree = "<group>"; };
|
||||
05BF821D20ED69D100D95B19 /* configuration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = configuration.h; path = ../../configuration.h; sourceTree = "<group>"; };
|
||||
05C5D53320E3DD0900654EE4 /* input_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = input_types.h; sourceTree = "<group>"; };
|
||||
05C5D53420E3DD0900654EE4 /* input_remote.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = input_remote.c; sourceTree = "<group>"; };
|
||||
05C5D53720E3DD0900654EE4 /* nullinput.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nullinput.c; sourceTree = "<group>"; };
|
||||
@ -542,6 +557,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0538874F20DE117B00769232 /* libretro-common */,
|
||||
05BF821320ED69A500D95B19 /* core */,
|
||||
05A8C59520DB72F000FF7857 /* frontend */,
|
||||
05A8C5D420DB72F000FF7857 /* gfx */,
|
||||
05A8C57120DB72F000FF7857 /* intl */,
|
||||
@ -1031,6 +1047,28 @@
|
||||
path = drivers_font_renderer;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
05BF821320ED69A500D95B19 /* core */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
05B5F91120ED6AAE009C521F /* retroarch.c */,
|
||||
05B5F91220ED6AAF009C521F /* retroarch.h */,
|
||||
05B5F90F20ED6A03009C521F /* command.c */,
|
||||
05BF821720ED69D100D95B19 /* command.h */,
|
||||
05BF821420ED69D100D95B19 /* config.def.h */,
|
||||
05BF821C20ED69D100D95B19 /* config.def.keybinds.h */,
|
||||
05BF821620ED69D100D95B19 /* config.features.h */,
|
||||
05BF821A20ED69D100D95B19 /* configuration.c */,
|
||||
05BF821D20ED69D100D95B19 /* configuration.h */,
|
||||
05B5F90D20ED6A03009C521F /* content.h */,
|
||||
05BF821520ED69D100D95B19 /* core_impl.c */,
|
||||
05BF821820ED69D100D95B19 /* core_info.c */,
|
||||
05BF821B20ED69D100D95B19 /* core_info.h */,
|
||||
05B5F90E20ED6A03009C521F /* core_type.h */,
|
||||
05BF821920ED69D100D95B19 /* core.h */,
|
||||
);
|
||||
name = core;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
05C5D53220E3DD0900654EE4 /* input */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -326,9 +326,23 @@ static char** waiting_argv;
|
||||
}
|
||||
|
||||
- (void)setVideoMode:(gfx_ctx_mode_t)mode {
|
||||
// TODO(sgc): handle full screen?
|
||||
// cheap hack to ensure MTKView posts triggers a drawable resize event
|
||||
[self.window setContentSize:NSMakeSize(mode.width-1, mode.height)];
|
||||
BOOL isFullScreen = (self.window.styleMask & NSFullScreenWindowMask) == NSFullScreenWindowMask;
|
||||
if (mode.fullscreen && !isFullScreen)
|
||||
{
|
||||
[self.window toggleFullScreen:self];
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mode.fullscreen && isFullScreen)
|
||||
{
|
||||
[self.window toggleFullScreen:self];
|
||||
}
|
||||
|
||||
if (mode.width > 0)
|
||||
{
|
||||
// HACK(sgc): ensure MTKView posts a drawable resize event
|
||||
[self.window setContentSize:NSMakeSize(mode.width-1, mode.height)];
|
||||
}
|
||||
[self.window setContentSize:NSMakeSize(mode.width, mode.height)];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user