mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-03 17:15:46 +00:00
Use the X11 driver if the application uses X11-based graphics frameworks
Fixes https://github.com/libsdl-org/SDL/issues/8812
This commit is contained in:
parent
2afd04d09b
commit
bd2f1e9ea6
|
@ -61,6 +61,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
/* Available video drivers */
|
||||
|
@ -468,6 +469,28 @@ int SDL_VideoInit(const char *driver_name)
|
|||
if (!driver_name) {
|
||||
driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER);
|
||||
}
|
||||
#ifdef __LINUX__
|
||||
if (!driver_name) {
|
||||
/* See if it looks like we need X11 */
|
||||
SDL_bool force_x11 = SDL_FALSE;
|
||||
void *global_symbols = dlopen(NULL, RTLD_LOCAL|RTLD_NOW);
|
||||
|
||||
/* Use linked libraries to detect what quirks we are likely to need */
|
||||
if (global_symbols != NULL) {
|
||||
if (dlsym(global_symbols, "glxewInit") != NULL) { /* GLEW (e.g. Frogatto, SLUDGE) */
|
||||
force_x11 = SDL_TRUE;
|
||||
} else if (dlsym(global_symbols, "cgGLEnableProgramProfiles") != NULL) { /* NVIDIA Cg (e.g. Awesomenauts, Braid) */
|
||||
force_x11 = SDL_TRUE;
|
||||
} else if (dlsym(global_symbols, "_Z7ssgInitv") != NULL) { /* ::ssgInit(void) in plib (e.g. crrcsim) */
|
||||
force_x11 = SDL_TRUE;
|
||||
}
|
||||
dlclose(global_symbols);
|
||||
}
|
||||
if (force_x11) {
|
||||
driver_name = "x11";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (driver_name && *driver_name != 0) {
|
||||
const char *driver_attempt = driver_name;
|
||||
while (driver_attempt && *driver_attempt != 0 && !video) {
|
||||
|
|
Loading…
Reference in a new issue