@@ -570,6 +570,131 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetCurrentVideoDriver(void);
570
570
*/
571
571
extern SDL_DECLSPEC SDL_SystemTheme SDLCALL SDL_GetSystemTheme (void );
572
572
573
+ /**
574
+ * An enumeration of various boolean system preferences.
575
+ *
576
+ * Some systems provide a variety of accessibility options that allow users to
577
+ * adapt their environment to various conditions.
578
+ *
579
+ * The preference names have been chosen so that `true` indicate a positive
580
+ * preference, whereas `false` indicate no preference. Some systems describe
581
+ * their preferences negatively, like "Enable animations" on Windows, which is
582
+ * `true` by default (no preference) and `false` when the user wants to disable
583
+ * animations. In these situations, SDL inverts the preferences so that `false`
584
+ * correspond to the situation where no particular change is needed.
585
+ *
586
+ * \since This enum is available since SDL 3.4.0.
587
+ *
588
+ * \sa SDL_GetSystemPreference
589
+ */
590
+ typedef enum SDL_SystemPreference
591
+ {
592
+ SDL_SYSTEM_PREFERENCE_REDUCED_MOTION , /**< Disable smooth graphical transitions */
593
+ SDL_SYSTEM_PREFERENCE_REDUCED_TRANSPARENCY , /**< Reduce usage of semi-transparent objects */
594
+ SDL_SYSTEM_PREFERENCE_HIGH_CONTRAST , /**< Use extreme color differences between different elements of the interface */
595
+ SDL_SYSTEM_PREFERENCE_COLORBLIND , /**< Add shape-based distinction between color-coded elements, for example "0" and "1" on switches */
596
+ SDL_SYSTEM_PREFERENCE_PERSIST_SCROLLBARS , /**< Always show scrollbars, don't hide them after a few seconds of inactivity */
597
+ SDL_SYSTEM_PREFERENCE_SCREEN_READER , /**< A screen reader (text-to-speech OR braille) is currently active */
598
+ } SDL_SystemPreference ;
599
+
600
+ /**
601
+ * Get whether or not a certain system preference was enabled by the user.
602
+ *
603
+ * Some preferences may not be supported on some platforms; this function will
604
+ * return false by default in this case. The preference names have been chosen
605
+ * so that `true` indicate a positive preference, whereas `false` indicate no
606
+ * preference.
607
+ *
608
+ * This setting will emit a `SDL_EVENT_SYSTEM_PREFERENCE_CHANGED` when the user
609
+ * updates the corresponding preference in their settings or accessibility app.
610
+ * Note that some platforms may provide certain settings, but not allow
611
+ * listening to changes; as such, there may be certain preferences that can be
612
+ * fetched but that won't produce events when they are changed.
613
+ *
614
+ * \param preference the preference to be fetched.
615
+ * \returns true if the user enabled the system preference; false if the user
616
+ * did not activate the setting, or the setting doesn't exist on the
617
+ * current platform, or an error occured.
618
+ *
619
+ * \threadsafety This function should only be called on the main thread.
620
+ *
621
+ * \since This function is available since SDL 3.4.0.
622
+ *
623
+ * \sa SDL_SystemPreference
624
+ * \sa SDL_PreferenceEvent
625
+ */
626
+ extern SDL_DECLSPEC bool SDLCALL SDL_GetSystemPreference (SDL_SystemPreference preference );
627
+
628
+ /**
629
+ * Get the system's accent color, as chosen by the user.
630
+ *
631
+ * If the current system does not have an accent color, false is returned and
632
+ * the struct is unaffected.
633
+ *
634
+ * This setting will emit a `SDL_EVENT_SYSTEM_ACCENT_COLOR_CHANGED` when the
635
+ * user updates the corresponding preference in their settings or accessibility
636
+ * app. Note that some platforms may provide certain settings, but not allow
637
+ * listening to changes; as such, there may be certain preferences that can be
638
+ * fetched but that won't produce events when they are changed.
639
+ *
640
+ * \param color a pointer to a struct to be filled with the color info. The
641
+ * alpha channel corresponds to the value returned by operating
642
+ * system, which is not necessarily equivalent to SDL_ALPHA_OPAQUE.
643
+ * \returns true on success or false on failure; call SDL_GetError() for more
644
+ * information.
645
+ *
646
+ * \threadsafety This function should only be called on the main thread.
647
+ *
648
+ * \since This function is available since SDL 3.4.0.
649
+ */
650
+ extern SDL_DECLSPEC bool SDLCALL SDL_GetSystemAccentColor (SDL_Color * color );
651
+
652
+ /**
653
+ * Get the scale factor for text, as set by the user for their system.
654
+ *
655
+ * Some systems do not have a notion of text scale factor, but instead provide
656
+ * a base font size. In this case, SDL calculates a scaling factor by dividing
657
+ * the given font size by 16 pixels.
658
+ *
659
+ * If the system does not have a setting to scale the font, 1 is returned.
660
+ *
661
+ * This setting will emit a `SDL_EVENT_SYSTEM_TEXT_SCALE_CHANGED` when the user
662
+ * updates the corresponding preference in their settings or accessibility app.
663
+ * Note that some platforms may provide certain settings, but not allow
664
+ * listening to changes; as such, there may be certain preferences that can be
665
+ * fetched but that won't produce events when they are changed.
666
+ *
667
+ * \returns the preferred scale for text; a scale of 1 means no scaling.
668
+ *
669
+ * \threadsafety This function should only be called on the main thread.
670
+ *
671
+ * \since This function is available since SDL 3.4.0.
672
+ */
673
+ extern SDL_DECLSPEC float SDLCALL SDL_GetSystemTextScale (void );
674
+
675
+ /**
676
+ * Get the scale factor for the cursor, as set by the user for their system.
677
+ *
678
+ * Some systems do not have a notion of cursor scale factor, but instead provide
679
+ * a base cursor size. In this case, SDL calculates a scaling factor by dividing
680
+ * the given cursor lateral size by 32 pixels.
681
+ *
682
+ * If the system does not have a setting to scale the cursor, 1 is returned.
683
+ *
684
+ * This setting will emit a `SDL_EVENT_SYSTEM_CURSOR_SCALE_CHANGED` when the
685
+ * user updates the corresponding preference in their settings or accessibility
686
+ * app. Note that some platforms may provide certain settings, but not allow
687
+ * listening to changes; as such, there may be certain preferences that can be
688
+ * fetched but that won't produce events when they are changed.
689
+ *
690
+ * \returns the preferred scale for the cursor; a scale of 1 means no scaling.
691
+ *
692
+ * \threadsafety This function should only be called on the main thread.
693
+ *
694
+ * \since This function is available since SDL 3.4.0.
695
+ */
696
+ extern SDL_DECLSPEC float SDLCALL SDL_GetSystemCursorScale (void );
697
+
573
698
/**
574
699
* Get a list of currently connected displays.
575
700
*
0 commit comments