-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
SDL3: The "SDL_VIDEODRIVER" environment variable should be supported as a fallback #11115
Milestone
Comments
Implementation of this: #11120 Not 100% sure if this is the best way to implement this, but I think doing this at all (before the first official) SDL3 release does make a lot of sense, and at least my solution is simple ;) |
DanielGibson
added a commit
to DanielGibson/SDL
that referenced
this issue
Oct 12, 2024
…dl-org#11115 especially SDL_VIDEODRIVER is commonly used to use the native Wayland backend, so I think it's a good idea to keep supporting the old name instead of forcing users to find out that they now have to add an underscore.. Not sure how popular SDL_AUDIODRIVER is, but with all the audio backends that exist on Linux alone I'm sure some people use it to work around sound issues. Note: Doing this in the SDL_hints implementation instead of the call-sites of SDL_GetHint(SDL_HINT_VIDEO_DRIVER) etc ensures that 1. Hint priorities work (env var overriding hint set by application with normal priority, but not when application used SDL_HINT_OVERRIDE) 2. SDL_ResetHint() (called by user code) respects the fallback environment variable
slouken
pushed a commit
that referenced
this issue
Oct 12, 2024
especially SDL_VIDEODRIVER is commonly used to use the native Wayland backend, so I think it's a good idea to keep supporting the old name instead of forcing users to find out that they now have to add an underscore.. Not sure how popular SDL_AUDIODRIVER is, but with all the audio backends that exist on Linux alone I'm sure some people use it to work around sound issues. Note: Doing this in the SDL_hints implementation instead of the call-sites of SDL_GetHint(SDL_HINT_VIDEO_DRIVER) etc ensures that 1. Hint priorities work (env var overriding hint set by application with normal priority, but not when application used SDL_HINT_OVERRIDE) 2. SDL_ResetHint() (called by user code) respects the fallback environment variable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Users are trained to use
SDL_VIDEODRIVER=wayland
for native Wayland support.Renaming that env var to
SDL_VIDEO_DRIVER
breaks this.As SDL3 is ABI-stable now it's probably too late to undo the renaming, but if the
SDL_VIDEO_DRIVER
env var isn't set it could (should!) still fall back toSDL_VIDEODRIVER
.Probably same for SDL_AUDIODRIVER/SDL_AUDIO_DRIVER.
I briefly looked at the code and am not sure how to best implement this: Hardcode the case in
SDL_Get_Hint()
and friends (if(result == NULL && strcmp(name, SDL_HINT_VIDEO_DRIVER) == 0) result = SDL_getenv("SDL_VIDEODRIVER");
), or somehow handle this in the callers ofSDL_GetHint(SDL_VIDEO_DRIVER)
?The latter is probably harder to do correctly if I want to respect hint priorities..
By the way, the (public) Hint API is missing a getter for a hints priority.
The text was updated successfully, but these errors were encountered: