From 8b5061aae70d5eef7332677bfd78baab4247dcdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 18 Sep 2020 11:55:12 +0200 Subject: [PATCH] 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 413ff7938df54c6c0bf6dc3ecd86c2c713f6f43a) --- platform/x11/os_x11.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 5a71131d86d..c32afab35c1 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -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); if (!xrandr_handle) { err = dlerror(); - fprintf(stderr, "could not load libXrandr.so.2, Error: %s\n", err); + // 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); + } } else { XRRQueryVersion(x11_display, &xrandr_major, &xrandr_minor); if (((xrandr_major << 8) | xrandr_minor) >= 0x0105) {