SDL_system.h 24 KB

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