Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose OS accessibility preferences? #11636

Open
Semphriss opened this issue Dec 12, 2024 · 3 comments
Open

Expose OS accessibility preferences? #11636

Semphriss opened this issue Dec 12, 2024 · 3 comments
Milestone

Comments

@Semphriss
Copy link
Contributor

There exists SDL_GetSystemTheme for light/dark theme; would it be good to add similar options for some accessibility settings? Some ideas based on what my OS provides: Reduced motion; high contrast; shape-based replacement for color coding (for colorblind users); preferred text/cursor scaling.

I'm suggesting this to discuss whether such features would be within the scope of SDL, but also whether those things are reasonably implementable across platforms.

@icculus
Copy link
Collaborator

icculus commented Dec 13, 2024

I think most platforms can't offer this information, but if you want to play around with it, I think it'd be cool to offer it in the API.

@slouken slouken added this to the 3.x milestone Dec 13, 2024
@Semphriss
Copy link
Contributor Author

I was curious about the feasability of this, and so far, I've found the following:

  • Windows offers SystemParametersInfoA with SPI_GETCLIENTAREAANIMATION (reduced motion), SPI_GETHIGHCONTRAST and SPI_GETSCREENREADER among other options.
  • For macOS, there's dagronf/DSFAppearanceManager that offers a plethora of functions, including reduced motion, high contrast and various theme-related settings.
  • For GNOME, there is the D-Bus setting enable-animations on org.gnome.desktop.interface. Presumably, the other settings have a similar interface, and other desktop environments have something equivalent.
  • Android has Settings.Global.WINDOW_ANIMATION_SCALE and two others. I did not yet check for other options.
  • iOS has UIAccessibility.isReduceMotionEnabled and various other options (contrast, grayscale, text-to-speech, labeled tickboxes...) under the same class.

I'll try to come up with a first implementation after the system tray PR will be done.

@OrichalcumCosmonaut
Copy link
Contributor

Linux also has org.freedesktop.portal.Settings, which has the colour scheme, preferred contrast, and an accent colour. Looks like it’s already being used for the colour scheme:

#define PORTAL_DESTINATION "org.freedesktop.portal.Desktop"
#define PORTAL_PATH "/org/freedesktop/portal/desktop"
#define PORTAL_INTERFACE "org.freedesktop.portal.Settings"
#define PORTAL_METHOD "Read"
#define SIGNAL_INTERFACE "org.freedesktop.portal.Settings"
#define SIGNAL_NAMESPACE "org.freedesktop.appearance"
#define SIGNAL_NAME "SettingChanged"
#define SIGNAL_KEY "color-scheme"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants