SDL_system.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2024 Sam Lantinga <[email protected]>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_system.h
  20. *
  21. * Include file for platform specific SDL API functions
  22. */
  23. #ifndef SDL_system_h_
  24. #define SDL_system_h_
  25. #include <SDL3/SDL_stdinc.h>
  26. #include <SDL3/SDL_error.h>
  27. #include <SDL3/SDL_keyboard.h>
  28. #include <SDL3/SDL_render.h>
  29. #include <SDL3/SDL_video.h>
  30. #include <SDL3/SDL_begin_code.h>
  31. /* Set up for C function definitions, even when using C++ */
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /*
  36. * Platform specific functions for Windows
  37. */
  38. #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
  39. typedef struct tagMSG MSG;
  40. typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg);
  41. /**
  42. * Set a callback for every Windows message, run before TranslateMessage().
  43. *
  44. * The callback may modify the message, and should return SDL_TRUE if the
  45. * message should continue to be processed, or SDL_FALSE to prevent further
  46. * processing.
  47. *
  48. * \param callback The SDL_WindowsMessageHook function to call.
  49. * \param userdata a pointer to pass to every iteration of `callback`
  50. *
  51. * \since This function is available since SDL 3.0.0.
  52. */
  53. extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata);
  54. #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */
  55. #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
  56. /**
  57. * Get the D3D9 adapter index that matches the specified display.
  58. *
  59. * The returned adapter index can be passed to `IDirect3D9::CreateDevice` and
  60. * controls on which monitor a full screen application will appear.
  61. *
  62. * \param displayID the instance of the display to query
  63. * \returns the D3D9 adapter index on success or a negative error code on
  64. * failure; call SDL_GetError() for more information.
  65. *
  66. * \since This function is available since SDL 3.0.0.
  67. */
  68. extern DECLSPEC int SDLCALL SDL_Direct3D9GetAdapterIndex(SDL_DisplayID displayID);
  69. #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
  70. #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK)
  71. /**
  72. * Get the DXGI Adapter and Output indices for the specified display.
  73. *
  74. * The DXGI Adapter and Output indices can be passed to `EnumAdapters` and
  75. * `EnumOutputs` respectively to get the objects required to create a DX10 or
  76. * DX11 device and swap chain.
  77. *
  78. * \param displayID the instance of the display to query
  79. * \param adapterIndex a pointer to be filled in with the adapter index
  80. * \param outputIndex a pointer to be filled in with the output index
  81. * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
  82. * for more information.
  83. *
  84. * \since This function is available since SDL 3.0.0.
  85. */
  86. extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex);
  87. #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */
  88. /*
  89. * Platform specific functions for UNIX
  90. */
  91. typedef union _XEvent XEvent;
  92. typedef SDL_bool (SDLCALL *SDL_X11EventHook)(void *userdata, XEvent *xevent);
  93. /**
  94. * Set a callback for every X11 event
  95. *
  96. * The callback may modify the event, and should return SDL_TRUE if the event
  97. * should continue to be processed, or SDL_FALSE to prevent further
  98. * processing.
  99. *
  100. * \param callback The SDL_X11EventHook function to call.
  101. * \param userdata a pointer to pass to every iteration of `callback`
  102. *
  103. * \since This function is available since SDL 3.0.0.
  104. */
  105. extern DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata);
  106. /*
  107. * Platform specific functions for Linux
  108. */
  109. #ifdef SDL_PLATFORM_LINUX
  110. /**
  111. * Sets the UNIX nice value for a thread.
  112. *
  113. * This uses setpriority() if possible, and RealtimeKit if available.
  114. *
  115. * \param threadID the Unix thread ID to change priority of.
  116. * \param priority The new, Unix-specific, priority value.
  117. * \returns 0 on success, or -1 on error.
  118. *
  119. * \since This function is available since SDL 3.0.0.
  120. */
  121. extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority);
  122. /**
  123. * Sets the priority (not nice level) and scheduling policy for a thread.
  124. *
  125. * This uses setpriority() if possible, and RealtimeKit if available.
  126. *
  127. * \param threadID The Unix thread ID to change priority of.
  128. * \param sdlPriority The new SDL_ThreadPriority value.
  129. * \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR,
  130. * SCHED_OTHER, etc...)
  131. * \returns 0 on success or a negative error code on failure; call
  132. * SDL_GetError() for more information.
  133. *
  134. * \since This function is available since SDL 3.0.0.
  135. */
  136. extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy);
  137. #endif /* SDL_PLATFORM_LINUX */
  138. /*
  139. * Platform specific functions for iOS
  140. */
  141. #ifdef SDL_PLATFORM_IOS
  142. #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
  143. /**
  144. * Use this function to set the animation callback on Apple iOS.
  145. *
  146. * The function prototype for `callback` is:
  147. *
  148. * ```c
  149. * void callback(void* callbackParam);
  150. * ```
  151. *
  152. * Where its parameter, `callbackParam`, is what was passed as `callbackParam`
  153. * to SDL_iPhoneSetAnimationCallback().
  154. *
  155. * This function is only available on Apple iOS.
  156. *
  157. * For more information see:
  158. * https://github.com/libsdl-org/SDL/blob/main/docs/README-ios.md
  159. *
  160. * This functions is also accessible using the macro
  161. * SDL_iOSSetAnimationCallback() since SDL 2.0.4.
  162. *
  163. * \param window the window for which the animation callback should be set
  164. * \param interval the number of frames after which **callback** will be
  165. * called
  166. * \param callback the function to call for every frame.
  167. * \param callbackParam a pointer that is passed to `callback`.
  168. * \returns 0 on success or a negative error code on failure; call
  169. * SDL_GetError() for more information.
  170. *
  171. * \since This function is available since SDL 3.0.0.
  172. *
  173. * \sa SDL_iPhoneSetEventPump
  174. */
  175. extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
  176. #define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
  177. /**
  178. * Use this function to enable or disable the SDL event pump on Apple iOS.
  179. *
  180. * This function is only available on Apple iOS.
  181. *
  182. * This functions is also accessible using the macro SDL_iOSSetEventPump()
  183. * since SDL 2.0.4.
  184. *
  185. * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it
  186. *
  187. * \since This function is available since SDL 3.0.0.
  188. *
  189. * \sa SDL_iPhoneSetAnimationCallback
  190. */
  191. extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
  192. #endif /* SDL_PLATFORM_IOS */
  193. /*
  194. * Platform specific functions for Android
  195. */
  196. #ifdef SDL_PLATFORM_ANDROID
  197. /**
  198. * Get the Android Java Native Interface Environment of the current thread.
  199. *
  200. * This is the JNIEnv one needs to access the Java virtual machine from native
  201. * code, and is needed for many Android APIs to be usable from C.
  202. *
  203. * The prototype of the function in SDL's code actually declare a void* return
  204. * type, even if the implementation returns a pointer to a JNIEnv. The
  205. * rationale being that the SDL headers can avoid including jni.h.
  206. *
  207. * \returns a pointer to Java native interface object (JNIEnv) to which the
  208. * current thread is attached, or 0 on error.
  209. *
  210. * \since This function is available since SDL 3.0.0.
  211. *
  212. * \sa SDL_AndroidGetActivity
  213. */
  214. extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void);
  215. /**
  216. * Retrieve the Java instance of the Android activity class.
  217. *
  218. * The prototype of the function in SDL's code actually declares a void*
  219. * return type, even if the implementation returns a jobject. The rationale
  220. * being that the SDL headers can avoid including jni.h.
  221. *
  222. * The jobject returned by the function is a local reference and must be
  223. * released by the caller. See the PushLocalFrame() and PopLocalFrame() or
  224. * DeleteLocalRef() functions of the Java native interface:
  225. *
  226. * https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html
  227. *
  228. * \returns the jobject representing the instance of the Activity class of the
  229. * Android application, or NULL on error.
  230. *
  231. * \since This function is available since SDL 3.0.0.
  232. *
  233. * \sa SDL_AndroidGetJNIEnv
  234. */
  235. extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void);
  236. /**
  237. * Query Android API level of the current device.
  238. *
  239. * - API level 34: Android 14 (UPSIDE_DOWN_CAKE)
  240. * - API level 33: Android 13 (TIRAMISU)
  241. * - API level 32: Android 12L (S_V2)
  242. * - API level 31: Android 12 (S)
  243. * - API level 30: Android 11 (R)
  244. * - API level 29: Android 10 (Q)
  245. * - API level 28: Android 9 (P)
  246. * - API level 27: Android 8.1 (O_MR1)
  247. * - API level 26: Android 8.0 (O)
  248. * - API level 25: Android 7.1 (N_MR1)
  249. * - API level 24: Android 7.0 (N)
  250. * - API level 23: Android 6.0 (M)
  251. * - API level 22: Android 5.1 (LOLLIPOP_MR1)
  252. * - API level 21: Android 5.0 (LOLLIPOP, L)
  253. * - API level 20: Android 4.4W (KITKAT_WATCH)
  254. * - API level 19: Android 4.4 (KITKAT)
  255. * - API level 18: Android 4.3 (JELLY_BEAN_MR2)
  256. * - API level 17: Android 4.2 (JELLY_BEAN_MR1)
  257. * - API level 16: Android 4.1 (JELLY_BEAN)
  258. * - API level 15: Android 4.0.3 (ICE_CREAM_SANDWICH_MR1)
  259. * - API level 14: Android 4.0 (ICE_CREAM_SANDWICH)
  260. * - API level 13: Android 3.2 (HONEYCOMB_MR2)
  261. * - API level 12: Android 3.1 (HONEYCOMB_MR1)
  262. * - API level 11: Android 3.0 (HONEYCOMB)
  263. * - API level 10: Android 2.3.3 (GINGERBREAD_MR1)
  264. *
  265. * \returns the Android API level.
  266. *
  267. * \since This function is available since SDL 3.0.0.
  268. */
  269. extern DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void);
  270. /**
  271. * Query if the application is running on Android TV.
  272. *
  273. * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise.
  274. *
  275. * \since This function is available since SDL 3.0.0.
  276. */
  277. extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void);
  278. /**
  279. * Query if the application is running on a Chromebook.
  280. *
  281. * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise.
  282. *
  283. * \since This function is available since SDL 3.0.0.
  284. */
  285. extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void);
  286. /**
  287. * Query if the application is running on a Samsung DeX docking station.
  288. *
  289. * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise.
  290. *
  291. * \since This function is available since SDL 3.0.0.
  292. */
  293. extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
  294. /**
  295. * Trigger the Android system back button behavior.
  296. *
  297. * \since This function is available since SDL 3.0.0.
  298. */
  299. extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
  300. /**
  301. See the official Android developer guide for more information:
  302. http://developer.android.com/guide/topics/data/data-storage.html
  303. */
  304. #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
  305. #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
  306. /**
  307. * Get the path used for internal storage for this application.
  308. *
  309. * This path is unique to your application and cannot be written to by other
  310. * applications.
  311. *
  312. * Your internal storage path is typically:
  313. * `/data/data/your.app.package/files`.
  314. *
  315. * \returns the path used for internal storage or NULL on failure; call
  316. * SDL_GetError() for more information.
  317. *
  318. * \since This function is available since SDL 3.0.0.
  319. *
  320. * \sa SDL_AndroidGetExternalStorageState
  321. */
  322. extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void);
  323. /**
  324. * Get the current state of external storage.
  325. *
  326. * The current state of external storage, a bitmask of these values:
  327. * `SDL_ANDROID_EXTERNAL_STORAGE_READ`, `SDL_ANDROID_EXTERNAL_STORAGE_WRITE`.
  328. *
  329. * If external storage is currently unavailable, this will return 0.
  330. *
  331. * \param state filled with the current state of external storage. 0 if
  332. * external storage is currently unavailable.
  333. * \returns 0 on success or a negative error code on failure; call
  334. * SDL_GetError() for more information.
  335. *
  336. * \since This function is available since SDL 3.0.0.
  337. *
  338. * \sa SDL_AndroidGetExternalStoragePath
  339. */
  340. extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(Uint32 *state);
  341. /**
  342. * Get the path used for external storage for this application.
  343. *
  344. * This path is unique to your application, but is public and can be written
  345. * to by other applications.
  346. *
  347. * Your external storage path is typically:
  348. * `/storage/sdcard0/Android/data/your.app.package/files`.
  349. *
  350. * \returns the path used for external storage for this application on success
  351. * or NULL on failure; call SDL_GetError() for more information.
  352. *
  353. * \since This function is available since SDL 3.0.0.
  354. *
  355. * \sa SDL_AndroidGetExternalStorageState
  356. */
  357. extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void);
  358. typedef void (SDLCALL *SDL_AndroidRequestPermissionCallback)(void *userdata, const char *permission, SDL_bool granted);
  359. /**
  360. * Request permissions at runtime, asynchronously.
  361. *
  362. * You do not need to call this for built-in functionality of SDL; recording
  363. * from a microphone or reading images from a camera, using standard SDL APIs,
  364. * will manage permission requests for you.
  365. *
  366. * This function never blocks. Instead, the app-supplied callback will be
  367. * called when a decision has been made. This callback may happen on a
  368. * different thread, and possibly much later, as it might wait on a user to
  369. * respond to a system dialog. If permission has already been granted for a
  370. * specific entitlement, the callback will still fire, probably on the current
  371. * thread and before this function returns.
  372. *
  373. * If the request submission fails, this function returns -1 and the callback
  374. * will NOT be called, but this should only happen in catastrophic conditions,
  375. * like memory running out. Normally there will be a yes or no to the request
  376. * through the callback.
  377. *
  378. * \param permission The permission to request.
  379. * \param cb The callback to trigger when the request has a response.
  380. * \param userdata An app-controlled pointer that is passed to the callback.
  381. * \returns zero if the request was submitted, -1 if there was an error
  382. * submitting. The result of the request is only ever reported
  383. * through the callback, not this return value.
  384. *
  385. * \since This function is available since SDL 3.0.0.
  386. */
  387. extern DECLSPEC int SDLCALL SDL_AndroidRequestPermission(const char *permission, SDL_AndroidRequestPermissionCallback cb, void *userdata);
  388. /**
  389. * Shows an Android toast notification.
  390. *
  391. * Toasts are a sort of lightweight notification that are unique to Android.
  392. *
  393. * https://developer.android.com/guide/topics/ui/notifiers/toasts
  394. *
  395. * Shows toast in UI thread.
  396. *
  397. * For the `gravity` parameter, choose a value from here, or -1 if you don't
  398. * have a preference:
  399. *
  400. * https://developer.android.com/reference/android/view/Gravity
  401. *
  402. * \param message text message to be shown
  403. * \param duration 0=short, 1=long
  404. * \param gravity where the notification should appear on the screen.
  405. * \param xoffset set this parameter only when gravity >=0
  406. * \param yoffset set this parameter only when gravity >=0
  407. * \returns 0 on success or a negative error code on failure; call
  408. * SDL_GetError() for more information.
  409. *
  410. * \since This function is available since SDL 3.0.0.
  411. */
  412. extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int duration, int gravity, int xoffset, int yoffset);
  413. /**
  414. * Send a user command to SDLActivity.
  415. *
  416. * Override "boolean onUnhandledMessage(Message msg)" to handle the message.
  417. *
  418. * \param command user command that must be greater or equal to 0x8000
  419. * \param param user parameter
  420. * \returns 0 on success or a negative error code on failure; call
  421. * SDL_GetError() for more information.
  422. *
  423. * \since This function is available since SDL 3.0.0.
  424. */
  425. extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
  426. #endif /* SDL_PLATFORM_ANDROID */
  427. /*
  428. * Platform specific functions for WinRT
  429. */
  430. #ifdef SDL_PLATFORM_WINRT
  431. /**
  432. * WinRT / Windows Phone path types
  433. */
  434. typedef enum
  435. {
  436. /** The installed app's root directory.
  437. Files here are likely to be read-only. */
  438. SDL_WINRT_PATH_INSTALLED_LOCATION,
  439. /** The app's local data store. Files may be written here */
  440. SDL_WINRT_PATH_LOCAL_FOLDER,
  441. /** The app's roaming data store. Unsupported on Windows Phone.
  442. Files written here may be copied to other machines via a network
  443. connection.
  444. */
  445. SDL_WINRT_PATH_ROAMING_FOLDER,
  446. /** The app's temporary data store. Unsupported on Windows Phone.
  447. Files written here may be deleted at any time. */
  448. SDL_WINRT_PATH_TEMP_FOLDER
  449. } SDL_WinRT_Path;
  450. /**
  451. * WinRT Device Family
  452. */
  453. typedef enum
  454. {
  455. /** Unknown family */
  456. SDL_WINRT_DEVICEFAMILY_UNKNOWN,
  457. /** Desktop family*/
  458. SDL_WINRT_DEVICEFAMILY_DESKTOP,
  459. /** Mobile family (for example smartphone) */
  460. SDL_WINRT_DEVICEFAMILY_MOBILE,
  461. /** XBox family */
  462. SDL_WINRT_DEVICEFAMILY_XBOX,
  463. } SDL_WinRT_DeviceFamily;
  464. /**
  465. * Retrieve a WinRT defined path on the local file system.
  466. *
  467. * Not all paths are available on all versions of Windows. This is especially
  468. * true on Windows Phone. Check the documentation for the given SDL_WinRT_Path
  469. * for more information on which path types are supported where.
  470. *
  471. * Documentation on most app-specific path types on WinRT can be found on
  472. * MSDN, at the URL:
  473. *
  474. * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  475. *
  476. * \param pathType the type of path to retrieve, one of SDL_WinRT_Path
  477. * \returns a UCS-2 string (16-bit, wide-char) containing the path, or NULL if
  478. * the path is not available for any reason; call SDL_GetError() for
  479. * more information.
  480. *
  481. * \since This function is available since SDL 2.0.3.
  482. *
  483. * \sa SDL_WinRTGetFSPathUTF8
  484. */
  485. extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
  486. /**
  487. * Retrieve a WinRT defined path on the local file system.
  488. *
  489. * Not all paths are available on all versions of Windows. This is especially
  490. * true on Windows Phone. Check the documentation for the given SDL_WinRT_Path
  491. * for more information on which path types are supported where.
  492. *
  493. * Documentation on most app-specific path types on WinRT can be found on
  494. * MSDN, at the URL:
  495. *
  496. * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
  497. *
  498. * \param pathType the type of path to retrieve, one of SDL_WinRT_Path
  499. * \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if
  500. * the path is not available for any reason; call SDL_GetError() for
  501. * more information.
  502. *
  503. * \since This function is available since SDL 2.0.3.
  504. *
  505. * \sa SDL_WinRTGetFSPathUNICODE
  506. */
  507. extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
  508. /**
  509. * Detects the device family of WinRT platform at runtime.
  510. *
  511. * \returns a value from the SDL_WinRT_DeviceFamily enum.
  512. *
  513. * \since This function is available since SDL 3.0.0.
  514. */
  515. extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily();
  516. #endif /* SDL_PLATFORM_WINRT */
  517. /**
  518. * Query if the current device is a tablet.
  519. *
  520. * If SDL can't determine this, it will return SDL_FALSE.
  521. *
  522. * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise.
  523. *
  524. * \since This function is available since SDL 3.0.0.
  525. */
  526. extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void);
  527. /* Functions used by iOS app delegates to notify SDL about state changes.
  528. *
  529. * These functions allow iOS apps that have their own event handling to hook
  530. * into SDL to generate SDL events. These map directly to iOS-specific
  531. * events, but since they don't do anything iOS-specific internally, they
  532. * are available on all platforms, in case they might be useful for some
  533. * specific paradigm. Most apps do not need to use these directly; SDL's
  534. * internal event code will handle all this for windows created by
  535. * SDL_CreateWindow!
  536. */
  537. /*
  538. * \since This function is available since SDL 3.0.0.
  539. */
  540. extern DECLSPEC void SDLCALL SDL_OnApplicationWillTerminate(void);
  541. /*
  542. * \since This function is available since SDL 3.0.0.
  543. */
  544. extern DECLSPEC void SDLCALL SDL_OnApplicationDidReceiveMemoryWarning(void);
  545. /*
  546. * \since This function is available since SDL 3.0.0.
  547. */
  548. extern DECLSPEC void SDLCALL SDL_OnApplicationWillResignActive(void);
  549. /*
  550. * \since This function is available since SDL 3.0.0.
  551. */
  552. extern DECLSPEC void SDLCALL SDL_OnApplicationDidEnterBackground(void);
  553. /*
  554. * \since This function is available since SDL 3.0.0.
  555. */
  556. extern DECLSPEC void SDLCALL SDL_OnApplicationWillEnterForeground(void);
  557. /*
  558. * \since This function is available since SDL 3.0.0.
  559. */
  560. extern DECLSPEC void SDLCALL SDL_OnApplicationDidBecomeActive(void);
  561. #ifdef SDL_PLATFORM_IOS
  562. /*
  563. * \since This function is available since SDL 3.0.0.
  564. */
  565. extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void);
  566. #endif
  567. /*
  568. * Functions used only by GDK
  569. */
  570. #ifdef SDL_PLATFORM_GDK
  571. typedef struct XTaskQueueObject *XTaskQueueHandle;
  572. typedef struct XUser *XUserHandle;
  573. /**
  574. * Gets a reference to the global async task queue handle for GDK,
  575. * initializing if needed.
  576. *
  577. * Once you are done with the task queue, you should call
  578. * XTaskQueueCloseHandle to reduce the reference count to avoid a resource
  579. * leak.
  580. *
  581. * \param outTaskQueue a pointer to be filled in with task queue handle.
  582. * \returns 0 on success or a negative error code on failure; call
  583. * SDL_GetError() for more information.
  584. *
  585. * \since This function is available since SDL 3.0.0.
  586. */
  587. extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue);
  588. /**
  589. * Gets a reference to the default user handle for GDK.
  590. *
  591. * This is effectively a synchronous version of XUserAddAsync, which always
  592. * prefers the default user and allows a sign-in UI.
  593. *
  594. * \param outUserHandle a pointer to be filled in with the default user
  595. * handle.
  596. * \returns 0 if success, -1 if any error occurs.
  597. *
  598. * \since This function is available since SDL 2.28.0.
  599. */
  600. extern DECLSPEC int SDLCALL SDL_GDKGetDefaultUser(XUserHandle * outUserHandle);
  601. #endif
  602. /* Ends C function definitions when using C++ */
  603. #ifdef __cplusplus
  604. }
  605. #endif
  606. #include <SDL3/SDL_close_code.h>
  607. #endif /* SDL_system_h_ */