X11: Try to load libXrandr.so.3 if libXrandr.so.2 isn't found

All Linux distros, and FreeBSD and OpenBSD seem to have libXrandr.so.2,
but for some reason recent NetBSD versions seem to have libXrandr.so.3 now.

(cherry picked from commit 413ff7938d)
This commit is contained in:
Rémi Verschelde 2020-09-18 11:55:12 +02:00
parent b73a9109ab
commit 8b5061aae7
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 1 deletions

View File

@ -163,7 +163,12 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
xrandr_handle = dlopen("libXrandr.so.2", RTLD_LAZY); xrandr_handle = dlopen("libXrandr.so.2", RTLD_LAZY);
if (!xrandr_handle) { if (!xrandr_handle) {
err = dlerror(); err = dlerror();
// For some arcane reason, NetBSD now ships libXrandr.so.3 while the rest of the world has libXrandr.so.2...
// In case this happens for other X11 platforms in the future, let's give it a try too before failing.
xrandr_handle = dlopen("libXrandr.so.3", RTLD_LAZY);
if (!xrandr_handle) {
fprintf(stderr, "could not load libXrandr.so.2, Error: %s\n", err); fprintf(stderr, "could not load libXrandr.so.2, Error: %s\n", err);
}
} else { } else {
XRRQueryVersion(x11_display, &xrandr_major, &xrandr_minor); XRRQueryVersion(x11_display, &xrandr_major, &xrandr_minor);
if (((xrandr_major << 8) | xrandr_minor) >= 0x0105) { if (((xrandr_major << 8) | xrandr_minor) >= 0x0105) {