diff options
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qwindowcontainer.cpp | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e7f5bbf0e9..bde8826792 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -389,7 +389,8 @@ void QXcbWindow::create() resolveFormat(); #ifdef XCB_USE_XLIB - if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { + if (window()->surfaceType() != QSurface::RasterSurface + && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { XVisualInfo *visualInfo = Q_NULLPTR; if (connection()->hasDefaultVisualId()) visualInfo = CREATE_VISUALINFO_FROM_DEFAULT_VISUALID(this); diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 9d3a4ef0b2..3885431b05 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -34,6 +34,8 @@ #include "qwindowcontainer_p.h" #include "qwidget_p.h" #include <QtGui/qwindow.h> +#include <QtGui/private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> #include <QDebug> #include <QMdiSubWindow> @@ -196,6 +198,13 @@ QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt: return; } + // The embedded QWindow must use the same logic as QWidget when it comes to the surface type. + // Otherwise we may end up with BadMatch failures on X11. + if (embeddedWindow->surfaceType() == QSurface::RasterSurface + && QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface) + && !QApplication::testAttribute(Qt::AA_ForceRasterWidgets)) + embeddedWindow->setSurfaceType(QSurface::RasterGLSurface); + d->window = embeddedWindow; d->window->setParent(&d->fakeParent); setAcceptDrops(true); |