File mesa-only-argb-visuals.diff of Package Mesa

diff -ur ../Mesa-7.2.old/src/glx/x11/glxext.c ./src/glx/x11/glxext.c
--- ../Mesa-7.2.old/src/glx/x11/glxext.c	2009-03-17 12:39:23.000000000 -0400
+++ ./src/glx/x11/glxext.c	2009-03-17 12:42:55.000000000 -0400
@@ -482,6 +482,32 @@
     return modes;
 }
 
+static __GLcontextModes *
+disableNonArgbVisuals (Display * dpy, int screen, __GLcontextModes *modes)
+{
+    __GLcontextModes *m;
+
+    for (m = modes; m != NULL; m = m->next) {
+	XVisualInfo *vi, tmpl;
+	int         i;
+
+	tmpl.screen = screen;
+	tmpl.visualid = m->visualID;
+	vi = XGetVisualInfo( dpy, VisualScreenMask | VisualIDMask, &tmpl, &i );
+	if (vi) {
+	    if (vi->depth != 32) {
+		m->visualID = GLX_DONT_CARE;
+		m->fbconfigID = GLX_DONT_CARE;
+		m->drawableType = 0;
+		m->renderType = 0;
+	    }
+	    XFree (vi);
+	}
+    }
+
+    return modes;
+}
+
 static GLboolean
 getVisualConfigs(Display *dpy, __GLXdisplayPrivate *priv, int screen)
 {
@@ -508,6 +534,8 @@
 
  out:
     UnlockDisplay(dpy);
+    if ((getenv("LIBGL_ONLY_ARGB_VISUALS") != NULL))
+        psc->visuals = disableNonArgbVisuals (dpy, screen, psc->visuals);
     return psc->visuals != NULL;
 }
 
@@ -555,6 +583,8 @@
 
  out:
     UnlockDisplay(dpy);
+    if ((getenv("LIBGL_ONLY_ARGB_VISUALS") != NULL))
+        psc->configs = disableNonArgbVisuals (dpy, screen, psc->configs);
     return psc->configs != NULL;
 }
 
openSUSE Build Service is sponsored by