[cig-commits] commit: X11 fix for mac OS X 10.6 - only attempt to get double-buffered visual when in interactive mode

Mercurial hg at geodynamics.org
Tue Mar 23 10:36:16 PDT 2010


changeset:   216:6f2e9eea6983
branch:      1.4.x
parent:      214:2a10999ac584
user:        Owen Kaluza <Owen.Kaluza at sci.monash.edu.au>
date:        Fri Jan 29 12:49:37 2010 +1100
files:       Windowing/src/X11Window.c
description:
X11 fix for mac OS X 10.6 - only attempt to get double-buffered visual when in interactive mode


diff -r 2a10999ac584 -r 6f2e9eea6983 Windowing/src/X11Window.c
--- a/Windowing/src/X11Window.c	Wed Jan 20 12:55:52 2010 +1100
+++ b/Windowing/src/X11Window.c	Fri Jan 29 12:49:37 2010 +1100
@@ -339,8 +339,9 @@ Bool lucX11Window_CreateDisplay( void* w
 	static int configuration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
 			GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None};
 	static int alphaConfiguration[] = { GLX_DOUBLEBUFFER, GLX_RGBA, GLX_DEPTH_SIZE, 16,
-			GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None};
-	
+			GLX_STENCIL_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, None}; 
+   int* config = alphaConfiguration;
+
 	/*********************** Create Display ******************************/
 	self->display = XOpenDisplay(NULL);
 	if (self->display == NULL) {
@@ -368,14 +369,17 @@ Bool lucX11Window_CreateDisplay( void* w
 	}
 
 	/* find an OpenGL-capable display - trying different configurations if nessesary */
-	self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &alphaConfiguration[0]);
+   /* Note: only attempt to get double buffered visuals when in interactive mode */
+   self->vi = NULL;
+   if (self->interactive)
+   	self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), config);
 	self->doubleBuffer = True;
 	if (self->vi == NULL) {
 		Journal_Printf( lucError, "In func %s: Couldn't open RGBA Double Buffer display\n", __func__);
-		self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), &alphaConfiguration[1]);
+		self->vi = glXChooseVisual( self->display, DefaultScreen( self->display), config + 1);
 		self->doubleBuffer = False;
 	}
-	if (self->vi == NULL) {
+	if (self->interactive && self->vi == NULL) {
 		Journal_Printf( lucError, "In func %s: Couldn't open RGBA display\n", __func__);
 		self->vi = glXChooseVisual(self->display, DefaultScreen(self->display), &configuration[0]);
 		self->doubleBuffer = True;
@@ -392,7 +396,6 @@ Bool lucX11Window_CreateDisplay( void* w
 
 	return True;
 }
-
 
 Bool lucX11Window_CreateContext( void* window, Bool direct )  {
 	lucX11Window*  self      = (lucX11Window*)window;



More information about the CIG-COMMITS mailing list