diff options
author | Louai Al-Khanji <louai.al-khanji@qt.io> | 2017-01-06 15:15:54 -0800 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2017-04-21 10:56:02 +0000 |
commit | 07942adb77f60738a6043665673d51fc7991233b (patch) | |
tree | 6a94958d0b02d7b2149fa00b1047297370737831 /src/plugins/platforms/xcb/qxcbintegration.cpp | |
parent | 7be9653f1288d32bc732262b01ba910f6a321ecd (diff) |
xcb: Add experimental legacy support for native X11 painting
This commit revives the old native QPixmap and QPaintEngine
implementations that were present in Qt4. The backing store supports
regular raster windows in this commit. Support for render-to-texture
widgets and OpenGL compositing will be added in a follow-up commit.
Change-Id: I80a9c4f0c42a6f68f571dfee930d95000d5dd950
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbintegration.cpp')
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 396d8837e9..da7ce9bb17 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -65,6 +65,11 @@ #ifdef XCB_USE_XLIB #include <X11/Xlib.h> +#if QT_CONFIG(xcb_native_painting) +#include "qxcbnativepainting.h" +#include "qpixmap_x11_p.h" +#include "qbackingstore_x11_p.h" +#endif #endif #include <qpa/qplatforminputcontextfactory_p.h> @@ -192,6 +197,13 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char } m_fontDatabase.reset(new QGenericUnixFontDatabase()); + +#if QT_CONFIG(xcb_native_painting) + if (nativePaintingEnabled()) { + qDebug("QXCB USING NATIVE PAINTING"); + qt_xcb_native_x11_info_init(defaultConnection()); + } +#endif } QXcbIntegration::~QXcbIntegration() @@ -200,6 +212,16 @@ QXcbIntegration::~QXcbIntegration() m_instance = Q_NULLPTR; } +QPlatformPixmap *QXcbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const +{ +#if QT_CONFIG(xcb_native_painting) + if (nativePaintingEnabled()) + return new QX11PlatformPixmap(type); +#endif + + return QPlatformIntegration::createPlatformPixmap(type); +} + QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const { QXcbScreen *screen = static_cast<QXcbScreen *>(window->screen()->handle()); @@ -263,6 +285,11 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *window) const { +#if QT_CONFIG(xcb_native_painting) + if (nativePaintingEnabled()) + return new QXcbNativeBackingStore(window); +#endif + return new QXcbBackingStore(window); } @@ -511,6 +538,16 @@ void QXcbIntegration::beep() const xcb_bell(connection, 0); } +bool QXcbIntegration::nativePaintingEnabled() const +{ +#if QT_CONFIG(xcb_native_painting) + static bool enabled = qEnvironmentVariableIsSet("QT_XCB_NATIVE_PAINTING"); + return enabled; +#else + return false; +#endif +} + #if QT_CONFIG(vulkan) QPlatformVulkanInstance *QXcbIntegration::createPlatformVulkanInstance(QVulkanInstance *instance) const { |