From 335fa5d6e4c84fff79243d591468db80b54cff0d Mon Sep 17 00:00:00 2001 From: Semphris Date: Sat, 30 Mar 2024 00:34:29 -0400 Subject: [PATCH] Disable SDL dialogs for tvOS and iOS --- src/dialog/cocoa/SDL_cocoadialog.m | 7 +++++-- src/dialog/dummy/SDL_dummydialog.c | 2 -- src/dialog/windows/SDL_windowsdialog.c | 3 --- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/dialog/cocoa/SDL_cocoadialog.m b/src/dialog/cocoa/SDL_cocoadialog.m index 3d4a8a59b..64b4b3563 100644 --- a/src/dialog/cocoa/SDL_cocoadialog.m +++ b/src/dialog/cocoa/SDL_cocoadialog.m @@ -20,8 +20,6 @@ */ #include "SDL_internal.h" -/* TODO: Macro? */ - #import typedef enum @@ -33,6 +31,10 @@ typedef enum void show_file_dialog(cocoa_FileDialogType type, SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, const char* default_location, SDL_bool allow_many) { +#if defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_IOS) + SDL_SetError("tvOS and iOS don't support path-based file dialogs"); + callback(userdata, NULL, -1); +#else /* NSOpenPanel inherits from NSSavePanel */ NSSavePanel *dialog; NSOpenPanel *dialog_as_open; @@ -151,6 +153,7 @@ void show_file_dialog(cocoa_FileDialogType type, SDL_DialogFileCallback callback callback(userdata, files, -1); } } +#endif // defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_IOS) } void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, const char* default_location, SDL_bool allow_many) diff --git a/src/dialog/dummy/SDL_dummydialog.c b/src/dialog/dummy/SDL_dummydialog.c index 8740f2f2d..057bb67d8 100644 --- a/src/dialog/dummy/SDL_dummydialog.c +++ b/src/dialog/dummy/SDL_dummydialog.c @@ -20,8 +20,6 @@ */ #include "SDL_internal.h" -/* TODO: Macro? */ - void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, const char* default_location, SDL_bool allow_many) { SDL_Unsupported(); diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index 57bfe8b63..93c5180c2 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -20,9 +20,6 @@ */ #include "SDL_internal.h" -/* TODO: Macro? */ - -/* TODO: Better includes? */ #include #include #include "../../core/windows/SDL_windows.h"