XWorkstation.st
changeset 193 3abcc2ee1641
parent 190 4c49bdd5b80f
child 200 aa66f76133ab
--- a/XWorkstation.st	Thu Sep 21 13:40:25 1995 +0200
+++ b/XWorkstation.st	Mon Oct 23 18:00:19 1995 +0100
@@ -16,7 +16,7 @@
 			      hasDPSExtension hasMbufExtension hasXVideoExtension
 			      hasSaveUnder hasPEXExtension hasImageExtension
 			      hasInputExtension ignoreBackingStore
-			      blackpixel whitepixel redMask greenMask blueMask
+			      blackpixel whitepixel 
 			      protocolsAtom deleteWindowAtom saveYourselfAtom
 			      quitAppAtom
 			      primaryAtom secondaryAtom cutBuffer0Atom
@@ -36,7 +36,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.61 1995-09-19 14:59:18 claus Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.62 1995-10-23 16:59:47 cg Exp $
 '!
 
 !XWorkstation class methodsFor:'documentation'!
@@ -57,7 +57,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.61 1995-09-19 14:59:18 claus Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.62 1995-10-23 16:59:47 cg Exp $
 "
 !
 
@@ -524,6 +524,7 @@
     int faxEventBase, faxErrorBase;
     char *type, *nm;
     int dummy;
+    int mask, shift, nBits;
 
     if (ISCONNECTED) {
 	BEGIN_INTERRUPTSBLOCKED
@@ -664,6 +665,52 @@
 	_INST(redMask)   = _MKSMALLINT(visual->red_mask);
 	_INST(greenMask) = _MKSMALLINT(visual->green_mask);
 	_INST(blueMask)  = _MKSMALLINT(visual->blue_mask);
+	switch (visual->class) {
+	    case TrueColor:
+		/* extract number of bits and shift counts */
+		mask = visual->red_mask;
+		shift = 0;
+		while (mask && ((mask & 1) == 0)) {
+		    mask >>= 1;
+		    shift++;
+		}
+		_INST(redShift) = __MKSMALLINT(shift);
+		nBits = 0;
+		while (mask) {
+		    mask >>= 1;
+		    nBits++;
+		}
+		_INST(bitsRed) = __MKSMALLINT(nBits);
+
+		mask = visual->green_mask;
+		shift = 0;
+		while (mask && ((mask & 1) == 0)) {
+		    mask >>= 1;
+		    shift++;
+		}
+		_INST(greenShift) = __MKSMALLINT(shift);
+		nBits = 0;
+		while (mask) {
+		    mask >>= 1;
+		    nBits++;
+		}
+		_INST(bitsGreen) = __MKSMALLINT(nBits);
+
+		mask = visual->blue_mask;
+		shift = 0;
+		while (mask && ((mask & 1) == 0)) {
+		    mask >>= 1;
+		    shift++;
+		}
+		_INST(blueShift) = __MKSMALLINT(shift);
+		nBits = 0;
+		while (mask) {
+		    mask >>= 1;
+		    nBits++;
+		}
+		_INST(bitsBlue) = __MKSMALLINT(nBits);
+		break;
+	}
 
 #ifndef XA_PRIMARY
 	_INST(primaryAtom) = MKOBJ( XInternAtom(dpy, "PRIMARY", True) );
@@ -3089,21 +3136,20 @@
      any font to be aquired (even those not conforming to
      standard naming conventions, such as cursor, fixed or k14)"
 
-%{  /* NOCONTEXT */
+%{  /* UNLIMITEDSTACK */
+    /* UNLIMITEDSTACK STACK:100000 xxNOCONTEXT */
 
     XFontStruct *newFont;
 
     if (ISCONNECTED) {
 	if (__isString(aFontName) || __isSymbol(aFontName)) {
 	    BEGIN_INTERRUPTSBLOCKED
-	    newFont = XLoadQueryFont(myDpy, (char *)_stringVal(aFontName));
+	    newFont = XLoadQueryFont(myDpy, (char *)__stringVal(aFontName));
 	    END_INTERRUPTSBLOCKED
 	    RETURN ( newFont ? MKOBJ(newFont) : nil );
 	}
     }
-%}
-.
-    self primitiveFailed.
+%}.
     ^ nil
 !
 
@@ -3807,6 +3853,12 @@
     unsigned long color;
     int screen = _intVal(_INST(screen));
 
+#ifdef LATER
+    if (_INST(visualType) == @symbol(TrueColor)) {
+	/* no need to do anything on TrueColor displays ... */
+	RETURN (self);
+    }
+#endif
     if (__isSmallInteger(colorIndex) && ISCONNECTED) {
 	color = (long) _intVal(colorIndex);
 	BEGIN_INTERRUPTSBLOCKED
@@ -5342,7 +5394,7 @@
 %{
     GC gc = _GCVal(aGCId);
     Window win = _WindowVal(aDrawableId);
-    extern OBJ Point;
+    extern OBJ Point, __AT_();
     OBJ point, x, y;
     int i, num;
     XPoint *points;
@@ -5361,7 +5413,7 @@
 	    points = qPoints;
 
 	for (i=0; i<num; i++) {
-	    point = _AT_(aPolygon COMMA_CON, _MKSMALLINT(i+1));
+	    point = __AT_(aPolygon COMMA_CON, _MKSMALLINT(i+1));
 	    if (! __isPoint(point)) goto fail;
 	    x = _point_X(point);
 	    y = _point_Y(point);
@@ -5601,7 +5653,7 @@
     GC gc = _GCVal(aGCId);
     Window win = _WindowVal(aDrawableId);
     OBJ point, x, y;
-    extern OBJ Point;
+    extern OBJ Point, __AT_();
     int i, num;
     XPoint *points;
     XPoint qPoints[100];
@@ -5621,7 +5673,7 @@
 	} else
 	    points = qPoints;
 	for (i=0; i<num; i++) {
-	    point = _AT_(aPolygon COMMA_CON, _MKSMALLINT(i+1));
+	    point = __AT_(aPolygon COMMA_CON, _MKSMALLINT(i+1));
 	    if (! __isPoint(point)) goto fail;
 	    x = _point_X(point);
 	    y = _point_Y(point);
@@ -5766,6 +5818,9 @@
 	    case 24:
 		image.bytes_per_line = _intVal(imageWidth)*3;
 		break;
+	    case 32:
+		image.bytes_per_line = _intVal(imageWidth)*4;
+		break;
 	    default:
 #ifdef ARGDEBUG
 		printf("bits_per_pixel=%d\n",image.bits_per_pixel);
@@ -5781,19 +5836,19 @@
 	RETURN ( true );
     }
 #ifdef ARGDEBUG
-    if (! __isSmallInteger(aGCId)) printf("GC\n");
-    if (! __isSmallInteger(aDrawableId)) printf("aDrawableId\n");
-    if (! __isSmallInteger(srcx)) printf("srcx\n");
-    if (! __isSmallInteger(srcy)) printf("srcy\n");
-    if (! __isSmallInteger(dstx)) printf("dstx\n");
-    if (! __isSmallInteger(dsty)) printf("dsty\n");
-    if (! __isSmallInteger(w)) printf("w\n");
-    if (! __isSmallInteger(h)) printf("h\n");
-    if (! __isSmallInteger(imageWidth)) printf("imageWidth\n");
-    if (! __isSmallInteger(imageHeight)) printf("imageHeight\n");
-    if (! __isSmallInteger(imageDepth)) printf("imageDepth\n");
-    if (! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n");
-    if (! __isByteArray(imageBits)) printf("imageBits\n");
+    if (!! __isSmallInteger(aGCId)) printf("GC\n");
+    if (!! __isSmallInteger(aDrawableId)) printf("aDrawableId\n");
+    if (!! __isSmallInteger(srcx)) printf("srcx\n");
+    if (!! __isSmallInteger(srcy)) printf("srcy\n");
+    if (!! __isSmallInteger(dstx)) printf("dstx\n");
+    if (!! __isSmallInteger(dsty)) printf("dsty\n");
+    if (!! __isSmallInteger(w)) printf("w\n");
+    if (!! __isSmallInteger(h)) printf("h\n");
+    if (!! __isSmallInteger(imageWidth)) printf("imageWidth\n");
+    if (!! __isSmallInteger(imageHeight)) printf("imageHeight\n");
+    if (!! __isSmallInteger(imageDepth)) printf("imageDepth\n");
+    if (!! __isSmallInteger(bitsPerPixel)) printf("bitsPerPixel\n");
+    if (!! __isByteArray(imageBits)) printf("imageBits\n");
 #endif
 
 fail: ;
@@ -6033,6 +6088,7 @@
     static unsigned multiClickTime = 0;
     unsigned nextMultiClickTime;
     OBJ upDown;
+    extern OBJ __AT_();
 
     struct inlineCache *ipS;
     static struct inlineCache vid = _ILC1;
@@ -6238,7 +6294,7 @@
 		butt = _MKSMALLINT(2);
 	    else 
 #endif
-		butt = _AT_(_INST(buttonTranslation), butt);
+		butt = __AT_(_INST(buttonTranslation), butt);
             
 
 	    (*(*ipS).ilc_func)(self, 
@@ -6653,4 +6709,3 @@
 
     ^ self eventsPending:(self eventMaskFor:anEventSymbol) for:aWindowIdOrNil
 ! !
-