瀏覽代碼

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)
Rémi Verschelde 5 年之前
父節點
當前提交
8b5061aae7
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      platform/x11/os_x11.cpp

+ 6 - 1
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) {