diff --git a/src/SFML/Window/Unix/GlxContext.cpp b/src/SFML/Window/Unix/GlxContext.cpp index cd022364..507cfcb0 100644 --- a/src/SFML/Window/Unix/GlxContext.cpp +++ b/src/SFML/Window/Unix/GlxContext.cpp @@ -316,6 +316,8 @@ XVisualInfo GlxContext::selectBestVisual(::Display* display, unsigned int bitsPe // Make sure that extensions are initialized ensureExtensionsInit(display, DefaultScreen(display)); + const int screen = DefaultScreen(display); + // Retrieve all the visuals int count; XVisualInfo* visuals = XGetVisualInfo(display, 0, NULL, &count); @@ -326,6 +328,10 @@ XVisualInfo GlxContext::selectBestVisual(::Display* display, unsigned int bitsPe XVisualInfo bestVisual = XVisualInfo(); for (int i = 0; i < count; ++i) { + // Filter by screen + if (visuals[i].screen != screen) + continue; + // Check mandatory attributes int doubleBuffer; glXGetConfig(display, &visuals[i], GLX_DOUBLEBUFFER, &doubleBuffer);