glx: Pull out screen numnber from GLXFBConfig instead of QXcbScreen

Change-Id: I6b87bb1c3c501613bc147c5f88e0f2d2222b0a50
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-06-30 17:36:11 +02:00
parent 69d581736c
commit 9db36a7143

View File

@ -473,10 +473,16 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share, const
return;
}
int screenNumber = 0;
if (glXQueryContext(m_display, context, GLX_SCREEN, &screenNumber) != Success) {
qWarning("QGLXContext: Failed to query screen from the provided context");
screenNumber = DefaultScreen(m_display);
}
GLXFBConfig *configs;
int numConfigs = 0;
static const int attribs[] = { GLX_FBCONFIG_ID, configId, None };
configs = glXChooseFBConfig(m_display, screen->screenNumber(), attribs, &numConfigs);
configs = glXChooseFBConfig(m_display, screenNumber, attribs, &numConfigs);
if (!configs || numConfigs < 1) {
qWarning("QGLXContext: Failed to find config");
return;