File dialog improvements

- Add a globally-accessible function to handle the parsing of filter extensions
- Remove the ability of putting the wildcard ('*') among other patterns; it's either a list of patterns or a single '*' now
- Add a hint to select between portals and Zenity on Unix
This commit is contained in:
Semphris
2024-04-02 16:03:58 -04:00
committed by Sam Lantinga
parent 5fa87e29e7
commit 6ad390fc50
18 changed files with 501 additions and 125 deletions

View File

@@ -37,7 +37,9 @@ extern "C" {
* `name` is a user-readable label for the filter (for example, "Office document").
*
* `pattern` is a semicolon-separated list of file extensions (for example,
* "doc;docx").
* "doc;docx"). File extensions may only contain alphanumeric characters,
* hyphens, underscores and periods. Alternatively, the whole string can be a
* single asterisk ("*"), which serves as an "All files" filter.
*
* \sa SDL_DialogFileCallback
* \sa SDL_ShowOpenFileDialog

View File

@@ -414,6 +414,26 @@ extern "C" {
*/
#define SDL_HINT_JOYSTICK_DIRECTINPUT "SDL_JOYSTICK_DIRECTINPUT"
/**
* A variable that specifies a dialog backend to use.
*
* By default, SDL will try all available dialog backends in a reasonable order until it finds one that can work, but this hint allows the app or user to force a specific target.
*
* If the specified target does not exist or is not available, the dialog-related function calls will fail.
*
* This hint currently only applies to platforms using the generic "Unix" dialog implementation, but may be extended to more platforms in the future. Note that some Unix and Unix-like platforms have their own implementation, such as macOS and Haiku.
*
* The variable can be set to the following values:
* NULL - Select automatically (default, all platforms)
* "portal" - Use XDG Portals through DBus (Unix only)
* "zenity" - Use the Zenity program (Unix only)
*
* More options may be added in the future.
*
* This hint can be set anytime.
*/
#define SDL_HINT_FILE_DIALOG_DRIVER "SDL_FILE_DIALOG_DRIVER"
/**
* Override for SDL_GetDisplayUsableBounds()
*