From 258e9d8426347c563424a219a6c3c1045ee0d66f Mon Sep 17 00:00:00 2001 From: Andreas Cord-Landwehr Date: Wed, 26 Apr 2023 21:51:31 +0200 Subject: [PATCH] Extend GLX switch to check if QtGui was being built with GLX plugin Even though epoxy with GLX may be present, Qt's native interface only exposes GLX API when it was being built with GLX support. --- CMakeLists.txt | 7 ++++++- autotests/CMakeLists.txt | 2 +- autotests/opengl_context_attribute_builder_test.cpp | 6 +++--- src/backends/x11/standalone/CMakeLists.txt | 2 +- src/backends/x11/standalone/x11_standalone_backend.cpp | 6 +++--- src/backends/x11/standalone/x11_standalone_glx_backend.cpp | 2 +- src/dbusinterface.cpp | 2 +- src/libkwineffects/kwinconfig.h.cmake | 2 +- src/options.cpp | 2 +- src/workspace.cpp | 4 ++-- 10 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45b6039373..57cdee72e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,7 +367,12 @@ option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON) cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF6Activities_FOUND" OFF) cmake_dependent_option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON "KF6Runner_FOUND" OFF) -set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX}) +set(HAVE_GLX ${epoxy_HAS_GLX}) +get_target_property(QT_DISABLED_FEATURES Qt6::Gui QT_DISABLED_PUBLIC_FEATURES) +if("xcb_glx_plugin" IN_LIST QT_DISABLED_FEATURES) + message(STATUS "Disable GLX because Qt6::Gui was built without xcb_glx_plugin") + set(HAVE_GLX false) +endif() # for kwin internal things set(HAVE_X11_XCB ${X11_XCB_FOUND}) diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index 6e9d33e9cb..772ab4e20f 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -180,7 +180,7 @@ set(testOpenGLContextAttributeBuilder_SRCS opengl_context_attribute_builder_test.cpp ) -if (HAVE_EPOXY_GLX) +if (HAVE_GLX) set(testOpenGLContextAttributeBuilder_SRCS ${testOpenGLContextAttributeBuilder_SRCS} ../src/backends/x11/standalone/x11_standalone_glx_context_attribute_builder.cpp) endif() add_executable(testOpenGLContextAttributeBuilder ${testOpenGLContextAttributeBuilder_SRCS}) diff --git a/autotests/opengl_context_attribute_builder_test.cpp b/autotests/opengl_context_attribute_builder_test.cpp index dad07bc2ba..fcd832ced3 100644 --- a/autotests/opengl_context_attribute_builder_test.cpp +++ b/autotests/opengl_context_attribute_builder_test.cpp @@ -12,7 +12,7 @@ #include #include "libkwineffects/kwinconfig.h" -#if HAVE_EPOXY_GLX +#if HAVE_GLX #include "../src/backends/x11/standalone/x11_standalone_glx_context_attribute_builder.h" #include @@ -387,7 +387,7 @@ void OpenGLContextAttributeBuilderTest::testGles() void OpenGLContextAttributeBuilderTest::testGlx_data() { -#if HAVE_EPOXY_GLX +#if HAVE_GLX QTest::addColumn("requestVersion"); QTest::addColumn("major"); QTest::addColumn("minor"); @@ -442,7 +442,7 @@ void OpenGLContextAttributeBuilderTest::testGlx_data() void OpenGLContextAttributeBuilderTest::testGlx() { -#if HAVE_EPOXY_GLX +#if HAVE_GLX QFETCH(bool, requestVersion); QFETCH(int, major); QFETCH(int, minor); diff --git a/src/backends/x11/standalone/CMakeLists.txt b/src/backends/x11/standalone/CMakeLists.txt index 79f93c12ff..53fb8d1464 100644 --- a/src/backends/x11/standalone/CMakeLists.txt +++ b/src/backends/x11/standalone/CMakeLists.txt @@ -24,7 +24,7 @@ if (X11_Xi_FOUND) target_link_libraries(KWinX11Platform X11::Xi) endif() -if (HAVE_EPOXY_GLX) +if (HAVE_GLX) target_sources(KWinX11Platform PRIVATE x11_standalone_glx_backend.cpp x11_standalone_glx_context_attribute_builder.cpp diff --git a/src/backends/x11/standalone/x11_standalone_backend.cpp b/src/backends/x11/standalone/x11_standalone_backend.cpp index 2dd778f024..17a81c75c8 100644 --- a/src/backends/x11/standalone/x11_standalone_backend.cpp +++ b/src/backends/x11/standalone/x11_standalone_backend.cpp @@ -15,7 +15,7 @@ #include "x11_standalone_edge.h" #include "x11_standalone_placeholderoutput.h" #include "x11_standalone_windowselector.h" -#if HAVE_EPOXY_GLX +#if HAVE_GLX #include "x11_standalone_glx_backend.h" #endif #if HAVE_X11_XINPUT @@ -156,7 +156,7 @@ bool X11StandaloneBackend::initialize() std::unique_ptr X11StandaloneBackend::createOpenGLBackend() { switch (options->glPlatformInterface()) { -#if HAVE_EPOXY_GLX +#if HAVE_GLX case GlxPlatformInterface: if (hasGlx()) { return std::make_unique(m_x11Display, this); @@ -258,7 +258,7 @@ void X11StandaloneBackend::createEffectsHandler(Compositor *compositor, Workspac QVector X11StandaloneBackend::supportedCompositors() const { QVector compositors; -#if HAVE_EPOXY_GLX +#if HAVE_GLX compositors << OpenGLCompositing; #endif compositors << NoCompositing; diff --git a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp index faa5374941..ba81ac0cda 100644 --- a/src/backends/x11/standalone/x11_standalone_glx_backend.cpp +++ b/src/backends/x11/standalone/x11_standalone_glx_backend.cpp @@ -175,7 +175,7 @@ typedef void (*glXFuncPtr)(); static glXFuncPtr getProcAddress(const char *name) { glXFuncPtr ret = nullptr; -#if HAVE_EPOXY_GLX +#if ENABLE_GLX ret = glXGetProcAddress((const GLubyte *)name); #endif #if HAVE_DL_LIBRARY diff --git a/src/dbusinterface.cpp b/src/dbusinterface.cpp index a794534703..b8486d0af3 100644 --- a/src/dbusinterface.cpp +++ b/src/dbusinterface.cpp @@ -336,7 +336,7 @@ QStringList CompositorDBusInterface::supportedOpenGLPlatformInterfaces() const { QStringList interfaces; bool supportsGlx = false; -#if HAVE_EPOXY_GLX +#if HAVE_GLX supportsGlx = (kwinApp()->operationMode() == Application::OperationModeX11); #endif if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGLES) { diff --git a/src/libkwineffects/kwinconfig.h.cmake b/src/libkwineffects/kwinconfig.h.cmake index 0f65da0bdc..b56c6b2c07 100644 --- a/src/libkwineffects/kwinconfig.h.cmake +++ b/src/libkwineffects/kwinconfig.h.cmake @@ -18,7 +18,7 @@ */ -#cmakedefine01 HAVE_EPOXY_GLX +#cmakedefine01 HAVE_GLX #cmakedefine01 HAVE_DL_LIBRARY diff --git a/src/options.cpp b/src/options.cpp index 541ab563db..0e9147317c 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -688,7 +688,7 @@ void Options::setGlPlatformInterface(OpenGLPlatformInterface interface) qCDebug(KWIN_CORE) << "Forcing EGL native interface for Wayland mode"; interface = EglPlatformInterface; } -#if !HAVE_EPOXY_GLX +#if !HAVE_GLX qCDebug(KWIN_CORE) << "Forcing EGL native interface as compiled without GLX support"; interface = EglPlatformInterface; #endif diff --git a/src/workspace.cpp b/src/workspace.cpp index 36910d970d..14f0f88ebf 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -1633,8 +1633,8 @@ QString Workspace::supportInformation() const support.append(KWIN_BUILD_ACTIVITIES ? yes : no); support.append(QStringLiteral("HAVE_X11_XCB: ")); support.append(HAVE_X11_XCB ? yes : no); - support.append(QStringLiteral("HAVE_EPOXY_GLX: ")); - support.append(HAVE_EPOXY_GLX ? yes : no); + support.append(QStringLiteral("HAVE_GLX: ")); + support.append(HAVE_GLX ? yes : no); support.append(QStringLiteral("\n")); if (auto c = kwinApp()->x11Connection()) {