Add functions to fetch various system preferences and accessibility options #11720
+703
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Currently supported (as of opening the PR, will probably be updated):
*The platform supports that option, but I haven't found how to fetch it (no X) or I could support it only partially (X). I would need help to find how I can access them. I've written more details in the "Platform support" section below.
Detecting changes dynamically is also supported across all platforms.
As of opening the PR, not everything is supported. I'm opening the PR early for two reasons:
API design and code organisation
In short, I pretty much copied what I saw about the system theme support. I most likely have made many suboptimal choices in the process.
Currently, I've provided one function that provides each of the boolean options (everything except accent color, font scaling and cursor scaling) and one function to fetch each of the remaining ones.
Is this the best way to organise the code? Some other possibilities I've though about are using an SDL_Properties object (abstracts the types which allows using one function for all, but is more complex to use) and using one function for each (way too many options, which poses a problem for event IDs).
I've also added event types and structures to detect when each option changed. I've split them similarly to their function counterparts: one event type for all boolean values (with a field to carry over which exact setting changed) and one type for each of the other options.
I've organised the code in a similar way to how SDL_SystemTheme was organised, with the only exception that preferences aren't bound to the video driver. Should I bind them to the video driver, or should I organise them differently?
Platform support
As of opening the PR, I support fetching most of the options on Windows, macOS and GNOME.
accent-color
, but it's not available on my Ubuntu 24.04. If someone has a non-GNOME DE and would like to help, please let me know that the signal namespace and keys are for your DE.Existing Issue(s)
Closes #11636