summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-05-12 08:01:22 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-05-12 09:34:13 +0200
commit46b81b0cc883df0ef7d998be36ae6cbf80257cd2 (patch)
treebde918f1b8a89a0c67f97f2fe46a56766cb0d7c1 /src/glx
parent64f36ff9fbe7e12c79cd72ceb68ed5967979445f (diff)
glXChooseVisual: Only consider fbconfig if we can get the corresponding visual.
This can fail, e.g. when XLIB_SKIP_ARGB_VISUALS=1 is set. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=524794 and http://bugs.freedesktop.org/show_bug.cgi?id=21600 .
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/x11/glxcmds.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c
index b9e0706d31..ec3e69e4fe 100644
--- a/src/glx/x11/glxcmds.c
+++ b/src/glx/x11/glxcmds.c
@@ -1319,30 +1319,31 @@ PUBLIC XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList)
** Eliminate visuals that don't meet minimum requirements
** Compute a score for those that do
** Remember which visual, if any, got the highest score
+ ** If no visual is acceptable, return None
+ ** Otherwise, create an XVisualInfo list with just the selected X visual
+ ** and return this.
*/
for ( modes = psc->visuals ; modes != NULL ; modes = modes->next ) {
if ( fbconfigs_compatible( & test_config, modes )
&& ((best_config == NULL)
|| (fbconfig_compare( (const __GLcontextModes * const * const)&modes, &best_config ) < 0)) ) {
- best_config = modes;
+ XVisualInfo visualTemplate;
+ XVisualInfo *newList;
+ int i;
+
+ visualTemplate.screen = screen;
+ visualTemplate.visualid = modes->visualID;
+ newList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask,
+ &visualTemplate, &i );
+
+ if (newList) {
+ Xfree(visualList);
+ visualList = newList;
+ best_config = modes;
+ }
}
}
- /*
- ** If no visual is acceptable, return None
- ** Otherwise, create an XVisualInfo list with just the selected X visual
- ** and return this.
- */
- if (best_config != NULL) {
- XVisualInfo visualTemplate;
- int i;
-
- visualTemplate.screen = screen;
- visualTemplate.visualid = best_config->visualID;
- visualList = XGetVisualInfo( dpy, VisualScreenMask|VisualIDMask,
- &visualTemplate, &i );
- }
-
return visualList;
}