SDL_system.h 20 KB

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