浏览代码

frontend: Use winId for Wayland surface in Qt 6.9+

As of Qt 6.9, winId return a wl_surface pointer which allows us to move
away completely from QPlatformNativeInterface.

https://github.com/qt/qtwayland/commit/32f9b4d
tytan652 6 月之前
父节点
当前提交
b65ee89451
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      frontend/widgets/OBSQTDisplay.cpp

+ 6 - 0
frontend/widgets/OBSQTDisplay.cpp

@@ -10,8 +10,10 @@
 #include <QWindow>
 #ifdef ENABLE_WAYLAND
 #include <QApplication>
+#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
 #include <qpa/qplatformnativeinterface.h>
 #endif
+#endif
 
 #ifdef _WIN32
 #define WIN32_LEAN_AND_MEAN
@@ -50,8 +52,12 @@ static bool QTToGSWindow(QWindow *window, gs_window &gswindow)
 		break;
 #ifdef ENABLE_WAYLAND
 	case OBS_NIX_PLATFORM_WAYLAND: {
+#if QT_VERSION < QT_VERSION_CHECK(6, 9, 0)
 		QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
 		gswindow.display = native->nativeResourceForWindow("surface", window);
+#else
+		gswindow.display = (void *)window->winId();
+#endif
 		success = gswindow.display != nullptr;
 		break;
 	}