--- a/GLXWorkstat.st Thu Nov 09 01:08:10 1995 +0100
+++ b/GLXWorkstat.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/Attic/GLXWorkstat.st,v 1.31 1995-11-02 20:12:17 cg Exp $
+$Header: /cvs/stx/stx/libview/Attic/GLXWorkstat.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/Attic/GLXWorkstat.st,v 1.31 1995-11-02 20:12:17 cg Exp $
+$Header: /cvs/stx/stx/libview/Attic/GLXWorkstat.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
--- 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
--- a/XWorkstat.st Thu Nov 09 01:08:10 1995 +0100
+++ b/XWorkstat.st Thu Nov 09 12:54:38 1995 +0100
@@ -36,7 +36,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.68 1995-11-09 00:08:10 stefan Exp $
+$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.69 1995-11-09 11:54:38 cg Exp $
'!
!XWorkstation class methodsFor:'documentation'!
@@ -57,7 +57,7 @@
version
"
-$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.68 1995-11-09 00:08:10 stefan Exp $
+$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.69 1995-11-09 11:54:38 cg Exp $
"
!
@@ -362,7 +362,7 @@
errorStringOfLastError
%{
- RETURN ( _MKSTRING(lastErrorMsg, __context) );
+ RETURN ( _MKSTRING(lastErrorMsg COMMA_CON) );
%}
!
@@ -440,8 +440,10 @@
if (__isString(dpyName))
nm = (char *)_stringVal(dpyName);
- else
+ else {
+ dpyName = __MKSTRING((char *)getenv("DISPLAY") COMMA_CON);
nm = NULL;
+ }
dpy = XOpenDisplay(nm);
if (dpy) {
@@ -938,7 +940,7 @@
(to avoid bugs in certain implementations)"
%{
if (ISCONNECTED) {
- RETURN ( _MKSTRING(XServerVendor(myDpy), __context) );
+ RETURN ( _MKSTRING(XServerVendor(myDpy) COMMA_CON) );
}
RETURN (nil);
%}
@@ -2341,7 +2343,7 @@
if (ok) {
if (actual_type == XA_STRING) {
cp[nread] = '\0';
- val = _MKSTRING(cp, __context);
+ val = _MKSTRING(cp COMMA_CON);
} else {
val = __new(nread + OHDR_SIZE);
val->o_class = cls;
@@ -2525,7 +2527,7 @@
if (name == 0) {
RETURN (nil);
}
- str = _MKSTRING(name, __context);
+ str = _MKSTRING(name COMMA_CON);
XFree(name);
RETURN ( str );
}
@@ -4010,9 +4012,9 @@
fg = floor( ((((double)color.green) * 1000.0) / 0xFFFF) + 0.5) / 10.0;
fb = floor( ((((double)color.blue) * 1000.0) / 0xFFFF) + 0.5) / 10.0;
- r = _MKFLOAT(fr, __context);
- g = _MKFLOAT(fg, __context);
- b = _MKFLOAT(fb, __context);
+ r = _MKFLOAT(fr COMMA_CON);
+ g = _MKFLOAT(fg COMMA_CON);
+ b = _MKFLOAT(fb COMMA_CON);
}
END_INTERRUPTSBLOCKED
}
@@ -4056,9 +4058,9 @@
fg = floor( ( ((double)(color.green>>shift) * 1000.0) / scale) + 0.5) / 10.0;
fb = floor( ( ((double)(color.blue>>shift) * 1000.0) / scale) + 0.5) / 10.0;
- r = _MKFLOAT(fr, __context);
- g = _MKFLOAT(fg, __context);
- b = _MKFLOAT(fb, __context);
+ r = _MKFLOAT(fr COMMA_CON);
+ g = _MKFLOAT(fg COMMA_CON);
+ b = _MKFLOAT(fb COMMA_CON);
}
%}.
aBlock value:r value:g value:b
--- a/XWorkstation.st Thu Nov 09 01:08:10 1995 +0100
+++ b/XWorkstation.st Thu Nov 09 12:54:38 1995 +0100
@@ -36,7 +36,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.68 1995-11-09 00:08:10 stefan Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.69 1995-11-09 11:54:38 cg Exp $
'!
!XWorkstation class methodsFor:'documentation'!
@@ -57,7 +57,7 @@
version
"
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.68 1995-11-09 00:08:10 stefan Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.69 1995-11-09 11:54:38 cg Exp $
"
!
@@ -362,7 +362,7 @@
errorStringOfLastError
%{
- RETURN ( _MKSTRING(lastErrorMsg, __context) );
+ RETURN ( _MKSTRING(lastErrorMsg COMMA_CON) );
%}
!
@@ -440,8 +440,10 @@
if (__isString(dpyName))
nm = (char *)_stringVal(dpyName);
- else
+ else {
+ dpyName = __MKSTRING((char *)getenv("DISPLAY") COMMA_CON);
nm = NULL;
+ }
dpy = XOpenDisplay(nm);
if (dpy) {
@@ -938,7 +940,7 @@
(to avoid bugs in certain implementations)"
%{
if (ISCONNECTED) {
- RETURN ( _MKSTRING(XServerVendor(myDpy), __context) );
+ RETURN ( _MKSTRING(XServerVendor(myDpy) COMMA_CON) );
}
RETURN (nil);
%}
@@ -2341,7 +2343,7 @@
if (ok) {
if (actual_type == XA_STRING) {
cp[nread] = '\0';
- val = _MKSTRING(cp, __context);
+ val = _MKSTRING(cp COMMA_CON);
} else {
val = __new(nread + OHDR_SIZE);
val->o_class = cls;
@@ -2525,7 +2527,7 @@
if (name == 0) {
RETURN (nil);
}
- str = _MKSTRING(name, __context);
+ str = _MKSTRING(name COMMA_CON);
XFree(name);
RETURN ( str );
}
@@ -4010,9 +4012,9 @@
fg = floor( ((((double)color.green) * 1000.0) / 0xFFFF) + 0.5) / 10.0;
fb = floor( ((((double)color.blue) * 1000.0) / 0xFFFF) + 0.5) / 10.0;
- r = _MKFLOAT(fr, __context);
- g = _MKFLOAT(fg, __context);
- b = _MKFLOAT(fb, __context);
+ r = _MKFLOAT(fr COMMA_CON);
+ g = _MKFLOAT(fg COMMA_CON);
+ b = _MKFLOAT(fb COMMA_CON);
}
END_INTERRUPTSBLOCKED
}
@@ -4056,9 +4058,9 @@
fg = floor( ( ((double)(color.green>>shift) * 1000.0) / scale) + 0.5) / 10.0;
fb = floor( ( ((double)(color.blue>>shift) * 1000.0) / scale) + 0.5) / 10.0;
- r = _MKFLOAT(fr, __context);
- g = _MKFLOAT(fg, __context);
- b = _MKFLOAT(fb, __context);
+ r = _MKFLOAT(fr COMMA_CON);
+ g = _MKFLOAT(fg COMMA_CON);
+ b = _MKFLOAT(fb COMMA_CON);
}
%}.
aBlock value:r value:g value:b