From bf9bf602e77f7f94dee4eaad993f95dbdf450e51 Mon Sep 17 00:00:00 2001 From: Ethan Lee Date: Wed, 17 Jul 2019 23:20:57 -0400 Subject: [PATCH] Copypaste SDL_NSLog to UIKit backend, document it as such --- src/SDL_log.c | 4 ++-- src/video/cocoa/SDL_cocoavideo.m | 3 +++ src/video/uikit/SDL_uikitvideo.m | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/SDL_log.c b/src/SDL_log.c index 486ce3417..121deb2f8 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -400,8 +400,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category)); __android_log_write(SDL_android_priority[priority], tag, message); } -#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA) - /* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now. +#elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT)) + /* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now. */ extern void SDL_NSLog(const char *text); { diff --git a/src/video/cocoa/SDL_cocoavideo.m b/src/video/cocoa/SDL_cocoavideo.m index c8f32d354..feb8e08a8 100644 --- a/src/video/cocoa/SDL_cocoavideo.m +++ b/src/video/cocoa/SDL_cocoavideo.m @@ -252,6 +252,9 @@ Cocoa_CreateImage(SDL_Surface * surface) * * This doesn't really have aything to do with the interfaces of the SDL video * subsystem, but we need to stuff this into an Objective-C source code file. + * + * NOTE: This is copypasted in src/video/uikit/SDL_uikitvideo.m! Be sure both + * versions remain identical! */ void SDL_NSLog(const char *text) diff --git a/src/video/uikit/SDL_uikitvideo.m b/src/video/uikit/SDL_uikitvideo.m index 34b63f7b7..cea40b239 100644 --- a/src/video/uikit/SDL_uikitvideo.m +++ b/src/video/uikit/SDL_uikitvideo.m @@ -247,12 +247,18 @@ UIKit_ForceUpdateHomeIndicator() * * This doesn't really have aything to do with the interfaces of the SDL video * subsystem, but we need to stuff this into an Objective-C source code file. + * + * NOTE: This is copypasted from src/video/cocoa/SDL_cocoavideo.m! Thus, if + * Cocoa is supported, we use that one instead. Be sure both versions remain + * identical! */ +#if !defined(SDL_VIDEO_DRIVER_COCOA) void SDL_NSLog(const char *text) { NSLog(@"%s", text); } +#endif /* SDL_VIDEO_DRIVER_COCOA */ /* * iOS Tablet detection