From 6372e755c49597cf630365e604f064e0c748a94c Mon Sep 17 00:00:00 2001 From: meancoot Date: Tue, 27 Aug 2013 11:37:21 -0400 Subject: [PATCH] (OSX) Add proper full screen tracking --- apple/RetroArch/RAGameView.m | 25 +++++++++++++++++++++++++ apple/RetroArch/rarch_wrapper.h | 1 + gfx/context/apple_gl_ctx.c | 5 +---- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/apple/RetroArch/RAGameView.m b/apple/RetroArch/RAGameView.m index 4b9c592f33..5064083985 100644 --- a/apple/RetroArch/RAGameView.m +++ b/apple/RetroArch/RAGameView.m @@ -312,6 +312,31 @@ void *apple_get_proc_address(const char *symbol_name) #endif } +bool apple_set_video_mode(unsigned width, unsigned height, bool fullscreen) +{ + __block bool result = true; + +#ifdef OSX + dispatch_sync(dispatch_get_main_queue(), + ^{ + // TODO: Multi-monitor support + // TODO: Sceen mode support + + if (fullscreen) + result = [g_view enterFullScreenMode:[NSScreen mainScreen] withOptions:nil]; + else + { + [g_view exitFullScreenModeWithOptions:nil]; + [g_view.window makeFirstResponder:g_view]; + } + }); +#endif + + // TODO: Maybe iOS users should be apple to show/hide the status bar here? + + return result; +} + #ifdef IOS void apple_bind_game_view_fbo(void) { diff --git a/apple/RetroArch/rarch_wrapper.h b/apple/RetroArch/rarch_wrapper.h index b92cf5eb83..3537360da5 100644 --- a/apple/RetroArch/rarch_wrapper.h +++ b/apple/RetroArch/rarch_wrapper.h @@ -26,6 +26,7 @@ void apple_rarch_exited (void* result); // These functions must only be called in gfx/context/ioseagl_ctx.c bool apple_init_game_view(void); void apple_destroy_game_view(void); +bool apple_set_video_mode(unsigned width, unsigned height, bool fullscreen); void apple_flip_game_view(void); void apple_set_game_view_sync(unsigned interval); void apple_get_game_view_size(unsigned *width, unsigned *height); diff --git a/gfx/context/apple_gl_ctx.c b/gfx/context/apple_gl_ctx.c index d8db42630f..29d0bfeb35 100644 --- a/gfx/context/apple_gl_ctx.c +++ b/gfx/context/apple_gl_ctx.c @@ -42,10 +42,7 @@ static bool gfx_ctx_set_video_mode( unsigned width, unsigned height, bool fullscreen) { - (void)width; - (void)height; - (void)fullscreen; - return true; + return apple_set_video_mode(width, height, fullscreen); } static void gfx_ctx_update_window_title(void)