SDL_system.h 26 KB

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