Browse Source

iOS: fix SDL_GetUIKitDeviceFormFactor return type
The function returns SDL_FormFactor values but was declared as bool,
so iOS devices were misclassified (e.g. tablets as desktop).

Александр Андреев 1 tháng trước cách đây
mục cha
commit
fcd11827f4
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      src/SDL.c
  2. 1 1
      src/video/uikit/SDL_uikitvideo.m

+ 1 - 1
src/SDL.c

@@ -874,7 +874,7 @@ SDL_FormFactor SDL_GetDeviceFormFactor(void)
 #elif defined(SDL_PLATFORM_ANDROID)
 #elif defined(SDL_PLATFORM_ANDROID)
     return SDL_GetAndroidDeviceFormFactor();
     return SDL_GetAndroidDeviceFormFactor();
 #elif defined(SDL_PLATFORM_IOS)
 #elif defined(SDL_PLATFORM_IOS)
-    extern bool SDL_GetUIKitDeviceFormFactor(void);
+    extern SDL_FormFactor SDL_GetUIKitDeviceFormFactor(void);
     return SDL_GetUIKitDeviceFormFactor();
     return SDL_GetUIKitDeviceFormFactor();
 #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) || defined(SDL_PLATFORM_PS2)
 #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) || defined(SDL_PLATFORM_PS2)
     return SDL_FORMFACTOR_CONSOLE;
     return SDL_FORMFACTOR_CONSOLE;

+ 1 - 1
src/video/uikit/SDL_uikitvideo.m

@@ -385,7 +385,7 @@ void SDL_NSLog(const char *prefix, const char *text)
  * subsystem, but we need to stuff this into an Objective-C source code file.
  * subsystem, but we need to stuff this into an Objective-C source code file.
  */
  */
 
 
-bool SDL_GetUIKitDeviceFormFactor(void)
+SDL_FormFactor SDL_GetUIKitDeviceFormFactor(void)
 {
 {
     // TODO: Apple Watch
     // TODO: Apple Watch
     switch ([UIDevice currentDevice].userInterfaceIdiom) {
     switch ([UIDevice currentDevice].userInterfaceIdiom) {