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

Add SDL_ShowFileDialogWithProperties with some more options #11170

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Semphriss
Copy link
Contributor

Description

  • I've added a new function to create dialogs with properties: SDL_ShowFileDialogWithProperties. There is only one function for all dialog types; I've added an enum called SDL_FileDialogType instead.
  • The old functions are now wrappers around SDL_ShowFileDialogWithProperties. This significantly simplifies the implementation on multiple platforms, which basically just regrouped all functions into one with different parameters.
  • I've added three new options: setting the dialog's title, the accept button's label and the cancel button's label.
  • I've fixed a few bugs and cleaned up the code a bit:
    • Zenity does, in fact, support modal dialogs. One just has to check the extended help for more options and discover the amazing(-ly poorly documented) --attach option. The only issue is that it supports only X11, so no Wayland support still.
    • Some code turned ugly with the boolean changes (think "if (mybool == true) { return true; } else { return false; }") so I cleaned that up where I saw it ("return mybool;").
    • I fixed up the documentation, specifically about threading and object lifetime.
    • Zenity now asks for confirmation before overwriting a file.

While deciding the names of the properties, I noticed that some boolean properties are typed as SDL_PROP_..._BOOL and others as SDL_PROP_..._BOOLEAN (RIP about the ABI freeze). I followed the second format, which seems to be more common.

Existing Issue(s)

Closes #11133


I'd like to commend the only platform that supports every dialog option: Haiku (!). A close second is Zenity (!!), which managed to find the way to support everything as well, even modal dialogs, but only partially because it lacks Wayland support so I count it as half a point. Every other platform lacks at least one option completely: macOS and XDG Portals don't allow labeling the cancel button, Windows doesn't (I believe) allow labeling either button, and Android neither buttons nor dialog title, and no folder support at all as well (though those are probably not just relevant to the platform).

@Semphriss
Copy link
Contributor Author

It seems that the only build issues that remain are platform-specific build files. Are there instructions on how to update/refresh them? If possible, I'd like to learn the steps, so that I don't have to ask someone else to do it for me each time.

@slouken
Copy link
Collaborator

slouken commented Dec 4, 2024

@Semphriss, can you rebase this PR? We'd like to merge it for 3.2.0.

Thanks!

@Semphriss
Copy link
Contributor Author

Done!

@slouken
Copy link
Collaborator

slouken commented Dec 4, 2024

It looks like you need to update Android.mk and the Visual Studio projects?

@Semphriss
Copy link
Contributor Author

Indeed; are there instructions on how to do that? I must admit I've never done that for any PR until today...

@slouken
Copy link
Collaborator

slouken commented Dec 4, 2024

Edit Android.mk, add the new file in the sorted list.
Grep for another similar source file in the VisualC* directories and add it sorted to the places you find there.
Here's an example of places you'd need to update for the VisualC directories: a923771

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

Successfully merging this pull request may close these issues.

SDL3: cannot set file dialog caption
2 participants