allow color-name query - even if closed
authorClaus Gittinger <cg@exept.de>
Thu, 02 Dec 1999 17:09:20 +0100
changeset 3061 060d483207c2
parent 3060 9b16d027bf7b
child 3062 76e91b0a9ab7
allow color-name query - even if closed
XWorkstation.st
--- a/XWorkstation.st	Thu Dec 02 17:08:33 1999 +0100
+++ b/XWorkstation.st	Thu Dec 02 17:09:20 1999 +0100
@@ -2272,6 +2272,11 @@
      and evaluate the 3-arg block, aBlock with them"
 
     |r g b|
+
+    displayId isNil ifTrue:[
+	self primitiveFailed.
+	^ nil
+    ].
 %{
     int screen = __intVal(__INST(screen));
     XColor color;
@@ -2317,8 +2322,12 @@
     |r g b|
 
     displayId isNil ifTrue:[
-	self primitiveFailed.
-	^ nil
+	super getRGBFromName:colorName into:[:rr :gg :bb |
+		r := (rr * 16rFFFF / 100) rounded.
+		g := (gg * 16rFFFF / 100) rounded.
+		b := (bb * 16rFFFF / 100) rounded.
+	].
+	^ aBlock value:r value:g value:b
     ].
 %{
     int screen = __intVal(__INST(screen));
@@ -7369,7 +7378,10 @@
 closeConnection
     "close down the connection to the X-server"
 
-%{  /* NOCONTEXT */
+"/ 'closing' errorPrintCR.
+"/ thisContext fullPrintAll.
+
+%{
 
     if (ISCONNECTED) {
 	Display *dpy = myDpy;
@@ -10198,6 +10210,6 @@
 !XWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.339 1999-12-02 15:06:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.340 1999-12-02 16:09:20 cg Exp $'
 ! !
 XWorkstation initialize!