GLXWorkstation.st
changeset 212 fc4c2afefff1
parent 207 9124817bbb03
child 213 a24397d724b3
--- a/GLXWorkstation.st	Thu Nov 09 01:08:10 1995 +0100
+++ b/GLXWorkstation.st	Thu Nov 09 12:54:38 1995 +0100
@@ -11,7 +11,7 @@
 "
 
 XWorkstation subclass:#GLXWorkstation
-       instanceVariableNames:'activeWindow hasStereoExtension'
+       instanceVariableNames:'activeWindow hasStereoExtension glOK'
        classVariableNames:   ''
        poolDictionaries:''
        category:'Interface-Graphics'
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.31 1995-11-02 20:12:17 cg Exp $
+$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.32 1995-11-09 11:54:30 cg Exp $
 '!
 
 !GLXWorkstation class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.31 1995-11-02 20:12:17 cg Exp $
+$Header: /cvs/stx/stx/libview/GLXWorkstation.st,v 1.32 1995-11-09 11:54:30 cg Exp $
 "
 !
 
@@ -180,18 +180,23 @@
 /*
  * set the GLXWindow for followup drawing
  */
-#define SETWIN(aGLXWindowId)                             \
-    if (_INST(activeWindow) != aGLXWindowId) {           \
-	if (! ISCONNECTED ) {				 \
-	    RETURN (false);				 \
-	}						 \
-	if (! __isExternalAddress(aGLXWindowId)) {       \
-	    RETURN (false);                              \
-	}                                                \
+#define SETWIN(aGLXWindowId)                            \
+    if (_INST(activeWindow) != aGLXWindowId) {          \
+	if (! ISCONNECTED ) {                           \
+	    RETURN (false);                             \
+	}                                               \
+	if (! __isExternalAddress(aGLXWindowId)) {      \
+	    RETURN (false);                             \
+	}                                               \
 	if (GLXwinset(myDpy, _WindowVal(aGLXWindowId)) < 0) { \
-	    RETURN (false);                              \
-	}                                                \
-	_INST(activeWindow) = aGLXWindowId;              \
+	    RETURN (false);                             \
+	}                                               \
+	_INST(activeWindow) = aGLXWindowId;		\
+	__STORE(self, aGLXWindowId);              	\
+    } else {						\
+	if (aGLXWindowId == nil) {			\
+	    RETURN (false);				\
+	}						\
     }
 
 #define _MKBOOLEAN(b)   ((b==FALSE) ? false : true)
@@ -1063,17 +1068,31 @@
 initializeScreenProperties
     super initializeScreenProperties.
 
+    "/ GL has a 'bug' (or feature ?)
+    "/ which makes it exit (instead of giving an error return)
+    "/ if a gl view is opened on a non-gl capable remote display.
+    "/ we certainly do not want this here.
+    "/ Since I cannot tell in advance if the remote display is gl capable,
+    "/ and its too late once we know its not, we simply disallow any remote gl.
+    "/ Sorry. (I guess, there are some query functions for that available, but I
+    "/ have no documentation).
+
+    glOK := (displayName = ':0') or:[displayName = ':0.0'].
+
 %{
     Display *dpy = myDpy;
     int dummy;
 
     if (ISCONNECTED) {
 #if defined(XSGIStereo) && defined(GLX)
-	if (XQueryExtension(dpy, "SGIFullScreenStereo", &dummy, &dummy, &dummy))
-	    _INST(hasStereoExtension) = true;
+	if (_INST(glOK) != true)
+	    _INST(hasStereoExtension) = false;
 	else
-#endif
-	  _INST(hasStereoExtension) = false;
+	    if (XQueryExtension(dpy, "SGIFullScreenStereo", &dummy, &dummy, &dummy))
+		_INST(hasStereoExtension) = true;
+	    else
+#endif
+	      _INST(hasStereoExtension) = false;
     }
 %}
 ! !
@@ -1083,7 +1102,7 @@
 supportsGLDrawing
     "return true, if this device supports 3D GL drawing."
 
-    ^ true
+    ^ glOK
 
     "
      Display supportsGLDrawing 
@@ -1103,8 +1122,12 @@
 #else
     char buffer[128];
 
-    gversion(buffer);
-    RETURN (_MKSTRING_INIT(buffer));
+    if (_INST(glOK) == true) {
+	gversion(buffer);
+	RETURN (_MKSTRING_INIT(buffer));
+    } else {
+	RETURN (nil);
+    }
 #endif
 %}
 
@@ -1122,7 +1145,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef GLX
-    RETURN ( true );
+    RETURN ( _INST(glOK) );
 #endif
 %}.
     ^ false
@@ -1140,7 +1163,7 @@
 
 %{  /* NOCONTEXT */
 #ifdef GLX
-    RETURN ( true );
+    RETURN ( _INST(glOK) );
 #endif
 %}.
     ^ false
@@ -1159,7 +1182,7 @@
 %{  /* NOCONTEXT */
 #ifdef GLX
     if (getgdesc(GD_TEXTURE) != 0) {
-	RETURN ( true );
+	RETURN ( _INST(glOK) );
     }
 #endif
 %}.
@@ -1179,7 +1202,7 @@
 
 #ifdef GLX
     if (getgdesc(GD_BITS_NORM_DBL_RED) != 0) {
-	RETURN ( true );
+	RETURN ( _INST(glOK) );
     }
 #endif
 %}.
@@ -1199,7 +1222,7 @@
 
 #ifdef GLX
     if (getgdesc(GD_BITS_NORM_ZBUFFER) != 0) {
-	RETURN ( true );
+	RETURN ( _INST(glOK) );
     }
 #endif
 %}.
@@ -1217,12 +1240,14 @@
     long zMax;
     extern OBJ _MKLARGEINT();
 
-    zMax = getgdesc(GD_ZMAX);
-
-    if ((zMax >= _MIN_INT) && (zMax <= _MAX_INT)) {
-	RETURN ( _MKSMALLINT(zMax) );
+    if (_INST(glOK) == true) {
+	zMax = getgdesc(GD_ZMAX);
+
+	if ((zMax >= _MIN_INT) && (zMax <= _MAX_INT)) {
+	    RETURN ( _MKSMALLINT(zMax) );
+	}
+	RETURN ( _MKLARGEINT(zMax) );
     }
-    RETURN ( _MKLARGEINT(zMax) );
 #endif
 %}.
     ^ nil
@@ -1245,6 +1270,8 @@
 createGLXWindowFor:aView left:xpos top:ypos width:wwidth height:wheight type:glxType
     |ext wsuperView wsuperViewId windowId|
 
+    glOK ifFalse:[^ nil].
+
     wsuperView := aView superView.
     wsuperView notNil ifTrue:[
 	wsuperViewId := wsuperView id