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