Create context with the correct screen in QOpenGLWindow

Targeting a non-primary screen with a QOpenGLWindow requires (at least
with GLX) that the context is created with the same screen. Otherwise
the context cannot be used with the window (BadMatch due to different
X screens)

Change-Id: I64f38ad7317d39a164bb69bb1430692319fc49d4
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Laszlo Agocs 2015-05-07 18:51:42 +02:00
parent d33edcfe37
commit 55225948a9

View File

@ -206,6 +206,7 @@ public:
context.reset(new QOpenGLContext);
context->setShareContext(shareContext);
context->setFormat(q->requestedFormat());
context->setScreen(q->screen());
if (!context->create())
qWarning("QOpenGLWindow::beginPaint: Failed to create context");
if (!context->makeCurrent(q))