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