Create contexts and pbuffers with the correct screen in QOpenGLWidget

It won't be functional otherwise with GLX when the QOpenGLWidget is targeting
a separate X screen.

Change-Id: Ibe5b89023f833039bb67d94b78b173de2e021ac9
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Laszlo Agocs 2015-05-07 19:00:11 +02:00
parent 55225948a9
commit 6ea636b0bd
2 changed files with 3 additions and 0 deletions

View File

@ -739,6 +739,7 @@ void QOpenGLWidgetPrivate::initialize()
QScopedPointer<QOpenGLContext> ctx(new QOpenGLContext);
ctx->setShareContext(shareContext);
ctx->setFormat(requestedFormat);
ctx->setScreen(shareContext->screen());
if (!ctx->create()) {
qWarning("QOpenGLWidget: Failed to create context");
return;
@ -762,6 +763,7 @@ void QOpenGLWidgetPrivate::initialize()
// in QQuickWidget, use a dedicated QOffscreenSurface.
surface = new QOffscreenSurface;
surface->setFormat(ctx->format());
surface->setScreen(ctx->screen());
surface->create();
if (!ctx->makeCurrent(surface)) {

View File

@ -12074,6 +12074,7 @@ QOpenGLContext *QWidgetPrivate::shareContext() const
QOpenGLContext *ctx = new QOpenGLContext;
ctx->setShareContext(qt_gl_global_share_context());
ctx->setFormat(extra->topextra->window->format());
ctx->setScreen(extra->topextra->window->screen());
ctx->create();
that->extra->topextra->shareContext = ctx;
}