Put the GLX related code under the xcb_glx_plugin condition

If the xcb-glx-plugin feature is not enabled we should not compile
classes and methods that use the GLX related code of the
QOffscreenIntegrationPlugin.

Pick-to: 6.1 6.0
Change-Id: I63eff9d0a2afc1bc1fa21ee1b49f854f13b94c93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Alexey Edelev 2021-05-06 14:02:16 +02:00
parent 175e3ac8fa
commit 11ae678b9d
2 changed files with 10 additions and 3 deletions

View File

@ -88,6 +88,7 @@ bool QOffscreenX11Integration::hasCapability(QPlatformIntegration::Capability ca
}
}
#if !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin)
QPlatformOpenGLContext *QOffscreenX11Integration::createPlatformOpenGLContext(QOpenGLContext *context) const
{
auto &connection = nativeInterface()->m_connection;
@ -100,6 +101,7 @@ QPlatformOpenGLContext *QOffscreenX11Integration::createPlatformOpenGLContext(QO
return new QOffscreenX11GLXContext(connection->x11Info(), context);
}
#endif // !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin)
QOffscreenX11PlatformNativeInterface *QOffscreenX11Integration::nativeInterface() const
{
@ -121,7 +123,7 @@ void *QOffscreenX11PlatformNativeInterface::nativeResourceForScreen(const QByteA
return nullptr;
}
#ifndef QT_NO_OPENGL
#if !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin)
void *QOffscreenX11PlatformNativeInterface::nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) {
if (resource.toLower() == QByteArrayLiteral("glxconfig") ) {
if (context) {
@ -164,6 +166,7 @@ QOffscreenX11Info *QOffscreenX11Connection::x11Info()
return m_x11Info.data();
}
#if QT_CONFIG(xcb_glx_plugin)
class QOffscreenX11GLXContextData
{
public:
@ -311,5 +314,5 @@ void *QOffscreenX11GLXContext::glxConfig() const
{
return d->config;
}
#endif // QT_CONFIG(xcb_glx_plugin)
QT_END_NAMESPACE

View File

@ -59,7 +59,7 @@ public:
~QOffscreenX11PlatformNativeInterface();
void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
#ifndef QT_NO_OPENGL
#if !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin)
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
#endif
@ -72,7 +72,9 @@ public:
~QOffscreenX11Integration();
bool hasCapability(QPlatformIntegration::Capability cap) const override;
#if !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin)
QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
#endif
QOffscreenX11PlatformNativeInterface *nativeInterface() const override;
};
@ -93,6 +95,7 @@ private:
QScopedPointer<QOffscreenX11Info> m_x11Info;
};
#if QT_CONFIG(xcb_glx_plugin)
class QOffscreenX11GLXContextData;
class QOffscreenX11GLXContext : public QPlatformOpenGLContext
@ -119,6 +122,7 @@ public:
private:
QScopedPointer<QOffscreenX11GLXContextData> d;
};
#endif // QT_CONFIG(xcb_glx_plugin)
QT_END_NAMESPACE