Skip to content

Commit bf9bf60

Browse files
committed
Copypaste SDL_NSLog to UIKit backend, document it as such
1 parent e954e32 commit bf9bf60

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/SDL_log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority,
400400
SDL_snprintf(tag, SDL_arraysize(tag), "SDL/%s", GetCategoryPrefix(category));
401401
__android_log_write(SDL_android_priority[priority], tag, message);
402402
}
403-
#elif defined(__APPLE__) && defined(SDL_VIDEO_DRIVER_COCOA)
404-
/* Technically we don't need SDL_VIDEO_DRIVER_COCOA, but that's where this function is defined for now.
403+
#elif defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))
404+
/* Technically we don't need Cocoa/UIKit, but that's where this function is defined for now.
405405
*/
406406
extern void SDL_NSLog(const char *text);
407407
{

src/video/cocoa/SDL_cocoavideo.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@
252252
*
253253
* This doesn't really have aything to do with the interfaces of the SDL video
254254
* subsystem, but we need to stuff this into an Objective-C source code file.
255+
*
256+
* NOTE: This is copypasted in src/video/uikit/SDL_uikitvideo.m! Be sure both
257+
* versions remain identical!
255258
*/
256259

257260
void SDL_NSLog(const char *text)

src/video/uikit/SDL_uikitvideo.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,18 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device)
247247
*
248248
* This doesn't really have aything to do with the interfaces of the SDL video
249249
* subsystem, but we need to stuff this into an Objective-C source code file.
250+
*
251+
* NOTE: This is copypasted from src/video/cocoa/SDL_cocoavideo.m! Thus, if
252+
* Cocoa is supported, we use that one instead. Be sure both versions remain
253+
* identical!
250254
*/
251255

256+
#if !defined(SDL_VIDEO_DRIVER_COCOA)
252257
void SDL_NSLog(const char *text)
253258
{
254259
NSLog(@"%s", text);
255260
}
261+
#endif /* SDL_VIDEO_DRIVER_COCOA */
256262

257263
/*
258264
* iOS Tablet detection

0 commit comments

Comments
 (0)