diff options
author | Michal Klocek <michal.klocek@qt.io> | 2021-10-19 13:07:12 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2021-10-21 13:39:53 +0200 |
commit | e2fc3246d24e2b3a64ec2005e51efae88cbdc32e (patch) | |
tree | 89255a1372e3bda9b7b702b7f70ecde38f3645d3 /src/plugins | |
parent | 54576b3dd9990a62434cfb805b2f9158e3eaf8c4 (diff) |
Make QOffscreenX11PlatformNativeInterface a QX11Application
Make it possible to use new native interface QX11Application with
offscreen plugin in case of x11, which technically is
x11 application without xcb connection.
This change is motivated by use of new native interface
in webengine, where offscreen plugin is used for
some tests.
Pick-to: 6.2
Change-Id: Ic2ed5b39573062feaa1e8985962d5d9327b371d7
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp | 7 | ||||
-rw-r--r-- | src/plugins/platforms/offscreen/qoffscreenintegration_x11.h | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp index 3c2fdb1f0f..0bb19bc4f6 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp @@ -155,6 +155,13 @@ void *QOffscreenX11PlatformNativeInterface::nativeResourceForContext(const QByte } #endif +#if QT_CONFIG(xcb) +Display *QOffscreenX11PlatformNativeInterface::display() const +{ + return m_connection ? reinterpret_cast<Display *>(m_connection->display()) : nullptr; +} +#endif + QOffscreenX11Connection::QOffscreenX11Connection() { XInitThreads(); diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h index afd30d7b4b..35c91d47d8 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h +++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h @@ -47,6 +47,7 @@ #include <qscopedpointer.h> #include <qpa/qplatformopenglcontext.h> +#include <QtGui/qguiapplication.h> QT_BEGIN_NAMESPACE @@ -54,6 +55,9 @@ class QOffscreenX11Connection; class QOffscreenX11Info; class QOffscreenX11PlatformNativeInterface : public QOffscreenPlatformNativeInterface +#if QT_CONFIG(xcb) + , public QNativeInterface::QX11Application +#endif { public: QOffscreenX11PlatformNativeInterface(QOffscreenIntegration *integration); @@ -63,7 +67,10 @@ public: #if !defined(QT_NO_OPENGL) && QT_CONFIG(xcb_glx_plugin) void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override; #endif - +#if QT_CONFIG(xcb) + Display *display() const override; + xcb_connection_t *connection() const override { return nullptr; }; +#endif QScopedPointer<QOffscreenX11Connection> m_connection; }; |