XWorkstation.st
branchdelegated_gc_jv
changeset 6726 9f16fe1701f5
parent 6725 306fd90ac185
child 6800 f4acb46ba42e
--- a/XWorkstation.st	Fri Dec 26 22:39:28 2014 +0100
+++ b/XWorkstation.st	Fri Dec 26 22:46:49 2014 +0100
@@ -50,13 +50,6 @@
 	privateIn:XWorkstation
 !
 
-DeviceGraphicsContext subclass:#XGraphicsContext
-	instanceVariableNames:'xftDrawId'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:XWorkstation
-!
-
 !XWorkstation primitiveDefinitions!
 %{
 
@@ -13464,158 +13457,6 @@
     ^ true
 ! !
 
-!XWorkstation::XGraphicsContext methodsFor:'accessing'!
-
-xftDrawId
-    ^ xftDrawId
-!
-
-xftDrawId:anXftDrawHandle
-    xftDrawId := anXftDrawHandle.
-
-    "Modified (format): / 23-06-2014 / 21:28:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!XWorkstation::XGraphicsContext methodsFor:'displaying'!
-
-displayString:aString x:x y:y opaque:opaque
-    "draw a string - if opaque is false, draw foreground only; otherwise, draw both
-     foreground and background characters.
-     If the coordinates are not integers, an error is triggered."
-
-    <context: #return>
-
-    |displayId|
-
-    device flushIfAppropriate.
-    displayId := device displayIdOrErrorIfBroken.
-
-%{
-#if 0
-    GC gc;
-    Window win;
-    char *cp;
-    int n;
-    OBJ cls;
-#   define NLOCALBUFFER 200
-    XChar2b xlatebuffer[NLOCALBUFFER];
-    int nInstBytes;
-
-    if (displayId != nil
-     && __isExternalAddress(__INST(gcId))
-     && __isExternalAddress(__INST(drawableId))
-     && __isNonNilObject(aString)
-     && __bothSmallInteger(x, y)) {
-	int lMax = __intVal(@global(XWorkstation:MaxStringLength));
-	Display *dpy = __DisplayVal(displayId);
-	gc = __GCVal(__INST(gcId));
-	win = __WindowVal(__INST(drawableId));
-
-	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
-	     */
-#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)
-# 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 );
-	}
-    }
-#undef NLOCALBUFFER
-#endif
-%}.
-    ^ super displayString:aString x:x y:y opaque:opaque
-! !
-
-!XWorkstation::XGraphicsContext methodsFor:'initialization & release'!
-
-prepareForReinit
-    "kludge - clear drawableId and gcId
-     needed after snapin"
-
-    super prepareForReinit.
-    xftDrawId := nil.
-
-    "Created: / 09-10-2014 / 00:02:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !XWorkstation class methodsFor:'documentation'!
 
 version