From d3da2e2616a1d9111fd3fda76408ebd65c15f46a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 7 Feb 2019 03:20:33 +0100 Subject: [PATCH] Move code to cocoa_common.m --- gfx/drivers_context/cocoa_gl_ctx.m | 14 +++----------- gfx/drivers_context/cocoa_gl_ctx_metal.m | 15 ++------------- ui/drivers/cocoa/cocoa_common.m | 12 ++++++++++++ 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/gfx/drivers_context/cocoa_gl_ctx.m b/gfx/drivers_context/cocoa_gl_ctx.m index 80febccef4..8457dd470f 100644 --- a/gfx/drivers_context/cocoa_gl_ctx.m +++ b/gfx/drivers_context/cocoa_gl_ctx.m @@ -62,6 +62,9 @@ #define UIUserInterfaceIdiomCarPlay 3 #endif +/* forward declarations */ +void cocoagl_gfx_ctx_show_mouse(void *data, bool state); + @interface EAGLContext (OSXCompat) @end @implementation EAGLContext (OSXCompat) + (void)clearCurrentContext { [EAGLContext setCurrentContext:nil]; } @@ -318,17 +321,6 @@ static void cocoagl_gfx_ctx_swap_interval(void *data, int i) #endif } -static void cocoagl_gfx_ctx_show_mouse(void *data, bool state) -{ - (void)data; - -#ifdef HAVE_COCOA - if (state) - [NSCursor unhide]; - else - [NSCursor hide]; -#endif -} static bool cocoagl_gfx_ctx_set_video_mode(void *data, video_frame_info_t *video_info, diff --git a/gfx/drivers_context/cocoa_gl_ctx_metal.m b/gfx/drivers_context/cocoa_gl_ctx_metal.m index 4bf637d51c..ce80e212bc 100644 --- a/gfx/drivers_context/cocoa_gl_ctx_metal.m +++ b/gfx/drivers_context/cocoa_gl_ctx_metal.m @@ -120,7 +120,8 @@ void *glcontext_get_ptr(void) static unsigned g_minor = 0; static unsigned g_major = 0; -/* forward declaration */ +/* forward declarations */ +void cocoagl_gfx_ctx_show_mouse(void *data, bool state); void *nsview_get_ptr(void); #if defined(HAVE_COCOATOUCH) @@ -400,18 +401,6 @@ static void cocoagl_gfx_ctx_swap_interval(void *data, int interval) } -static void cocoagl_gfx_ctx_show_mouse(void *data, bool state) -{ - (void)data; - -#ifdef HAVE_COCOA_METAL - if (state) - [NSCursor unhide]; - else - [NSCursor hide]; -#endif -} - static bool cocoagl_gfx_ctx_set_video_mode(void *data, video_frame_info_t *video_info, unsigned width, unsigned height, bool fullscreen) diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 78f3759a55..676e70100b 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -568,6 +568,18 @@ static CLLocationAccuracy currentVerticalAccuracy; @end +void cocoagl_gfx_ctx_show_mouse(void *data, bool state) +{ + (void)data; + +#if defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL) + if (state) + [NSCursor unhide]; + else + [NSCursor hide]; +#endif +} + #ifdef HAVE_AVFOUNDATION typedef struct apple_camera {