diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index 8883308594..71e34620a2 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -3556,3 +3556,33 @@ typedef SDL_Colour, SDL_Color; - SDL_LinuxSetThreadPriorityAndPolicy + SDL_SetLinuxThreadPriorityAndPolicy (...) +@@ +@@ +- SDL_DXGIGetOutputInfo ++ SDL_GetDXGIOutputInfo + (...) +@@ +@@ +- SDL_AndroidBackButton ++ SDL_TriggerAndroidBackButton + (...) +@@ +@@ +- SDL_AndroidRequestPermission ++ SDL_RequestAndroidPermission + (...) +@@ +@@ +- SDL_AndroidRequestPermissionCallback ++ SDL_RequestAndroidPermissionCallback + (...) +@@ +@@ +- SDL_AndroidShowToast ++ SDL_ShowAndroidToast + (...) +@@ +@@ +- SDL_AndroidSendMessage ++ SDL_SendAndroidMessage + (...) diff --git a/docs/README-migration.md b/docs/README-migration.md index 571f094546..3e733dcca2 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1750,10 +1750,11 @@ SDL_WindowsMessageHook has changed signatures so the message may be modified and SDL_GetAndroidExternalStorageState() takes the state as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error. -SDL_AndroidRequestPermission is no longer a blocking call; the caller now provides a callback function that fires when a response is available. +SDL_RequestAndroidPermission is no longer a blocking call; the caller now provides a callback function that fires when a response is available. SDL_iPhoneSetAnimationCallback() and SDL_iPhoneSetEventPump() have been renamed to SDL_SetiOSAnimationCallback() and SDL_SetiOSEventPump(), respectively. SDL2 has had macros to provide this new name with the old symbol since the introduction of the iPad, but now the correctly-named symbol is the only option. +SDL_GetDXGIOutputInfo() now returns the standard int error code. The following functions have been removed: * SDL_RenderGetD3D11Device() - replaced with the "SDL.renderer.d3d11.device" property @@ -1762,11 +1763,17 @@ The following functions have been removed: * SDL_GetWinRTFSPathUNICODE() - Use SDL_GetWinRTFSPath() and SDL_iconv_string to convert from UTF-8 to UTF-16. The following functions have been renamed: +* SDL_AndroidBackButton() => SDL_SendAndroidBackButton() * SDL_AndroidGetActivity() => SDL_GetAndroidActivity() * SDL_AndroidGetExternalStoragePath() => SDL_GetAndroidExternalStoragePath() * SDL_AndroidGetExternalStorageState() => SDL_GetAndroidExternalStorageState() * SDL_AndroidGetInternalStoragePath() => SDL_GetAndroidInternalStoragePath() * SDL_AndroidGetJNIEnv() => SDL_GetAndroidJNIEnv() +* SDL_AndroidRequestPermission() => SDL_RequestAndroidPermission() +* SDL_AndroidRequestPermissionCallback() => SDL_RequestAndroidPermissionCallback() +* SDL_AndroidSendMessage() => SDL_SendAndroidMessage() +* SDL_AndroidShowToast() => SDL_ShowAndroidToast() +* SDL_DXGIGetOutputInfo() => SDL_GetDXGIOutputInfo() * SDL_Direct3D9GetAdapterIndex() => SDL_GetDirect3D9AdapterIndex() * SDL_GDKGetDefaultUser() => SDL_GetGDKDefaultUser() * SDL_GDKGetTaskQueue() => SDL_GetGDKTaskQueue() diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index d6717d95f7..e714014e27 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -599,11 +599,17 @@ #define SDL_UpperBlitScaled SDL_BlitSurfaceScaled /* ##SDL_system.h */ +#define SDL_AndroidBackButton SDL_SendAndroidBackButton #define SDL_AndroidGetActivity SDL_GetAndroidActivity #define SDL_AndroidGetExternalStoragePath SDL_GetAndroidExternalStoragePath #define SDL_AndroidGetExternalStorageState SDL_GetAndroidExternalStorageState #define SDL_AndroidGetInternalStoragePath SDL_GetAndroidInternalStoragePath #define SDL_AndroidGetJNIEnv SDL_GetAndroidJNIEnv +#define SDL_AndroidRequestPermission SDL_RequestAndroidPermission +#define SDL_AndroidRequestPermissionCallback SDL_RequestAndroidPermissionCallback +#define SDL_AndroidSendMessage SDL_SendAndroidMessage +#define SDL_AndroidShowToast SDL_ShowAndroidToast +#define SDL_DXGIGetOutputInfo SDL_GetDXGIOutputInfo #define SDL_Direct3D9GetAdapterIndex SDL_GetDirect3D9AdapterIndex #define SDL_GDKGetDefaultUser SDL_GetGDKDefaultUser #define SDL_GDKGetTaskQueue SDL_GetGDKTaskQueue @@ -1210,11 +1216,17 @@ #define SDL_UpperBlitScaled SDL_UpperBlitScaled_renamed_SDL_BlitSurfaceScaled /* ##SDL_system.h */ +#define SDL_AndroidBackButton SDL_AndroidBackButton_renamed_SDL_SendAndroidBackButton #define SDL_AndroidGetActivity SDL_AndroidGetActivity_renamed_SDL_GetAndroidActivity #define SDL_AndroidGetExternalStoragePath SDL_AndroidGetExternalStoragePath_renamed_SDL_GetAndroidExternalStoragePath #define SDL_AndroidGetExternalStorageState SDL_AndroidGetExternalStorageState_renamed_SDL_GetAndroidExternalStorageState #define SDL_AndroidGetInternalStoragePath SDL_AndroidGetInternalStoragePath_renamed_SDL_GetAndroidInternalStoragePath #define SDL_AndroidGetJNIEnv SDL_AndroidGetJNIEnv_renamed_SDL_GetAndroidJNIEnv +#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_renamed_SDL_RequestAndroidPermission +#define SDL_AndroidRequestPermissionCallback SDL_AndroidRequestPermissionCallback_renamed_SDL_RequestAndroidPermissionCallback +#define SDL_AndroidSendMessage SDL_AndroidSendMessage_renamed_SDL_SendAndroidMessage +#define SDL_AndroidShowToast SDL_AndroidShowToast_renamed_SDL_ShowAndroidToast +#define SDL_DXGIGetOutputInfo SDL_DXGIGetOutputInfo_renamed_SDL_GetDXGIOutputInfo #define SDL_Direct3D9GetAdapterIndex SDL_Direct3D9GetAdapterIndex_renamed_SDL_GetDirect3D9AdapterIndex #define SDL_GDKGetDefaultUser SDL_GDKGetDefaultUser_renamed_SDL_GetGDKDefaultUser #define SDL_GDKGetTaskQueue SDL_GDKGetTaskQueue_renamed_SDL_GetGDKTaskQueue diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h index 1a0bcc9698..3d9c9d9790 100644 --- a/include/SDL3/SDL_system.h +++ b/include/SDL3/SDL_system.h @@ -122,12 +122,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displ * \param displayID the instance of the display to query. * \param adapterIndex a pointer to be filled in with the adapter index. * \param outputIndex a pointer to be filled in with the output index. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns 0 on success or a negative error code on failure; call + * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); +extern SDL_DECLSPEC int SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ @@ -383,7 +383,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC void SDLCALL SDL_AndroidBackButton(void); +extern SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); /** * See the official Android developer guide for more information: @@ -483,7 +483,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void) extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); -typedef void (SDLCALL *SDL_AndroidRequestPermissionCallback)(void *userdata, const char *permission, SDL_bool granted); +typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, SDL_bool granted); /** * Request permissions at runtime, asynchronously. @@ -515,7 +515,7 @@ typedef void (SDLCALL *SDL_AndroidRequestPermissionCallback)(void *userdata, con * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC int SDLCALL SDL_AndroidRequestPermission(const char *permission, SDL_AndroidRequestPermissionCallback cb, void *userdata); +extern SDL_DECLSPEC int SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); /** * Shows an Android toast notification. @@ -543,7 +543,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AndroidRequestPermission(const char *permiss * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset); +extern SDL_DECLSPEC int SDLCALL SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset); /** * Send a user command to SDLActivity. @@ -559,7 +559,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int du * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param); +extern SDL_DECLSPEC int SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); #endif /* SDL_PLATFORM_ANDROID */ diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c index c35b02fe7b..76080fb586 100644 --- a/src/audio/aaudio/SDL_aaudio.c +++ b/src/audio/aaudio/SDL_aaudio.c @@ -382,7 +382,7 @@ static int BuildAAudioStream(SDL_AudioDevice *device) } // !!! FIXME: make this non-blocking! -static void SDLCALL AndroidRequestPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) +static void SDLCALL RequestAndroidPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) { SDL_AtomicSet((SDL_AtomicInt *) userdata, granted ? 1 : -1); } @@ -399,7 +399,7 @@ static int AAUDIO_OpenDevice(SDL_AudioDevice *device) // !!! FIXME: make this non-blocking! SDL_AtomicInt permission_response; SDL_AtomicSet(&permission_response, 0); - if (SDL_AndroidRequestPermission("android.permission.RECORD_AUDIO", AndroidRequestPermissionBlockingCallback, &permission_response) == -1) { + if (SDL_RequestAndroidPermission("android.permission.RECORD_AUDIO", RequestAndroidPermissionBlockingCallback, &permission_response) == -1) { return -1; } diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c index 63fc8d6548..3d1d0b75af 100644 --- a/src/audio/openslES/SDL_openslES.c +++ b/src/audio/openslES/SDL_openslES.c @@ -229,7 +229,7 @@ static void OPENSLES_DestroyPCMRecorder(SDL_AudioDevice *device) } // !!! FIXME: make this non-blocking! -static void SDLCALL AndroidRequestPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) +static void SDLCALL RequestAndroidPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) { SDL_AtomicSet((SDL_AtomicInt *) userdata, granted ? 1 : -1); } @@ -251,7 +251,7 @@ static int OPENSLES_CreatePCMRecorder(SDL_AudioDevice *device) { SDL_AtomicInt permission_response; SDL_AtomicSet(&permission_response, 0); - if (SDL_AndroidRequestPermission("android.permission.RECORD_AUDIO", AndroidRequestPermissionBlockingCallback, &permission_response) == -1) { + if (SDL_RequestAndroidPermission("android.permission.RECORD_AUDIO", RequestAndroidPermissionBlockingCallback, &permission_response) == -1) { return -1; } diff --git a/src/camera/android/SDL_camera_android.c b/src/camera/android/SDL_camera_android.c index 413e773213..75c6be439a 100644 --- a/src/camera/android/SDL_camera_android.c +++ b/src/camera/android/SDL_camera_android.c @@ -559,7 +559,7 @@ static int ANDROIDCAMERA_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *sp // just in case SDL_OpenCamera is overwriting device->spec as CameraPermissionCallback runs, we work from a different copy. SDL_copyp(&device->hidden->requested_spec, spec); - if (SDL_AndroidRequestPermission("android.permission.CAMERA", CameraPermissionCallback, device) < 0) { + if (SDL_RequestAndroidPermission("android.permission.CAMERA", CameraPermissionCallback, device) < 0) { UnrefPhysicalCamera(device); return -1; } diff --git a/src/core/SDL_core_unsupported.c b/src/core/SDL_core_unsupported.c index 6badd4be66..32add8afb7 100644 --- a/src/core/SDL_core_unsupported.c +++ b/src/core/SDL_core_unsupported.c @@ -114,8 +114,8 @@ const char *SDL_GetWinRTFSPath(int pathType) #ifndef SDL_PLATFORM_ANDROID -SDL_DECLSPEC void SDLCALL SDL_AndroidBackButton(void); -void SDL_AndroidBackButton() +SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); +void SDL_SendAndroidBackButton() { SDL_Unsupported(); } @@ -162,9 +162,9 @@ void *SDL_GetAndroidJNIEnv() return NULL; } -typedef void (SDLCALL *SDL_AndroidRequestPermissionCallback)(void *userdata, const char *permission, SDL_bool granted); -SDL_DECLSPEC int SDLCALL SDL_AndroidRequestPermission(const char *permission, SDL_AndroidRequestPermissionCallback cb, void *userdata); -int SDL_AndroidRequestPermission(const char *permission, SDL_AndroidRequestPermissionCallback cb, void *userdata) +typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, SDL_bool granted); +SDL_DECLSPEC int SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); +int SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) { (void)permission; (void)cb; @@ -172,16 +172,16 @@ int SDL_AndroidRequestPermission(const char *permission, SDL_AndroidRequestPermi return SDL_Unsupported(); } -SDL_DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param); -int SDL_AndroidSendMessage(Uint32 command, int param) +SDL_DECLSPEC int SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); +int SDL_SendAndroidMessage(Uint32 command, int param) { (void)command; (void)param; return SDL_Unsupported(); } -SDL_DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset); -int SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset) +SDL_DECLSPEC int SDLCALL SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset); +int SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset) { (void)message; (void)duration; diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index d9988353fa..fc0a949da1 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -2245,7 +2245,7 @@ void Android_JNI_HapticStop(int device_id) /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 -int SDL_AndroidSendMessage(Uint32 command, int param) +int SDL_SendAndroidMessage(Uint32 command, int param) { if (command >= 0x8000) { return Android_JNI_SendMessage(command, param); @@ -2446,7 +2446,7 @@ SDL_bool SDL_IsDeXMode(void) return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsDeXMode); } -void SDL_AndroidBackButton(void) +void SDL_SendAndroidBackButton(void) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mActivityClass, midManualBackButton); @@ -2645,7 +2645,7 @@ const char *SDL_GetAndroidCachePath(void) return s_AndroidCachePath; } -int SDL_AndroidShowToast(const char *message, int duration, int gravity, int xOffset, int yOffset) +int SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xOffset, int yOffset) { return Android_JNI_ShowToast(message, duration, gravity, xOffset, yOffset); } @@ -2716,7 +2716,7 @@ typedef struct NativePermissionRequestInfo { int request_code; char *permission; - SDL_AndroidRequestPermissionCallback callback; + SDL_RequestAndroidPermissionCallback callback; void *userdata; struct NativePermissionRequestInfo *next; } NativePermissionRequestInfo; @@ -2744,7 +2744,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePermissionResult)( SDL_UnlockMutex(Android_ActivityMutex); } -int SDL_AndroidRequestPermission(const char *permission, SDL_AndroidRequestPermissionCallback cb, void *userdata) +int SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) { if (!permission) { return SDL_InvalidParamError("permission"); diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 72f5f453a0..81cc006ba2 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -12,10 +12,6 @@ SDL3_0.0.0 { SDL_AddTimerNS; SDL_AddVulkanRenderSemaphores; SDL_AllocateEventMemory; - SDL_AndroidBackButton; - SDL_AndroidRequestPermission; - SDL_AndroidSendMessage; - SDL_AndroidShowToast; SDL_AtomicAdd; SDL_AtomicCompareAndSwap; SDL_AtomicCompareAndSwapPointer; @@ -85,7 +81,6 @@ SDL3_0.0.0 { SDL_CreateWindowAndRenderer; SDL_CreateWindowWithProperties; SDL_CursorVisible; - SDL_DXGIGetOutputInfo; SDL_DateTimeToTime; SDL_DelEventWatch; SDL_DelHintCallback; @@ -204,6 +199,7 @@ SDL3_0.0.0 { SDL_GetCurrentTime; SDL_GetCurrentVideoDriver; SDL_GetCursor; + SDL_GetDXGIOutputInfo; SDL_GetDateTimeLocalePreferences; SDL_GetDayOfWeek; SDL_GetDayOfYear; @@ -666,6 +662,7 @@ SDL3_0.0.0 { SDL_RenderTextureRotated; SDL_RenderViewportSet; SDL_ReportAssertion; + SDL_RequestAndroidPermission; SDL_ResetAssertionReport; SDL_ResetHint; SDL_ResetHints; @@ -686,6 +683,8 @@ SDL3_0.0.0 { SDL_ScreenKeyboardShown; SDL_ScreenSaverEnabled; SDL_SeekIO; + SDL_SendAndroidBackButton; + SDL_SendAndroidMessage; SDL_SendGamepadEffect; SDL_SendJoystickEffect; SDL_SendJoystickVirtualSensorData; @@ -792,6 +791,7 @@ SDL3_0.0.0 { SDL_SetX11EventHook; SDL_SetiOSAnimationCallback; SDL_SetiOSEventPump; + SDL_ShowAndroidToast; SDL_ShowCursor; SDL_ShowMessageBox; SDL_ShowOpenFileDialog; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 0be1dbbcdd..7407e5f55f 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -37,10 +37,6 @@ #define SDL_AddTimerNS SDL_AddTimerNS_REAL #define SDL_AddVulkanRenderSemaphores SDL_AddVulkanRenderSemaphores_REAL #define SDL_AllocateEventMemory SDL_AllocateEventMemory_REAL -#define SDL_AndroidBackButton SDL_AndroidBackButton_REAL -#define SDL_AndroidRequestPermission SDL_AndroidRequestPermission_REAL -#define SDL_AndroidSendMessage SDL_AndroidSendMessage_REAL -#define SDL_AndroidShowToast SDL_AndroidShowToast_REAL #define SDL_AtomicAdd SDL_AtomicAdd_REAL #define SDL_AtomicCompareAndSwap SDL_AtomicCompareAndSwap_REAL #define SDL_AtomicCompareAndSwapPointer SDL_AtomicCompareAndSwapPointer_REAL @@ -110,7 +106,6 @@ #define SDL_CreateWindowAndRenderer SDL_CreateWindowAndRenderer_REAL #define SDL_CreateWindowWithProperties SDL_CreateWindowWithProperties_REAL #define SDL_CursorVisible SDL_CursorVisible_REAL -#define SDL_DXGIGetOutputInfo SDL_DXGIGetOutputInfo_REAL #define SDL_DateTimeToTime SDL_DateTimeToTime_REAL #define SDL_DelEventWatch SDL_DelEventWatch_REAL #define SDL_DelHintCallback SDL_DelHintCallback_REAL @@ -229,6 +224,7 @@ #define SDL_GetCurrentTime SDL_GetCurrentTime_REAL #define SDL_GetCurrentVideoDriver SDL_GetCurrentVideoDriver_REAL #define SDL_GetCursor SDL_GetCursor_REAL +#define SDL_GetDXGIOutputInfo SDL_GetDXGIOutputInfo_REAL #define SDL_GetDateTimeLocalePreferences SDL_GetDateTimeLocalePreferences_REAL #define SDL_GetDayOfWeek SDL_GetDayOfWeek_REAL #define SDL_GetDayOfYear SDL_GetDayOfYear_REAL @@ -691,6 +687,7 @@ #define SDL_RenderTextureRotated SDL_RenderTextureRotated_REAL #define SDL_RenderViewportSet SDL_RenderViewportSet_REAL #define SDL_ReportAssertion SDL_ReportAssertion_REAL +#define SDL_RequestAndroidPermission SDL_RequestAndroidPermission_REAL #define SDL_ResetAssertionReport SDL_ResetAssertionReport_REAL #define SDL_ResetHint SDL_ResetHint_REAL #define SDL_ResetHints SDL_ResetHints_REAL @@ -711,6 +708,8 @@ #define SDL_ScreenKeyboardShown SDL_ScreenKeyboardShown_REAL #define SDL_ScreenSaverEnabled SDL_ScreenSaverEnabled_REAL #define SDL_SeekIO SDL_SeekIO_REAL +#define SDL_SendAndroidBackButton SDL_SendAndroidBackButton_REAL +#define SDL_SendAndroidMessage SDL_SendAndroidMessage_REAL #define SDL_SendGamepadEffect SDL_SendGamepadEffect_REAL #define SDL_SendJoystickEffect SDL_SendJoystickEffect_REAL #define SDL_SendJoystickVirtualSensorData SDL_SendJoystickVirtualSensorData_REAL @@ -817,6 +816,7 @@ #define SDL_SetX11EventHook SDL_SetX11EventHook_REAL #define SDL_SetiOSAnimationCallback SDL_SetiOSAnimationCallback_REAL #define SDL_SetiOSEventPump SDL_SetiOSEventPump_REAL +#define SDL_ShowAndroidToast SDL_ShowAndroidToast_REAL #define SDL_ShowCursor SDL_ShowCursor_REAL #define SDL_ShowMessageBox SDL_ShowMessageBox_REAL #define SDL_ShowOpenFileDialog SDL_ShowOpenFileDialog_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 90524782d5..53d213fcf8 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -57,10 +57,6 @@ SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimerNS,(Uint64 a, SDL_NSTimerCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_AddVulkanRenderSemaphores,(SDL_Renderer *a, Uint32 b, Sint64 c, Sint64 d),(a,b,c,d),return) SDL_DYNAPI_PROC(void*,SDL_AllocateEventMemory,(size_t a),(a),return) -SDL_DYNAPI_PROC(void,SDL_AndroidBackButton,(void),(),) -SDL_DYNAPI_PROC(int,SDL_AndroidRequestPermission,(const char *a, SDL_AndroidRequestPermissionCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(int,SDL_AndroidSendMessage,(Uint32 a, int b),(a,b),return) -SDL_DYNAPI_PROC(int,SDL_AndroidShowToast,(const char *a, int b, int c, int d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_AtomicInt *a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwap,(SDL_AtomicInt *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwapPointer,(void **a, void *b, void *c),(a,b,c),return) @@ -130,7 +126,6 @@ SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, SDL_W SDL_DYNAPI_PROC(int,SDL_CreateWindowAndRenderer,(const char *a, int b, int c, SDL_WindowFlags d, SDL_Window **e, SDL_Renderer **f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowWithProperties,(SDL_PropertiesID a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_CursorVisible,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_DXGIGetOutputInfo,(SDL_DisplayID a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_DateTimeToTime,(const SDL_DateTime *a, SDL_Time *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_DelEventWatch,(SDL_EventFilter a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_DelHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),) @@ -249,6 +244,7 @@ SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetCurrentThreadID,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetCurrentTime,(SDL_Time *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentVideoDriver,(void),(),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetCursor,(void),(),return) +SDL_DYNAPI_PROC(int,SDL_GetDXGIOutputInfo,(SDL_DisplayID a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetDateTimeLocalePreferences,(SDL_DateFormat *a, SDL_TimeFormat *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetDayOfWeek,(int a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetDayOfYear,(int a, int b, int c),(a,b,c),return) @@ -702,6 +698,7 @@ SDL_DYNAPI_PROC(int,SDL_RenderTexture,(SDL_Renderer *a, SDL_Texture *b, const SD SDL_DYNAPI_PROC(int,SDL_RenderTextureRotated,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_FlipMode g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(SDL_bool,SDL_RenderViewportSet,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(SDL_AssertState,SDL_ReportAssertion,(SDL_AssertData *a, const char *b, const char *c, int d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_RequestAndroidPermission,(const char *a, SDL_RequestAndroidPermissionCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_ResetAssertionReport,(void),(),) SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_ResetHints,(void),(),) @@ -722,6 +719,8 @@ SDL_DYNAPI_PROC(int,SDL_SaveBMP_IO,(SDL_Surface *a, SDL_IOStream *b, SDL_bool c) SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenSaverEnabled,(void),(),return) SDL_DYNAPI_PROC(Sint64,SDL_SeekIO,(SDL_IOStream *a, Sint64 b, SDL_IOWhence c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_SendAndroidBackButton,(void),(),) +SDL_DYNAPI_PROC(int,SDL_SendAndroidMessage,(Uint32 a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SendJoystickEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_SendJoystickVirtualSensorData,(SDL_Joystick *a, SDL_SensorType b, Uint64 c, const float *d, int e),(a,b,c,d,e),return) @@ -827,6 +826,7 @@ SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void * SDL_DYNAPI_PROC(void,SDL_SetX11EventHook,(SDL_X11EventHook a, void *b),(a,b),) SDL_DYNAPI_PROC(int,SDL_SetiOSAnimationCallback,(SDL_Window *a, int b, SDL_iOSAnimationCallback c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_SetiOSEventPump,(SDL_bool a),(a),) +SDL_DYNAPI_PROC(int,SDL_ShowAndroidToast,(const char *a, int b, int c, int d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_ShowCursor,(void),(),return) SDL_DYNAPI_PROC(int,SDL_ShowMessageBox,(const SDL_MessageBoxData *a, int *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_ShowOpenFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, int e, const char *f, SDL_bool g),(a,b,c,d,e,f,g),) diff --git a/src/dynapi/SDL_dynapi_unsupported.h b/src/dynapi/SDL_dynapi_unsupported.h index 272cd5e083..ce6864c86c 100644 --- a/src/dynapi/SDL_dynapi_unsupported.h +++ b/src/dynapi/SDL_dynapi_unsupported.h @@ -46,7 +46,7 @@ typedef struct XUserHandle XUserHandle; #endif #ifndef SDL_PLATFORM_ANDROID -typedef void *SDL_AndroidRequestPermissionCallback; +typedef void *SDL_RequestAndroidPermissionCallback; #endif #ifndef SDL_PLATFORM_IOS diff --git a/src/hidapi/android/hid.cpp b/src/hidapi/android/hid.cpp index b15f8ba5d7..c1c2288310 100644 --- a/src/hidapi/android/hid.cpp +++ b/src/hidapi/android/hid.cpp @@ -1030,7 +1030,7 @@ extern "C" { // !!! FIXME: make this non-blocking! -static void SDLCALL AndroidRequestPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) +static void SDLCALL RequestAndroidPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) { SDL_AtomicSet((SDL_AtomicInt *) userdata, granted ? 1 : -1); } @@ -1040,7 +1040,7 @@ static SDL_bool RequestBluetoothPermissions(const char *permission) // !!! FIXME: make this non-blocking! SDL_AtomicInt permission_response; SDL_AtomicSet(&permission_response, 0); - if (SDL_AndroidRequestPermission(permission, AndroidRequestPermissionBlockingCallback, &permission_response) == -1) { + if (SDL_RequestAndroidPermission(permission, RequestAndroidPermissionBlockingCallback, &permission_response) == -1) { return SDL_FALSE; } diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c index a60896dec4..3c9b9e819d 100644 --- a/src/test/SDL_test_common.c +++ b/src/test/SDL_test_common.c @@ -1266,7 +1266,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_Log("D3D9 Adapter Index: %d", adapterIndex); /* Print the DXGI adapter and output indices */ - SDL_DXGIGetOutputInfo(displayID, &adapterIndex, &outputIndex); + SDL_GetDXGIOutputInfo(displayID, &adapterIndex, &outputIndex); SDL_Log("DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex); #endif } diff --git a/src/video/SDL_video_unsupported.c b/src/video/SDL_video_unsupported.c index 8306816aad..05ba3c743b 100644 --- a/src/video/SDL_video_unsupported.c +++ b/src/video/SDL_video_unsupported.c @@ -42,14 +42,13 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata) #endif /* SDL_PLATFORM_WIN32 || SDL_PLATFORM_GDK */ -SDL_DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); -SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex) +SDL_DECLSPEC int SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); +SDL_bool SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex) { (void)displayID; (void)adapterIndex; (void)outputIndex; - SDL_Unsupported(); - return SDL_FALSE; + return SDL_Unsupported(); } SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c index 1fe196de6c..ba43b36f64 100644 --- a/src/video/windows/SDL_windowsvideo.c +++ b/src/video/windows/SDL_windowsvideo.c @@ -629,7 +629,7 @@ int SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID) } #endif /* !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) */ -SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex) +int SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex) { #ifndef HAVE_DXGI_H if (adapterIndex) { @@ -638,8 +638,7 @@ SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int * if (outputIndex) { *outputIndex = -1; } - SDL_SetError("SDL was compiled without DXGI support due to missing dxgi.h header"); - return SDL_FALSE; + return SDL_SetError("SDL was compiled without DXGI support due to missing dxgi.h header"); #else const SDL_VideoDevice *videodevice = SDL_GetVideoDevice(); const SDL_VideoData *videodata = videodevice ? videodevice->driverdata : NULL; @@ -649,26 +648,22 @@ SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int * IDXGIOutput *pDXGIOutput; if (!adapterIndex) { - SDL_InvalidParamError("adapterIndex"); - return SDL_FALSE; + return SDL_InvalidParamError("adapterIndex"); } if (!outputIndex) { - SDL_InvalidParamError("outputIndex"); - return SDL_FALSE; + return SDL_InvalidParamError("outputIndex"); } *adapterIndex = -1; *outputIndex = -1; if (!pData) { - SDL_SetError("Invalid display index"); - return SDL_FALSE; + return SDL_SetError("Invalid display index"); } if (!videodata || !videodata->pDXGIFactory) { - SDL_SetError("Unable to create DXGI interface"); - return SDL_FALSE; + return SDL_SetError("Unable to create DXGI interface"); } nAdapter = 0; @@ -690,10 +685,9 @@ SDL_bool SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int * } if (*adapterIndex == -1) { - return SDL_FALSE; - } else { - return SDL_TRUE; + return SDL_SetError("Couldn't find matching adapter"); } + return 0; #endif }