preps for xft
authorClaus Gittinger <cg@exept.de>
Mon, 25 Nov 2013 11:51:46 +0100
changeset 6159 d4e463e0c56c
parent 6158 17d06f1e4ca6
child 6160 3ea2f08308ae
preps for xft
Make.proto
XWorkstation.st
--- a/Make.proto	Fri Nov 22 12:02:32 2013 +0100
+++ b/Make.proto	Mon Nov 25 11:51:46 2013 +0100
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libview/Make.proto,v 1.161 2013-04-26 12:10:40 cg Exp $
+# $Header: /cvs/stx/stx/libview/Make.proto,v 1.162 2013-11-25 10:51:46 cg Exp $
 #
 # DO NOT EDIT
 # automagically generated from the projectDefinition: stx_libview at 2012-03-09 09:29:06.849.
@@ -99,7 +99,7 @@
 	$(MAKE) $(SHAREDLIBRULE) \
 	    LIB=XWorkstation.$(SO) \
 	    OBJS="XWorkstation.$(O)" \
-	    LOCAL_SHARED_LIBS="-L$(X_LIB_DIR) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_X) $(LIBRUN_LINK_LIB) "
+	    LOCAL_SHARED_LIBS="-L$(X_LIB_DIR) $(LIB_XEXT) $(LIB_XINERAMA) $(LIB_XFT) $(LIB_X) $(LIBRUN_LINK_LIB) "
 
 __GLXWorkstation.$(O): GLXWorkstation.st $(INCLUDE_TOP)/stx/libview/XWorkstation.H $(INCLUDE_TOP)/stx/libview/DeviceWorkstation.H $(INCLUDE_TOP)/stx/libview/HostGraphicsDevice.H $(INCLUDE_TOP)/stx/libview/GraphicsDevice.H $(INCLUDE)/stc.h
 	$(MAKE) $(BIG_STFILE_RULE) BIG_FILE=GLXWorkstation \
--- a/XWorkstation.st	Fri Nov 22 12:02:32 2013 +0100
+++ b/XWorkstation.st	Mon Nov 25 11:51:46 2013 +0100
@@ -15,7 +15,7 @@
 	instanceVariableNames:'hasShapeExtension hasShmExtension hasDPSExtension
 		hasMbufExtension hasXVideoExtension hasSaveUnder hasPEXExtension
 		hasImageExtension hasInputExtension hasXineramaExtension
-		ignoreBackingStore blackpixel whitepixel atoms protocolsAtom
+		hasRenderExtension hasXftLibrary ignoreBackingStore blackpixel whitepixel atoms protocolsAtom
 		deleteWindowAtom saveYourselfAtom quitAppAtom primaryAtom
 		clipboardAtom stringAtom wmStateAtom motifWMHintsAtom
 		listOfXFonts buttonsPressed eventRootX eventRootY displayName
@@ -170,6 +170,13 @@
 #endif
 
 /*
+ * xft library (based on RENDER extension) - if available
+ */
+#ifdef XFT
+# include <X11/Xft/Xft.h>
+#endif
+
+/*
  * when I have more time to check it out, I will support display-PS
  */
 #ifdef DPS
@@ -3203,11 +3210,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3221,22 +3228,22 @@
      && __bothSmallInteger(w, h)
      && __bothSmallInteger(srcX, srcY)
      && __bothSmallInteger(dstX, dstY)) {
-        int _sX, _sY, _w, _h, _dX, _dY;
-
-        _sX = __intVal(srcX);
-        _sY = __intVal(srcY);
-        _w = __intVal(w);
-        _h = __intVal(h);
-        _dX = __intVal(dstX);
-        _dY = __intVal(dstY);
-
-        gc = __GCVal(dstGCId);
-        source = __DrawableVal(sourceId);
-        dest =   __DrawableVal(destId);
-        ENTER_XLIB();
-        XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
-        LEAVE_XLIB();
-        RETURN ( self );
+	int _sX, _sY, _w, _h, _dX, _dY;
+
+	_sX = __intVal(srcX);
+	_sY = __intVal(srcY);
+	_w = __intVal(w);
+	_h = __intVal(h);
+	_dX = __intVal(dstX);
+	_dY = __intVal(dstY);
+
+	gc = __GCVal(dstGCId);
+	source = __DrawableVal(sourceId);
+	dest =   __DrawableVal(destId);
+	ENTER_XLIB();
+	XCopyArea(myDpy, source, dest, gc, _sX, _sY, _w, _h, _dX, _dY);
+	LEAVE_XLIB();
+	RETURN ( self );
     }
 %}.
     "badGC, bad sourceDrawableId or destDrawableID
@@ -3255,11 +3262,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3273,20 +3280,20 @@
      && __bothSmallInteger(w, h)
      && __bothSmallInteger(srcX, srcY)
      && __bothSmallInteger(dstX, dstY)) {
-        Display *dpy = myDpy;
-
-        gc = __GCVal(dstGCId);
-        source = __DrawableVal(sourceId);
-        dest =   __DrawableVal(destId);
-        ENTER_XLIB();
-        XSetGraphicsExposures(dpy, gc, 0);
-        XCopyArea(dpy, source, dest, gc,
-                                __intVal(srcX), __intVal(srcY),
-                                __intVal(w), __intVal(h),
-                                __intVal(dstX), __intVal(dstY));
-        XSetGraphicsExposures(dpy, gc, 1);
-        LEAVE_XLIB();
-        RETURN ( self );
+	Display *dpy = myDpy;
+
+	gc = __GCVal(dstGCId);
+	source = __DrawableVal(sourceId);
+	dest =   __DrawableVal(destId);
+	ENTER_XLIB();
+	XSetGraphicsExposures(dpy, gc, 0);
+	XCopyArea(dpy, source, dest, gc,
+				__intVal(srcX), __intVal(srcY),
+				__intVal(w), __intVal(h),
+				__intVal(dstX), __intVal(dstY));
+	XSetGraphicsExposures(dpy, gc, 1);
+	LEAVE_XLIB();
+	RETURN ( self );
     }
 %}.
     "badGC, bad sourceDrawableId or destDrawableID
@@ -3305,11 +3312,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3323,16 +3330,16 @@
      && __bothSmallInteger(w, h)
      && __bothSmallInteger(srcX, srcY)
      && __bothSmallInteger(dstX, dstY)) {
-        gc = __GCVal(dstGCId);
-        source = __DrawableVal(sourceId);
-        dest =   __DrawableVal(destId);
-        ENTER_XLIB();
-        XCopyPlane(myDpy, source, dest, gc,
-                                 __intVal(srcX), __intVal(srcY),
-                                 __intVal(w), __intVal(h),
-                                 __intVal(dstX), __intVal(dstY), 1);
-        LEAVE_XLIB();
-        RETURN ( self );
+	gc = __GCVal(dstGCId);
+	source = __DrawableVal(sourceId);
+	dest =   __DrawableVal(destId);
+	ENTER_XLIB();
+	XCopyPlane(myDpy, source, dest, gc,
+				 __intVal(srcX), __intVal(srcY),
+				 __intVal(w), __intVal(h),
+				 __intVal(dstX), __intVal(dstY), 1);
+	LEAVE_XLIB();
+	RETURN ( self );
     }
 %}.
     "badGC, bad sourceDrawableId or destDrawableID
@@ -3352,11 +3359,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3370,20 +3377,20 @@
      && __bothSmallInteger(w, h)
      && __bothSmallInteger(srcX, srcY)
      && __bothSmallInteger(dstX, dstY)) {
-        Display *dpy = myDpy;
-
-        gc = __GCVal(dstGCId);
-        source = __DrawableVal(sourceId);
-        dest =   __DrawableVal(destId);
-        ENTER_XLIB();
-        XSetGraphicsExposures(dpy, gc, 0);
-        XCopyPlane(dpy, source, dest, gc,
-                                 __intVal(srcX), __intVal(srcY),
-                                 __intVal(w), __intVal(h),
-                                 __intVal(dstX), __intVal(dstY), 1);
-        XSetGraphicsExposures(dpy, gc, 1);
-        LEAVE_XLIB();
-        RETURN ( self );
+	Display *dpy = myDpy;
+
+	gc = __GCVal(dstGCId);
+	source = __DrawableVal(sourceId);
+	dest =   __DrawableVal(destId);
+	ENTER_XLIB();
+	XSetGraphicsExposures(dpy, gc, 0);
+	XCopyPlane(dpy, source, dest, gc,
+				 __intVal(srcX), __intVal(srcY),
+				 __intVal(w), __intVal(h),
+				 __intVal(dstX), __intVal(dstY), 1);
+	XSetGraphicsExposures(dpy, gc, 1);
+	LEAVE_XLIB();
+	RETURN ( self );
     }
 %}.
     "badGC, bad sourceDrawableId or destDrawableID
@@ -3399,11 +3406,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3413,23 +3420,23 @@
     double f;
 
     if (__isSmallInteger(startAngle))
-        angle1 = __intVal(startAngle) * 64;
+	angle1 = __intVal(startAngle) * 64;
     else if (__isFloat(startAngle)) {
-        f = __floatVal(startAngle);
-        angle1 = f * 64;
+	f = __floatVal(startAngle);
+	angle1 = f * 64;
     } else if (__isShortFloat(startAngle)) {
-        f = __shortFloatVal(startAngle);
-        angle1 = f * 64;
+	f = __shortFloatVal(startAngle);
+	angle1 = f * 64;
     } else goto bad;
 
     if (__isSmallInteger(angle))
-        angle2 = __intVal(angle) * 64;
+	angle2 = __intVal(angle) * 64;
     else if (__isFloat(angle)) {
-        f = __floatVal(angle);
-        angle2 = f * 64;
+	f = __floatVal(angle);
+	angle2 = f * 64;
     } else if (__isShortFloat(angle)) {
-        f = __shortFloatVal(angle);
-        angle2 = f * 64;
+	f = __shortFloatVal(angle);
+	angle2 = f * 64;
     } else goto bad;
 
     if (ISCONNECTED
@@ -3437,20 +3444,20 @@
      && __isExternalAddress(aDrawableId)
      && __bothSmallInteger(x, y)
      && __bothSmallInteger(width, height)) {
-        win = __WindowVal(aDrawableId);
-        gc = __GCVal(aGCId);
-        w = __intVal(width);
-        h = __intVal(height);
-        /*
-         * need this check here: some servers simply dump core with bad args
-         */
-        if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
-            ENTER_XLIB();
-            XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
-                                   w, h, angle1, angle2);
-            LEAVE_XLIB();
-        }
-        RETURN ( self );
+	win = __WindowVal(aDrawableId);
+	gc = __GCVal(aGCId);
+	w = __intVal(width);
+	h = __intVal(height);
+	/*
+	 * need this check here: some servers simply dump core with bad args
+	 */
+	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
+	    ENTER_XLIB();
+	    XDrawArc(myDpy, win, gc, __intVal(x), __intVal(y),
+				   w, h, angle1, angle2);
+	    LEAVE_XLIB();
+	}
+	RETURN ( self );
     }
     bad: ;
 %}.
@@ -3466,11 +3473,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3482,35 +3489,35 @@
      && __isExternalAddress(aDrawableId)
      && __bothSmallInteger(x0, y0)
      && __bothSmallInteger(x1, y1)) {
-        Display *dpy = myDpy;
-        int ix0, iy0, ix1, iy1;
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-
-        ix0 = __intVal(x0);
-        iy0 = __intVal(y0);
-        ix1 = __intVal(x1);
-        iy1 = __intVal(y1);
-
-        /* attention: coordinates in X are shorts and wrap; clamp here. */
-        if (ix0 > 0x7FFF) ix0 = 0x7FFF;
-        else if (ix0 < -0x8000) ix0 = -0x8000;
-        if (iy0 > 0x7FFF) iy0 = 0x7FFF;
-        else if (iy0 < -0x8000) iy0 = -0x8000;
-        if (ix1 > 0x7FFF) ix1 = 0x7FFF;
-        else if (ix1 < -0x8000) ix1 = -0x8000;
-        if (iy1 > 0x7FFF) iy1 = 0x7FFF;
-        else if (iy1 < -0x8000) iy1 = -0x8000;
-
-        ENTER_XLIB();
-        if ((ix0 == ix1) && (iy0 == iy1)) {
-            /* little bit shorter X-lib message (better with slow connections...) */
-            XDrawPoint(dpy, win, gc, ix0, iy0);
-        } else {
-            XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
-        }
-        LEAVE_XLIB();
-        RETURN ( self );
+	Display *dpy = myDpy;
+	int ix0, iy0, ix1, iy1;
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+
+	ix0 = __intVal(x0);
+	iy0 = __intVal(y0);
+	ix1 = __intVal(x1);
+	iy1 = __intVal(y1);
+
+	/* attention: coordinates in X are shorts and wrap; clamp here. */
+	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
+	else if (ix0 < -0x8000) ix0 = -0x8000;
+	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
+	else if (iy0 < -0x8000) iy0 = -0x8000;
+	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
+	else if (ix1 < -0x8000) ix1 = -0x8000;
+	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
+	else if (iy1 < -0x8000) iy1 = -0x8000;
+
+	ENTER_XLIB();
+	if ((ix0 == ix1) && (iy0 == iy1)) {
+	    /* little bit shorter X-lib message (better with slow connections...) */
+	    XDrawPoint(dpy, win, gc, ix0, iy0);
+	} else {
+	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
+	}
+	LEAVE_XLIB();
+	RETURN ( self );
     }
 %}.
     "badGC, badDrawable or coordinates not integer"
@@ -3527,15 +3534,15 @@
     |noY|
 
     (noY := yValues size) < 2 ifTrue:[
-        ^ self
+	^ self
     ].
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
     OBJ      yA, t;
@@ -3551,110 +3558,110 @@
     if (ISCONNECTED
      && __isExternalAddress(aGCId)
      && __isExternalAddress(aDrawableId) ) {
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-
-        if( __isSmallInteger(scaleY) )
-            sY = (float) __intVal( scaleY );
-        else if (__isFloat(scaleY))
-            sY = __floatVal( scaleY );
-        else if (__isShortFloat(scaleY))
-            sY = __shortFloatVal( scaleY );
-        else {
-            t = __SSEND0(scaleY, @symbol(asFloat), 0);
-            if (! __isFloat(t)) goto fail;
-            sY = __floatVal( t );
-        }
-
-        if( __isSmallInteger(transY) )
-            tY = (float) __intVal( transY );
-        else if (__isFloat(transY))
-            tY = __floatVal( transY );
-        else if (__isShortFloat(transY))
-            tY = __shortFloatVal( transY );
-        else {
-            t = __SSEND0(transY, @symbol(asFloat), 0);
-            if (! __isFloat(t)) goto fail;
-            tY = __floatVal( t );
-        }
-
-        if( __isSmallInteger(startX) )
-            x = (float) __intVal( startX );
-        else if (__isFloat(startX))
-            x = __floatVal( startX );
-        else if (__isShortFloat(startX))
-            x = __shortFloatVal( startX );
-        else {
-            t = __SSEND0(startX, @symbol(asFloat), 0);
-            if (! __isFloat(t)) goto fail;
-            x = __floatVal( t );
-        }
-
-        if( __isSmallInteger(stepX) )
-            step = (float) __intVal( stepX );
-        else if (__isFloat(stepX))
-            step = __floatVal( stepX );
-        else if (__isShortFloat(stepX))
-            step = __shortFloatVal( stepX );
-        else {
-            t = __SSEND0(stepX, @symbol(asFloat), 0);
-            if (! __isFloat(t)) goto fail;
-            step = __floatVal( t );
-        }
-
-        num = __intVal( noY );
-
-        if( num > 200 ) {
-            if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
-                goto fail;
-            mustFree = 1;
-        } else {
-            points = qPoints;
-        }
-        for( i = 0; i < num; ++i ) {
-            int px, py;
-
-            yA  = __AT_(yValues, __MKSMALLINT(i+1) );
-
-            if( __isFloat(yA) )
-                y = __floatVal( yA );
-            else if( __isSmallInteger(yA) )
-                y = (float) __intVal( yA );
-            else if( __isShortFloat( yA) )
-                y = __shortFloatVal( yA );
-            else {
-                t = __SSEND0(yA, @symbol(asFloat), 0);
-                if (! __isFloat(t)) goto fail;
-                y = __floatVal( t );
-            }
-
-            px = (int) (x + 0.5);
-            py = (int) ((y * sY) + tY + 0.5);
-
-            /* attention: coordinates in X are shorts and wrap; clamp here. */
-            if (px > 0x7FFF) px = 0x7FFF;
-            else if (px < -0x8000) px = -0x8000;
-            if (py > 0x7FFF) py = 0x7FFF;
-            else if (py < -0x8000) py = -0x8000;
-
-            points[i].x = px;
-            points[i].y = py;
-            x = x + step;
-        }
-
-        ENTER_XLIB();
-        XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
-        LEAVE_XLIB();
-
-        if( mustFree ) {
-            free( points );
-        }
-        RETURN ( self );
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+
+	if( __isSmallInteger(scaleY) )
+	    sY = (float) __intVal( scaleY );
+	else if (__isFloat(scaleY))
+	    sY = __floatVal( scaleY );
+	else if (__isShortFloat(scaleY))
+	    sY = __shortFloatVal( scaleY );
+	else {
+	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
+	    if (! __isFloat(t)) goto fail;
+	    sY = __floatVal( t );
+	}
+
+	if( __isSmallInteger(transY) )
+	    tY = (float) __intVal( transY );
+	else if (__isFloat(transY))
+	    tY = __floatVal( transY );
+	else if (__isShortFloat(transY))
+	    tY = __shortFloatVal( transY );
+	else {
+	    t = __SSEND0(transY, @symbol(asFloat), 0);
+	    if (! __isFloat(t)) goto fail;
+	    tY = __floatVal( t );
+	}
+
+	if( __isSmallInteger(startX) )
+	    x = (float) __intVal( startX );
+	else if (__isFloat(startX))
+	    x = __floatVal( startX );
+	else if (__isShortFloat(startX))
+	    x = __shortFloatVal( startX );
+	else {
+	    t = __SSEND0(startX, @symbol(asFloat), 0);
+	    if (! __isFloat(t)) goto fail;
+	    x = __floatVal( t );
+	}
+
+	if( __isSmallInteger(stepX) )
+	    step = (float) __intVal( stepX );
+	else if (__isFloat(stepX))
+	    step = __floatVal( stepX );
+	else if (__isShortFloat(stepX))
+	    step = __shortFloatVal( stepX );
+	else {
+	    t = __SSEND0(stepX, @symbol(asFloat), 0);
+	    if (! __isFloat(t)) goto fail;
+	    step = __floatVal( t );
+	}
+
+	num = __intVal( noY );
+
+	if( num > 200 ) {
+	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
+		goto fail;
+	    mustFree = 1;
+	} else {
+	    points = qPoints;
+	}
+	for( i = 0; i < num; ++i ) {
+	    int px, py;
+
+	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
+
+	    if( __isFloat(yA) )
+		y = __floatVal( yA );
+	    else if( __isSmallInteger(yA) )
+		y = (float) __intVal( yA );
+	    else if( __isShortFloat( yA) )
+		y = __shortFloatVal( yA );
+	    else {
+		t = __SSEND0(yA, @symbol(asFloat), 0);
+		if (! __isFloat(t)) goto fail;
+		y = __floatVal( t );
+	    }
+
+	    px = (int) (x + 0.5);
+	    py = (int) ((y * sY) + tY + 0.5);
+
+	    /* attention: coordinates in X are shorts and wrap; clamp here. */
+	    if (px > 0x7FFF) px = 0x7FFF;
+	    else if (px < -0x8000) px = -0x8000;
+	    if (py > 0x7FFF) py = 0x7FFF;
+	    else if (py < -0x8000) py = -0x8000;
+
+	    points[i].x = px;
+	    points[i].y = py;
+	    x = x + step;
+	}
+
+	ENTER_XLIB();
+	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
+	LEAVE_XLIB();
+
+	if( mustFree ) {
+	    free( points );
+	}
+	RETURN ( self );
     }
 
 fail:
     if( mustFree )
-        free( points );
+	free( points );
 %}.
     ^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId
 
@@ -3667,11 +3674,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3682,23 +3689,23 @@
      && __isExternalAddress(aGCId)
      && __isExternalAddress(aDrawableId)
      && __bothSmallInteger(x, y)) {
-        int px, py;
-
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-
-        px = __intVal(x);
-        py = __intVal(y);
-        if (px > 0x7FFF) px = 0x7FFF;
-        else if (px < -0x8000) px = -0x8000;
-        if (py > 0x7FFF) py = 0x7FFF;
-        else if (py < -0x8000) py = -0x8000;
-
-        ENTER_XLIB();
-        XDrawPoint(myDpy, win, gc, px, py);
-        LEAVE_XLIB();
-
-        RETURN ( self );
+	int px, py;
+
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+
+	px = __intVal(x);
+	py = __intVal(y);
+	if (px > 0x7FFF) px = 0x7FFF;
+	else if (px < -0x8000) px = -0x8000;
+	if (py > 0x7FFF) py = 0x7FFF;
+	else if (py < -0x8000) py = -0x8000;
+
+	ENTER_XLIB();
+	XDrawPoint(myDpy, win, gc, px, py);
+	LEAVE_XLIB();
+
+	RETURN ( self );
     }
 %}.
     "badGC, badDrawable or x/y not integer"
@@ -3715,11 +3722,11 @@
     |numberOfPoints newPoints|
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
     numberOfPoints := aPolygon size.
 %{
@@ -3735,53 +3742,53 @@
      && __isExternalAddress(aGCId)
      && __isExternalAddress(aDrawableId)
      && __isSmallInteger(numberOfPoints)) {
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-        num = __intVal(numberOfPoints);
-        /*
-         * avoid a (slow) malloc, if the number of points is small
-         */
-        if (num > 100) {
-            points = (XPoint *)malloc(sizeof(XPoint) * num);
-            if (! points) goto fail;
-            mustFree = 1;
-        } else
-            points = qPoints;
-
-        for (i=0; i<num; i++) {
-            int px, py;
-
-            point = __AT_(aPolygon, __MKSMALLINT(i+1));
-            if (! __isPoint(point)) goto fail;
-            x = _point_X(point);
-            y = _point_Y(point);
-            if (! __bothSmallInteger(x, y))
-                goto fail;
-
-            px = __intVal(x);
-            py = __intVal(y);
-
-            /* attention: coordinates in X are shorts and wrap; clamp here. */
-            if (px > 0x7FFF) px = 0x7FFF;
-            else if (px < -0x8000) px = -0x8000;
-            if (py > 0x7FFF) py = 0x7FFF;
-            else if (py < -0x8000) py = -0x8000;
-
-            points[i].x = px;
-            points[i].y = py;
-        }
-
-        ENTER_XLIB();
-        XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
-        LEAVE_XLIB();
-
-        if (mustFree)
-            free(points);
-        RETURN ( self );
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+	num = __intVal(numberOfPoints);
+	/*
+	 * avoid a (slow) malloc, if the number of points is small
+	 */
+	if (num > 100) {
+	    points = (XPoint *)malloc(sizeof(XPoint) * num);
+	    if (! points) goto fail;
+	    mustFree = 1;
+	} else
+	    points = qPoints;
+
+	for (i=0; i<num; i++) {
+	    int px, py;
+
+	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
+	    if (! __isPoint(point)) goto fail;
+	    x = _point_X(point);
+	    y = _point_Y(point);
+	    if (! __bothSmallInteger(x, y))
+		goto fail;
+
+	    px = __intVal(x);
+	    py = __intVal(y);
+
+	    /* attention: coordinates in X are shorts and wrap; clamp here. */
+	    if (px > 0x7FFF) px = 0x7FFF;
+	    else if (px < -0x8000) px = -0x8000;
+	    if (py > 0x7FFF) py = 0x7FFF;
+	    else if (py < -0x8000) py = -0x8000;
+
+	    points[i].x = px;
+	    points[i].y = py;
+	}
+
+	ENTER_XLIB();
+	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
+	LEAVE_XLIB();
+
+	if (mustFree)
+	    free(points);
+	RETURN ( self );
     }
 fail: ;
     if (mustFree)
-        free(points);
+	free(points);
 %}.
     "badGC, badDrawable or coordinates not integer"
     self primitiveFailedOrClosedConnection
@@ -3793,11 +3800,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3810,31 +3817,31 @@
      && __isExternalAddress(aDrawableId)
      && __bothSmallInteger(x, y)
      && __bothSmallInteger(width, height)) {
-        int px, py;
-
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-        w = __intVal(width);
-        h = __intVal(height);
-
-        /*
-         * need this check here: some servers simply dump core with bad args
-         */
-        if ((w >= 0) && (h >= 0)) {
-            px = __intVal(x);
-            py = __intVal(y);
-
-            /* attention: coordinates in X are shorts and wrap; clamp here. */
-            if (px > 0x7FFF) px = 0x7FFF;
-            else if (px < -0x8000) px = -0x8000;
-            if (py > 0x7FFF) py = 0x7FFF;
-            else if (py < -0x8000) py = -0x8000;
-
-            ENTER_XLIB();
-            XDrawRectangle(myDpy, win, gc, px, py, w, h);
-            LEAVE_XLIB();
-        }
-        RETURN ( self );
+	int px, py;
+
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+	w = __intVal(width);
+	h = __intVal(height);
+
+	/*
+	 * need this check here: some servers simply dump core with bad args
+	 */
+	if ((w >= 0) && (h >= 0)) {
+	    px = __intVal(x);
+	    py = __intVal(y);
+
+	    /* attention: coordinates in X are shorts and wrap; clamp here. */
+	    if (px > 0x7FFF) px = 0x7FFF;
+	    else if (px < -0x8000) px = -0x8000;
+	    if (py > 0x7FFF) py = 0x7FFF;
+	    else if (py < -0x8000) py = -0x8000;
+
+	    ENTER_XLIB();
+	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
+	    LEAVE_XLIB();
+	}
+	RETURN ( self );
     }
 %}.
     "badGC, badDrawable or coordinates not integer"
@@ -3849,11 +3856,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -3871,174 +3878,174 @@
      && __isNonNilObject(aString)
      && __bothSmallInteger(index1, index2)
      && __bothSmallInteger(x, y)) {
-        int lMax = __intVal(@global(MaxStringLength));
-        Display *dpy = myDpy;
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-
-        i1 = __intVal(index1) - 1;
-        if (i1 >= 0) {
-            OBJ cls;
-
-            i2 = __intVal(index2) - 1;
-            if (i2 < i1) {
-                RETURN (self);
-            }
-
-            cp = (char *) __stringVal(aString);
-            l = i2 - i1 + 1;
-
-            if (__isStringLike(aString)) {
-                n = __stringSize(aString);
-                if (i2 < n) {
-                    cp += i1;
-                    if (l > lMax) l = lMax;
-                    ENTER_XLIB();
-                    if (opaque == true)
-                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    else
-                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    LEAVE_XLIB();
-                    RETURN ( self );
-                }
-            }
-
-            cls = __qClass(aString);
-            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-            cp += nInstBytes;
-
-            if (__isBytes(aString)) {
-                n = __byteArraySize(aString) - nInstBytes - 1;
-
-                if (i2 < n) {
-                    cp += i1;
-                    if (l > lMax) l = lMax;
-                    ENTER_XLIB();
-                    if (opaque == true)
-                        XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    else
-                        XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
-                    LEAVE_XLIB();
-                    RETURN ( self );
-                }
-            }
-
-            /* TWOBYTESTRINGS */
-            if (__isWords(aString)) {
-                n = (__byteArraySize(aString) - nInstBytes) / 2;
-                if (i2 < n) {
-                    union {
-                        char b[2];
-                        unsigned short s;
-                    } u;
-                    int i;
-                    XChar2b *cp2 = (XChar2b *)0;
-                    int mustFree = 0;
-
-                    cp += (i1 * 2);
-                    if (l > lMax) l = lMax;
+	int lMax = __intVal(@global(MaxStringLength));
+	Display *dpy = myDpy;
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+
+	i1 = __intVal(index1) - 1;
+	if (i1 >= 0) {
+	    OBJ cls;
+
+	    i2 = __intVal(index2) - 1;
+	    if (i2 < i1) {
+		RETURN (self);
+	    }
+
+	    cp = (char *) __stringVal(aString);
+	    l = i2 - i1 + 1;
+
+	    if (__isStringLike(aString)) {
+		n = __stringSize(aString);
+		if (i2 < n) {
+		    cp += i1;
+		    if (l > lMax) l = lMax;
+		    ENTER_XLIB();
+		    if (opaque == true)
+			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    else
+			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    LEAVE_XLIB();
+		    RETURN ( self );
+		}
+	    }
+
+	    cls = __qClass(aString);
+	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	    cp += nInstBytes;
+
+	    if (__isBytes(aString)) {
+		n = __byteArraySize(aString) - nInstBytes - 1;
+
+		if (i2 < n) {
+		    cp += i1;
+		    if (l > lMax) l = lMax;
+		    ENTER_XLIB();
+		    if (opaque == true)
+			XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    else
+			XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, l);
+		    LEAVE_XLIB();
+		    RETURN ( self );
+		}
+	    }
+
+	    /* TWOBYTESTRINGS */
+	    if (__isWords(aString)) {
+		n = (__byteArraySize(aString) - nInstBytes) / 2;
+		if (i2 < n) {
+		    union {
+			char b[2];
+			unsigned short s;
+		    } u;
+		    int i;
+		    XChar2b *cp2 = (XChar2b *)0;
+		    int mustFree = 0;
+
+		    cp += (i1 * 2);
+		    if (l > lMax) l = lMax;
 
 #if defined(MSBFIRST) || defined(__MSBFIRST)
-                    /*
-                     * chars already in correct order
-                     */
+		    /*
+		     * chars already in correct order
+		     */
 #else
 # if ! (defined(LSBFIRST) || defined(__LSBFIRST))
-                    /*
-                     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
-                     * X expects them MSB first
-                     * convert as required
-                     */
-                    u.s = 0x1234;
-                    if (u.b[0] != 0x12)
+		    /*
+		     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
+		     * X expects them MSB first
+		     * convert as required
+		     */
+		    u.s = 0x1234;
+		    if (u.b[0] != 0x12)
 # endif
-                    {
-                        if (l <= NLOCALBUFFER) {
-                            cp2 = xlatebuffer;
-                        } else {
-                            cp2 = (XChar2b *)(malloc(l * 2));
-                            mustFree = 1;
-                        }
-                        for (i=0; i<l; i++) {
-                            cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
-                            cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
-                        }
-                        cp = (char *) cp2;
-                    }
-#endif
-                    ENTER_XLIB();
-                    if (opaque == true)
-                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
-                    else
-                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
-                    LEAVE_XLIB();
-
-                    if (mustFree) {
-                        free(cp2);
-                    }
-
-                    RETURN ( self );
-                }
-            }
-
-            /* FOURBYTESTRINGS */
-            if (__isLongs(aString)) {
-                n = (__byteArraySize(aString) - nInstBytes) / 4;
-                if (i2 < n) {
-                    union {
-                        char b[2];
-                        unsigned short s;
-                    } u;
-                    int i;
-                    XChar2b *cp2 = (XChar2b *)0;
-                    int32 *ip;
-                    int mustFree = 0;
-
-                    cp += (i1 * 4);
-                    if (l > lMax) l = lMax;
-
-                    /*
-                     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
-                     */
-                    if (l <= NLOCALBUFFER) {
-                        cp2 = xlatebuffer;
-                    } else {
-                        cp2 = (XChar2b *)(malloc(l * 2));
-                        mustFree = 1;
-                    }
-                    for (i=0; i<l; i++) {
-                        int32 codePoint = ((int32 *)cp)[i];
-
-                        if (codePoint > 0xFFFF) {
-                            codePoint = 0xFFFF;
-                        }
-                        cp2[i].byte1 = (codePoint >> 8) & 0xFF;
-                        cp2[i].byte2 = codePoint & 0xFF;
-                    }
-                    cp = (char *) cp2;
-
-                    ENTER_XLIB();
-                    if (opaque == true)
-                        XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
-                    else
-                        XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
-                    LEAVE_XLIB();
-
-                    if (mustFree) {
-                        free(cp2);
-                    }
-
-                    RETURN ( self );
-                }
-            }
-        }
+		    {
+			if (l <= NLOCALBUFFER) {
+			    cp2 = xlatebuffer;
+			} else {
+			    cp2 = (XChar2b *)(malloc(l * 2));
+			    mustFree = 1;
+			}
+			for (i=0; i<l; i++) {
+			    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
+			    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
+			}
+			cp = (char *) cp2;
+		    }
+#endif
+		    ENTER_XLIB();
+		    if (opaque == true)
+			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+		    else
+			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+		    LEAVE_XLIB();
+
+		    if (mustFree) {
+			free(cp2);
+		    }
+
+		    RETURN ( self );
+		}
+	    }
+
+	    /* FOURBYTESTRINGS */
+	    if (__isLongs(aString)) {
+		n = (__byteArraySize(aString) - nInstBytes) / 4;
+		if (i2 < n) {
+		    union {
+			char b[2];
+			unsigned short s;
+		    } u;
+		    int i;
+		    XChar2b *cp2 = (XChar2b *)0;
+		    int32 *ip;
+		    int mustFree = 0;
+
+		    cp += (i1 * 4);
+		    if (l > lMax) l = lMax;
+
+		    /*
+		     * all codePoints <= 16rFFFF are draw; above 16bit range are drawn as 16rFFFF.
+		     */
+		    if (l <= NLOCALBUFFER) {
+			cp2 = xlatebuffer;
+		    } else {
+			cp2 = (XChar2b *)(malloc(l * 2));
+			mustFree = 1;
+		    }
+		    for (i=0; i<l; i++) {
+			int32 codePoint = ((int32 *)cp)[i];
+
+			if (codePoint > 0xFFFF) {
+			    codePoint = 0xFFFF;
+			}
+			cp2[i].byte1 = (codePoint >> 8) & 0xFF;
+			cp2[i].byte2 = codePoint & 0xFF;
+		    }
+		    cp = (char *) cp2;
+
+		    ENTER_XLIB();
+		    if (opaque == true)
+			XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+		    else
+			XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, l);
+		    LEAVE_XLIB();
+
+		    if (mustFree) {
+			free(cp2);
+		    }
+
+		    RETURN ( self );
+		}
+	    }
+	}
     }
 #undef NLOCALBUFFER
 %}.
     (aString isString and:[aString bitsPerCharacter > 16]) ifTrue:[
-        self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
-             from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque.
-        ^ self.
+	self displayString:(TwoByteString new:aString size withAll:16rFFFF asCharacter)
+	     from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque.
+	^ self.
     ].
 
     "x/y not integer, badGC or drawable, or not a string"
@@ -4053,11 +4060,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -4075,98 +4082,98 @@
      && __isExternalAddress(aDrawableId)
      && __isNonNilObject(aString)
      && __bothSmallInteger(x, y)) {
-        int lMax = __intVal(@global(MaxStringLength));
-        Display *dpy = myDpy;
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-
-        cp = (char *) __stringVal(aString);
-
-        if (__isStringLike(aString)) {
-            n = __stringSize(aString);
-            if (n > lMax) n = lMax;
-            ENTER_XLIB();
-            if (opaque == true)
-                XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
-            else
-                XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
-            LEAVE_XLIB();
-            RETURN ( self );
-        }
-
-        cls = __qClass(aString);
-        nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-        cp += nInstBytes;
-
-        if (__isBytes(aString)) {
-            n = __byteArraySize(aString) - nInstBytes - 1;
-
-            if (n > lMax) n = lMax;
-            ENTER_XLIB();
-            if (opaque == true)
-                XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
-            else
-                XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
-            LEAVE_XLIB();
-            RETURN ( self );
-        }
-
-        /* TWOBYTESTRINGS */
-        if (__isWords(aString)) {
-            union {
-                char b[2];
-                unsigned short s;
-            } u;
-            int i;
-            XChar2b *cp2;
-            int mustFree = 0;
-
-            n = (__byteArraySize(aString) - nInstBytes) / 2;
-            if (n > lMax) n = lMax;
+	int lMax = __intVal(@global(MaxStringLength));
+	Display *dpy = myDpy;
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+
+	cp = (char *) __stringVal(aString);
+
+	if (__isStringLike(aString)) {
+	    n = __stringSize(aString);
+	    if (n > lMax) n = lMax;
+	    ENTER_XLIB();
+	    if (opaque == true)
+		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
+	    else
+		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
+	    LEAVE_XLIB();
+	    RETURN ( self );
+	}
+
+	cls = __qClass(aString);
+	nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	cp += nInstBytes;
+
+	if (__isBytes(aString)) {
+	    n = __byteArraySize(aString) - nInstBytes - 1;
+
+	    if (n > lMax) n = lMax;
+	    ENTER_XLIB();
+	    if (opaque == true)
+		XDrawImageString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
+	    else
+		XDrawString(dpy, win, gc, __intVal(x), __intVal(y), cp, n);
+	    LEAVE_XLIB();
+	    RETURN ( self );
+	}
+
+	/* TWOBYTESTRINGS */
+	if (__isWords(aString)) {
+	    union {
+		char b[2];
+		unsigned short s;
+	    } u;
+	    int i;
+	    XChar2b *cp2;
+	    int mustFree = 0;
+
+	    n = (__byteArraySize(aString) - nInstBytes) / 2;
+	    if (n > lMax) n = lMax;
 
 #if defined(MSBFIRST) || defined(__MSBFIRST)
-            /*
-             * chars already in correct order
-             */
+	    /*
+	     * chars already in correct order
+	     */
 #else
 # if ! (defined(LSBFIRST) || defined(__LSBFIRST))
-            /*
-             * ST/X TwoByteStrings store the asciiValue in native byteOrder;
-             * X expects them MSB first
-             * convert as required
-             */
-            u.s = 0x1234;
-            if (u.b[0] != 0x12)
+	    /*
+	     * ST/X TwoByteStrings store the asciiValue in native byteOrder;
+	     * X expects them MSB first
+	     * convert as required
+	     */
+	    u.s = 0x1234;
+	    if (u.b[0] != 0x12)
 # endif
-            {
-                if (n <= NLOCALBUFFER) {
-                    cp2 = xlatebuffer;
-                } else {
-                    cp2 = (XChar2b *)(malloc(n * 2));
-                    mustFree = 1;
-                }
-
-                for (i=0; i<n; i++) {
-                    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
-                    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
-                }
-                cp = (char *) cp2;
-            }
-#endif
-            ENTER_XLIB();
-            if (opaque == true)
-                XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
-            else
-                XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
-            LEAVE_XLIB();
-
-
-            if (mustFree) {
-                free(cp2);
-            }
-
-            RETURN ( self );
-        }
+	    {
+		if (n <= NLOCALBUFFER) {
+		    cp2 = xlatebuffer;
+		} else {
+		    cp2 = (XChar2b *)(malloc(n * 2));
+		    mustFree = 1;
+		}
+
+		for (i=0; i<n; i++) {
+		    cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
+		    cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
+		}
+		cp = (char *) cp2;
+	    }
+#endif
+	    ENTER_XLIB();
+	    if (opaque == true)
+		XDrawImageString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
+	    else
+		XDrawString16(dpy, win, gc, __intVal(x), __intVal(y), (XChar2b *)cp, n);
+	    LEAVE_XLIB();
+
+
+	    if (mustFree) {
+		free(cp2);
+	    }
+
+	    RETURN ( self );
+	}
     }
 #undef NLOCALBUFFER
 %}.
@@ -4174,12 +4181,12 @@
 !
 
 drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
-        width:imageWidth height:imageHeight
-        x:srcx y:srcy
-        into:aDrawableId
-        x:dstx y:dsty
-        width:w height:h
-        with:aGCId
+	width:imageWidth height:imageHeight
+	x:srcx y:srcy
+	into:aDrawableId
+	x:dstx y:dsty
+	width:w height:h
+	with:aGCId
 
     "draw a bitImage which has depth id, width iw and height ih into
      the drawable. draw a region of w/h pixels from srcx/srcy to dstx/dsty.
@@ -4201,70 +4208,70 @@
     "/ care for that.
 
     ((imageDepth == 4) and:[depth == 4]) ifTrue:[
-        fmt := self supportedImageFormatForDepth:4.
-        fmt isNil ifTrue:[
-            self primitiveFailed. "/ cannot represent this image
-            ^ nil
-        ].
-        wantedPadding := fmt at:#padding.
-        wantedPadding > givenPadding ifTrue:[
-            bits := self
-                            repadBits:givenBits
-                            width:imageWidth
-                            height:imageHeight
-                            depth:imageDepth
-                            from:givenPadding
-                            to:wantedPadding.
-            padding := wantedPadding.
-        ]
+	fmt := self supportedImageFormatForDepth:4.
+	fmt isNil ifTrue:[
+	    self primitiveFailed. "/ cannot represent this image
+	    ^ nil
+	].
+	wantedPadding := fmt at:#padding.
+	wantedPadding > givenPadding ifTrue:[
+	    bits := self
+			    repadBits:givenBits
+			    width:imageWidth
+			    height:imageHeight
+			    depth:imageDepth
+			    from:givenPadding
+			    to:wantedPadding.
+	    padding := wantedPadding.
+	]
     ].
 
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
     "
      sorry; I had to separate it into 2 methods, since XPutImage needs
      an unlimited stack, and thus cannot send primitiveFailed
     "
     (self
-        primDrawBits:bits
-        bitsPerPixel:bitsPerPixel
-        depth:imageDepth
-        msb:true
-        padding:padding
-        width:imageWidth height:imageHeight
-        x:srcx y:srcy
-        into:aDrawableId
-        x:dstx y:dsty
-        width:w height:h
-        with:aGCId)
+	primDrawBits:bits
+	bitsPerPixel:bitsPerPixel
+	depth:imageDepth
+	msb:true
+	padding:padding
+	width:imageWidth height:imageHeight
+	x:srcx y:srcy
+	into:aDrawableId
+	x:dstx y:dsty
+	width:w height:h
+	with:aGCId)
     ifFalse:[
-        "
-         also happens, if a segmentation violation occurs in the
-         XPutImage ...
-        "
-        self primitiveFailedOrClosedConnection
+	"
+	 also happens, if a segmentation violation occurs in the
+	 XPutImage ...
+	"
+	self primitiveFailedOrClosedConnection
     ].
 !
 
 fillArcX:x y:y width:width height:height from:startAngle angle:angle
-               in:aDrawableId with:aGCId
+	       in:aDrawableId with:aGCId
     "fill an arc. If any coordinate is not integer, an error is triggered.
      The angles may be floats or integer - they are given in degrees."
 
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -4274,23 +4281,23 @@
     double f;
 
     if (__isSmallInteger(startAngle))
-        angle1 = __intVal(startAngle) * 64;
+	angle1 = __intVal(startAngle) * 64;
     else if (__isFloat(startAngle)) {
-        f = __floatVal(startAngle);
-        angle1 = f * 64;
+	f = __floatVal(startAngle);
+	angle1 = f * 64;
     } else if (__isShortFloat(startAngle)) {
-        f = __shortFloatVal(startAngle);
-        angle1 = f * 64;
+	f = __shortFloatVal(startAngle);
+	angle1 = f * 64;
     } else goto bad;
 
     if (__isSmallInteger(angle))
-        angle2 = __intVal(angle) * 64;
+	angle2 = __intVal(angle) * 64;
     else if (__isFloat(angle)) {
-        f = __floatVal(angle);
-        angle2 = f * 64;
+	f = __floatVal(angle);
+	angle2 = f * 64;
     } else if (__isShortFloat(angle)) {
-        f = __shortFloatVal(angle);
-        angle2 = f * 64;
+	f = __shortFloatVal(angle);
+	angle2 = f * 64;
     } else goto bad;
 
     if (ISCONNECTED
@@ -4298,20 +4305,20 @@
      && __isExternalAddress(aDrawableId)
      && __bothSmallInteger(x, y)
      && __bothSmallInteger(width, height)) {
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-        w = __intVal(width);
-        h = __intVal(height);
-        /*
-         * need this check here: some servers simply dump core with bad args
-         */
-        if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
-            ENTER_XLIB();
-            XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
-                                   w, h, angle1, angle2);
-            LEAVE_XLIB();
-        }
-        RETURN ( self );
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+	w = __intVal(width);
+	h = __intVal(height);
+	/*
+	 * need this check here: some servers simply dump core with bad args
+	 */
+	if ((w >= 0) && (h >= 0) && (angle1 >= 0) && (angle2 >= 0)) {
+	    ENTER_XLIB();
+	    XFillArc(myDpy, win, gc, __intVal(x), __intVal(y),
+				   w, h, angle1, angle2);
+	    LEAVE_XLIB();
+	}
+	RETURN ( self );
     }
     bad: ;
 %}.
@@ -4330,11 +4337,11 @@
     |numberOfPoints|
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
     numberOfPoints := aPolygon size.
 %{
@@ -4350,41 +4357,41 @@
      && __isExternalAddress(aGCId)
      && __isExternalAddress(aDrawableId)
      && __isSmallInteger(numberOfPoints)) {
-        gc = __GCVal(aGCId);
-        win = __WindowVal(aDrawableId);
-        num = __intVal(numberOfPoints);
-        if (num < 3) {
-            RETURN ( self );
-        }
-        /*
-         * avoid (slow) malloc, if not many points
-         */
-        if (num > 100) {
-            points = (XPoint *) malloc(sizeof(XPoint) * num);
-            if (! points) goto fail;
-            mustFree = 1;
-        } else
-            points = qPoints;
-        for (i=0; i<num; i++) {
-            point = __AT_(aPolygon, __MKSMALLINT(i+1));
-            if (! __isPoint(point)) goto fail;
-            x = _point_X(point);
-            y = _point_Y(point);
-            if (! __bothSmallInteger(x, y))
-                goto fail;
-            points[i].x = __intVal(x);
-            points[i].y = __intVal(y);
-        }
-        ENTER_XLIB();
-        XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
-        LEAVE_XLIB();
-        if (mustFree)
-            free(points);
-        RETURN ( self );
+	gc = __GCVal(aGCId);
+	win = __WindowVal(aDrawableId);
+	num = __intVal(numberOfPoints);
+	if (num < 3) {
+	    RETURN ( self );
+	}
+	/*
+	 * avoid (slow) malloc, if not many points
+	 */
+	if (num > 100) {
+	    points = (XPoint *) malloc(sizeof(XPoint) * num);
+	    if (! points) goto fail;
+	    mustFree = 1;
+	} else
+	    points = qPoints;
+	for (i=0; i<num; i++) {
+	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
+	    if (! __isPoint(point)) goto fail;
+	    x = _point_X(point);
+	    y = _point_Y(point);
+	    if (! __bothSmallInteger(x, y))
+		goto fail;
+	    points[i].x = __intVal(x);
+	    points[i].y = __intVal(y);
+	}
+	ENTER_XLIB();
+	XFillPolygon(myDpy, win, gc, points, num, Complex, CoordModeOrigin);
+	LEAVE_XLIB();
+	if (mustFree)
+	    free(points);
+	RETURN ( self );
 
 fail: ;
-        if (mustFree)
-            free(points);
+	if (mustFree)
+	    free(points);
     }
 %}.
     "badGC, badDrawable or coordinates not integer"
@@ -4397,11 +4404,11 @@
     <context: #return>
 
     operationsUntilFlush notNil ifTrue:[
-        operationsUntilFlush <= 0 ifTrue:[
-            self flush.
-        ] ifFalse:[
-            operationsUntilFlush := operationsUntilFlush - 1.
-        ].
+	operationsUntilFlush <= 0 ifTrue:[
+	    self flush.
+	] ifFalse:[
+	    operationsUntilFlush := operationsUntilFlush - 1.
+	].
     ].
 %{
 
@@ -4412,19 +4419,19 @@
      && __isExternalAddress(aDrawableId)
      && __bothSmallInteger(x, y)
      && __bothSmallInteger(width, height)) {
-        w = __intVal(width);
-        h = __intVal(height);
-        /*
-         * need this check here: some servers simply dump core with bad args
-         */
-        if ((w >= 0) && (h >= 0)) {
-            ENTER_XLIB();
-            XFillRectangle(myDpy,
-                           __DrawableVal(aDrawableId), __GCVal(aGCId),
-                           __intVal(x), __intVal(y), w, h);
-            LEAVE_XLIB();
-        }
-        RETURN ( self );
+	w = __intVal(width);
+	h = __intVal(height);
+	/*
+	 * need this check here: some servers simply dump core with bad args
+	 */
+	if ((w >= 0) && (h >= 0)) {
+	    ENTER_XLIB();
+	    XFillRectangle(myDpy,
+			   __DrawableVal(aDrawableId), __GCVal(aGCId),
+			   __intVal(x), __intVal(y), w, h);
+	    LEAVE_XLIB();
+	}
+	RETURN ( self );
     }
 %}.
     "badGC, badDrawable or coordinates not integer"
@@ -8598,6 +8605,8 @@
     hasImageExtension := self queryXIEExtension.
     hasInputExtension := self queryXIExtension.
     hasXineramaExtension := self queryXineramaExtension.
+    hasRenderExtension := self queryRenderExtension.
+    hasXftLibrary := self queryXftLibrary.
 
     primaryAtom := self atomIDOf:#PRIMARY.
     stringAtom := self atomIDOf:#STRING.
@@ -9005,6 +9014,38 @@
     "
 !
 
+queryXftLibrary
+%{
+#ifndef XFT
+    RETURN (false);
+#endif
+%}.
+    ^ self queryRenderExtension
+!
+
+queryRenderExtension
+%{  /* NOCONTEXT */
+
+#ifdef XRENDER
+    if (ISCONNECTED) {
+	Display *dpy;
+	int dummy;
+
+	dpy = myDpy;
+
+	if (XRenderQueryExtension (dpy, &dummy, &dummy)) {
+	    RETURN ( true );
+	}
+    }
+#endif
+%}.
+    ^ false
+
+    "
+     Display queryRenderExtension
+    "
+!
+
 querySHMExtension
 %{  /* NOCONTEXT */
 
@@ -9521,9 +9562,9 @@
     <context: #return>
 %{
     if (ISCONNECTED) {
-        ENTER_XLIB();
-        XFlush(myDpy);
-        LEAVE_XLIB();
+	ENTER_XLIB();
+	XFlush(myDpy);
+	LEAVE_XLIB();
     }
 %}.
 
@@ -9559,9 +9600,9 @@
 
     if (ISCONNECTED) {
 
-        ENTER_XLIB();
-        XSync(myDpy, 0);
-        LEAVE_XLIB();
+	ENTER_XLIB();
+	XSync(myDpy, 0);
+	LEAVE_XLIB();
 
     }
 %}.
@@ -13005,11 +13046,11 @@
 !XWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.574 2013-11-20 19:08:19 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.575 2013-11-25 10:51:46 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.574 2013-11-20 19:08:19 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.575 2013-11-25 10:51:46 cg Exp $'
 !
 
 version_SVN