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