timeout handling changed
authorClaus Gittinger <cg@exept.de>
Tue, 14 Sep 2004 14:30:34 +0200
changeset 4245 d28b613dfc06
parent 4244 f1bdf99773bd
child 4246 23102cca7600
timeout handling changed
XWorkstation.st
--- a/XWorkstation.st	Tue Sep 14 14:07:24 2004 +0200
+++ b/XWorkstation.st	Tue Sep 14 14:30:34 2004 +0200
@@ -22,9 +22,9 @@
 		eventRootY displayName eventTrace dispatchingExpose rgbVisual
 		virtualRootId rootId altModifierMask metaModifierMask
 		multiClickTime deviceIOTimeoutErrorSignal activateOnClick
-		rawKeySymTranslation selectionOwner'
+		rawKeySymTranslation selectionOwner xlibTimeout xlibTimeoutForWindowCreation'
 	classVariableNames:'RawKeySymTranslation ConservativeSync MaxStringLength
-		SelectionHandlers'
+		SelectionHandlers DefaultXLibTimeout DefaultXLibTimeoutForWindowCreation'
 	poolDictionaries:''
 	category:'Interface-Graphics'
 !
@@ -194,20 +194,29 @@
 int __XErrorHandler__();
 int __XIOErrorHandler__();
 
-#define DEFAULT_XLIB_TIMEOUT   600     /* in 50ms ticks (30 seconds) */
-  static __xlibTimeout__ = DEFAULT_XLIB_TIMEOUT;
-
-#define ENTER_XLIB()   \
+/*
+ * these two macros should be placed around X-lib calls,
+ * which may block due to a broken connection.
+ * They setup/remove a VM-timeout which raises an exception
+ * after xlibTimeout seconds.
+ * This exception will shutDown the connection.
+ * Q: is this a good idea for the local display ?
+ */
+#define __ENTER_XLIB(whichTimeout)   \
     { \
 	__blockingPrimitiveTimoutHandler__ = (VOIDFUNC)__XTimeoutErrorHandler; \
 	__blockingPrimitiveTimeoutArg__ = (INT)self; \
-	__blockingPrimitiveTimeout__ = __xlibTimeout__; \
+	__blockingPrimitiveTimeout__ = __intVal(__INST(whichTimeout)) * 50; \
     } {
+
 #define LEAVE_XLIB()   \
     { \
 	__blockingPrimitiveTimeout__ = 0; \
     } }
 
+#define ENTER_XLIB()   __ENTER_XLIB(xlibTimeout)
+#define ENTER_XLIB2()  __ENTER_XLIB(xlibTimeoutForWindowCreation)
+
 #ifdef SUPPORT_MOTIF_WM_HINTS
 # ifdef SOME_MACHINE
 #  include <anIncludeFileWhichDefinesTheStuffBelow>
@@ -292,7 +301,7 @@
 #ifndef ELF
 
 # ifdef __GNUC__
-VOLATILE 
+VOLATILE
 # endif
 static
 dummyToForceLoading() {
@@ -335,7 +344,7 @@
     lastMinorCode = event->minor_code;
     lastResource = event->resourceid;
     if ((event->error_code == BadWindow) && (lastRequestCode == 4) && (lastMinorCode == 0)) {
-	/* 
+	/*
 	 * this is a BadWindow error for X_DestroyWindow.
 	 * ignore it here, since it results from the GC freeing windows
 	 * in non bottom-up window order.
@@ -345,9 +354,9 @@
 
     if (@global(ErrorPrinting) == true) {
 	fprintf(stderr, "XWorkstation [error]: x-error caught maj=%d (0x%x) min=%d (0x%x) resource=%x\n",
-			event->request_code, event->request_code, 
+			event->request_code, event->request_code,
 			event->minor_code, event->minor_code, event->resourceid);
-	fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n", 
+	fprintf(stderr, "XWorkstation [error]: x-error message is [%d] '%s'\n",
 			event->error_code, lastErrorMsg);
     }
 
@@ -402,17 +411,20 @@
 __XTimeoutErrorHandler(displayDeviceInst)
     OBJ displayDeviceInst;
 {
+    extern OBJ __GLOBAL_GET_BY_NAME();
+
     if (@global(ErrorPrinting) == true) {
 	fprintf(stderr, "XWorkstation [error]: I/O request timeout dpy=%x\n", displayDeviceInst);
     }
-    if (displayDeviceInst == @global(MainDisplay)) {
+    if ((displayDeviceInst == @global(MainDisplay))
+     || (displayDeviceInst == __GLOBAL_GET_BY_NAME("Display"))) {  /* cannot use global(Display), because Display is a typedef in Xlib */
 	fprintf(stderr, "XWorkstation [error]: keep display connection for master display (no shutdown)\n");
 	return;
     }
 
 #if 0
 
-This is litter: 
+This is litter:
     1. How should I ever close the display without a displayId?
 
     2. This may loop for ever, if there is some data in the socket, but #eventPending returns
@@ -514,13 +526,28 @@
 documentation
 "
     this class provides the interface to X11. It redefines all required methods
-    from DeviceWorkstation. Notice, that in Smalltalk/X you are not technically
-    limited to one display - in theory, you can create Views on many displays
+    from DeviceWorkstation.
+    Notice, that in Smalltalk/X you are not technically limited to one display;
+    in theory (and in our practice), you can create Views on many displays
     simultanously. However, the default setup is for one display only.
     To support multiple displays, you will have to start another event dispatcher
     process for the other display(s) and create the other views with a slightly
-    different protocol. However, 'normal' applications do not have to care for
-    all of this ...
+    different protocol (ApplicationModel openOnDevice:) or by temporarily answering
+    the other device to the currentScreen query.
+    Therefore, 'normal' applications do not have to care for all of this, as the currentScreen
+    query is answered by the launcher when opening its applications.
+
+    Timeouts:
+	sometimes, X-connections are lost and, as the Xlib is blocking and synchronous by
+	default, this would lead to a locked ST/X system.
+	Therefore, this class defines a timeOut, whenever doing an Xlib call.
+	The default for this timeout is 30seconds.
+	This may be a problem with windowmanagers which show a rubber-band rectangle
+	when creating windows.
+	If the user does not specify the rectangle within 30 seconds, the device assumes
+	a timeout and closes the connection.
+	As a (kludgy) workaround, a second timeout value is used for window-creation.
+	This secondary timeout value defaults to 60*5 seconds (5 minutes).
 
     See more documentation in my superclass, DeviceWorkstation.
 
@@ -540,9 +567,13 @@
     "/ the following is an adjustable soft-limit.
     MaxStringLength := 4096.
 
+    "/ shutdown the X-connection, when no response is received after that many seconds.
+    DefaultXLibTimeout := 30.
+    DefaultXLibTimeoutForWindowCreation := 5*60.
+
     RawKeySymTranslation isNil ifTrue:[
 	"/ the following table maps X-keyevents to ST/X
-	"/ device independend events. 
+	"/ device independend events.
 	"/ It is NOT meant as a keyboardMap replacement.
 
 	RawKeySymTranslation := d := Dictionary new.
@@ -587,13 +618,19 @@
 !
 
 getConnectionTimeOut
-%{
-    RETURN (__MKSMALLINT(__xlibTimeout__ / 50));
-%}
+    "returns the default connectionTimeOut (seconds)"
+
+    ^ DefaultXLibTimeout
+!
+
+getConnectionTimeOutForWindowCreation
+    "returns the default connectionTimeOut (seconds)"
+
+    ^ DefaultXLibTimeoutForWindowCreation
 !
 
 lastErrorString
-    "return the last X-error string - 
+    "return the last X-error string -
      when buffering is on, this may be
      an error for a long-ago operation"
 
@@ -634,23 +671,29 @@
 resourceIdOfLastError
     %{  /* NOCONTEXT */
 
-        if (lastResource != 0) {
-            RETURN ( __MKEXTERNALADDRESS(lastResource) );
-        }
+	if (lastResource != 0) {
+	    RETURN ( __MKEXTERNALADDRESS(lastResource) );
+	}
     %}.
 
     ^ nil
 
 
     "
-        Screen resourceIdOfLastError
+	Screen resourceIdOfLastError
     "
 !
 
 setConnectionTimeOut:seconds
-%{
-    __xlibTimeout__ = __intVal(seconds) * 50;
-%}
+    "set the default connection timeout (seconds)"
+
+    DefaultXLibTimeout := seconds
+!
+
+setConnectionTimeOutForWindowCreation:seconds
+    "set the default connection timeout (seconds)"
+
+    DefaultXLibTimeoutForWindowCreation := seconds
 ! !
 
 !XWorkstation class methodsFor:'queries'!
@@ -788,7 +831,7 @@
 
 displayName
     "return the X-connections display name.
-     This is (currently) nil for the default display, 
+     This is (currently) nil for the default display,
      something like foo:0 for any other remote display.
      Future versions may return non-nil strings for the default display as well."
 
@@ -866,7 +909,7 @@
 	w1 = __WindowVal(windowId1);
 	w2 = __WindowVal(windowId2);
 
-#ifdef VIRTUAL_ROOT 
+#ifdef VIRTUAL_ROOT
 	rootWin = RootWindow(dpy, screen);
 	if (w1 == rootWin) {
 	    ENTER_XLIB();
@@ -882,7 +925,7 @@
 
 	ENTER_XLIB();
 	XTranslateCoordinates(dpy, w1, w2,
-			      __intVal(x1), __intVal(y1), 
+			      __intVal(x1), __intVal(y1),
 			      &xpos, &ypos, &child_ret);
 	LEAVE_XLIB();
 
@@ -938,7 +981,7 @@
 	    XTranslateCoordinates(dpy,
 				  RootWindow(dpy, screen),
 				  __WindowVal(windowId),
-				  __intVal(xp), __intVal(yp), 
+				  __intVal(xp), __intVal(yp),
 				  &xpos, &ypos, &child_ret);
 	    LEAVE_XLIB();
 
@@ -970,7 +1013,7 @@
 
 %{
     if (ISCONNECTED
-     && (__INST(rootId) != __INST(virtualRootId)) 
+     && (__INST(rootId) != __INST(virtualRootId))
      && __isExternalAddress(__INST(virtualRootId))) {
 	Window vRootWin;
 	Window root;
@@ -996,6 +1039,22 @@
     "return the colornumber of white"
 
     ^ whitepixel
+!
+
+xlibTimeout
+    ^ xlibTimeout
+!
+
+xlibTimeout:seconds
+    xlibTimeout := seconds
+!
+
+xlibTimeoutForWindowCreation
+    ^ xlibTimeoutForWindowCreation
+!
+
+xlibTimeoutForWindowCreation:seconds
+    xlibTimeoutForWindowCreation := seconds
 ! !
 
 !XWorkstation methodsFor:'accessing-display capabilities'!
@@ -1008,7 +1067,7 @@
     ^ hasDPSExtension
 
     "
-     Display hasDPS 
+     Display hasDPS
     "
 !
 
@@ -1036,14 +1095,14 @@
 %}
 
     "
-     Display hasExtension:'XVideo' 
-     Display hasExtension:'Input' 
-     Display hasExtension:'GLX' 
-     Display hasExtension:'X3D-PEX' 
-     Display hasExtension:'XInputExtension' 
-     Display hasExtension:'SHAPE' 
-     Display hasExtension:'MIT-SHM' 
-     Display hasExtension:'SGIFullScreenStereo' 
+     Display hasExtension:'XVideo'
+     Display hasExtension:'Input'
+     Display hasExtension:'GLX'
+     Display hasExtension:'X3D-PEX'
+     Display hasExtension:'XInputExtension'
+     Display hasExtension:'SHAPE'
+     Display hasExtension:'MIT-SHM'
+     Display hasExtension:'SGIFullScreenStereo'
     "
 !
 
@@ -1055,7 +1114,7 @@
     ^ hasImageExtension
 
     "
-     Display hasImageExtension 
+     Display hasImageExtension
     "
 !
 
@@ -1067,7 +1126,7 @@
     ^ hasInputExtension
 
     "
-     Display hasInputExtension 
+     Display hasInputExtension
     "
 !
 
@@ -1079,7 +1138,7 @@
     ^ hasMbufExtension
 
     "
-     Display hasMultibuffer 
+     Display hasMultibuffer
     "
 !
 
@@ -1091,7 +1150,7 @@
     ^ hasPEXExtension
 
     "
-     Display hasPEX 
+     Display hasPEX
     "
 !
 
@@ -1103,7 +1162,7 @@
     ^ hasShmExtension
 
     "
-     Display hasShm 
+     Display hasShm
     "
 !
 
@@ -1115,7 +1174,7 @@
     ^ hasXVideoExtension
 
     "
-     Display hasXVideo 
+     Display hasXVideo
     "
 !
 
@@ -1210,8 +1269,8 @@
 !
 
 supportedImageFormats
-    "return an array with supported image formats; 
-     each array entry is an attribute dictionary, consisting of 
+    "return an array with supported image formats;
+     each array entry is an attribute dictionary, consisting of
      depth, bitsPerPixel and padding values."
 
     |nFormats "{ Class: SmallInteger }"
@@ -1260,7 +1319,7 @@
     ^ formatArray
 
     "
-     Display supportedImageFormats 
+     Display supportedImageFormats
     "
 !
 
@@ -1275,14 +1334,14 @@
 
 supportsArbitraryShapedViews
     "return true, if this workstation supports arbitrary shaped windows.
-     Both the server must support it (the shape-extension), 
-     and the feature must have been enabled in the smalltalk system, 
+     Both the server must support it (the shape-extension),
+     and the feature must have been enabled in the smalltalk system,
      for true to be returned."
 
     ^ hasShapeExtension
 
     "
-     Display supportsArbitraryShapedViews   
+     Display supportsArbitraryShapedViews
     "
 !
 
@@ -1293,7 +1352,7 @@
     ^ true
 
     "
-     Display supportsIconViews 
+     Display supportsIconViews
     "
 
     "Modified: 10.6.1996 / 20:11:48 / cg"
@@ -1302,7 +1361,7 @@
 
 supportsMaskedDrawingWith:aForm
     "return true, if the device allows the given form pixmap
-     to be used as paint color. 
+     to be used as paint color.
      True returned here - X has no trouble with any mask."
 
     ^ true
@@ -1312,7 +1371,7 @@
 
 supportsViewBackgroundPixmap:aForm
     "return true, if the device allows the given pixmap as
-     viewBackground. 
+     viewBackground.
      True returned here - X support any size."
 
     ^ true
@@ -1394,7 +1453,7 @@
 
     <context: #return>
 
-%{  
+%{
     int screen = __intVal(__INST(screen));
     Pixmap newBitmap;
 
@@ -1423,7 +1482,7 @@
      (i.e. random). Return a bitmap id or nil"
 
     <context: #return>
-%{  
+%{
 
     int screen = __intVal(__INST(screen));
     Pixmap newBitmap;
@@ -1451,7 +1510,7 @@
 createWindowFor:aView type:typeSymbol
 		 origin:origin
 		 extent:extent
-		 minExtent:minExt 
+		 minExtent:minExt
 		 maxExtent:maxExt
 		 borderWidth:bWidth
 		 subViewOf:wsuperView
@@ -1464,7 +1523,7 @@
 
     <context: #return>
 
-    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight 
+    |xpos ypos wwidth wheight minWidth minHeight maxWidth maxHeight
      bColorId wsuperViewId wiconId wiconMaskId windowId
      weventMask wiconViewId bitGravity viewGravity vBgColor
      vBgForm deepForm preferredVisual preferredDepth|
@@ -1525,7 +1584,7 @@
     Window newWindow, parentWindow;
     char *windowName;
     XFontStruct *f;
-    Pixmap backPixmap = (Pixmap)0, 
+    Pixmap backPixmap = (Pixmap)0,
 	   iconBitmap = (Pixmap)0,
 	   iconMask = (Pixmap)0;
     int flags = 0, depth, ioClass;
@@ -1581,12 +1640,12 @@
 
     if (wStyle == @symbol(popUp))
 	xswa.override_redirect = 1;
-    else 
+    else
 	xswa.override_redirect = 0;
 
-    if (winputOnly == true) 
+    if (winputOnly == true)
 	ioClass = InputOnly;
-    else 
+    else
 	ioClass = InputOutput;
 
     if (__isSmallInteger(weventMask)) {
@@ -1625,15 +1684,15 @@
 
 	if (preferredVisual == @symbol(StaticGray))
 	    cls = StaticGray;
-	else if (preferredVisual == @symbol(GrayScale)) 
+	else if (preferredVisual == @symbol(GrayScale))
 	    cls = GrayScale;
-	else if (preferredVisual == @symbol(StaticColor)) 
+	else if (preferredVisual == @symbol(StaticColor))
 	    cls = StaticColor;
-	else if (preferredVisual == @symbol(PseudoColor)) 
+	else if (preferredVisual == @symbol(PseudoColor))
 	    cls = PseudoColor;
-	else if (preferredVisual == @symbol(TrueColor)) 
+	else if (preferredVisual == @symbol(TrueColor))
 	    cls = TrueColor;
-	else if (preferredVisual == @symbol(DirectColor)) 
+	else if (preferredVisual == @symbol(DirectColor))
 	    cls = DirectColor;
 	else
 	    cls = PseudoColor;
@@ -1648,7 +1707,7 @@
 	LEAVE_XLIB();
     }
 
-    ENTER_XLIB();
+    ENTER_XLIB2();
     newWindow = XCreateWindow(dpy, parentWindow,
 			   sizehints.x, sizehints.y,
 			   sizehints.width, sizehints.height,
@@ -1832,7 +1891,7 @@
 destroyGC:aGCId
 
     <context: #return>
-%{ 
+%{
 
     if (! ISCONNECTED) {
 	RETURN ( self );
@@ -1894,7 +1953,7 @@
 
     <context: #return>
 
-%{ 
+%{
 #ifdef XXDPS
     int screen = __intVal(__INST(screen));
     DPSContext dps;
@@ -1924,7 +1983,7 @@
 gcFor:aDrawableId
 
     <context: #return>
-%{  
+%{
     int screen = __intVal(__INST(screen));
     GC gc;
 
@@ -2040,7 +2099,7 @@
 
 	ENTER_XLIB();
 	newBitmap = XCreateBitmapFromData(dpy, RootWindow(dpy, screen),
-					       (char *)b_bits, 
+					       (char *)b_bits,
 					       b_width, b_height);
 	LEAVE_XLIB();
 #ifdef COUNT_RESOURCES
@@ -2121,7 +2180,7 @@
 
 rootWindowId
     "return the id of the root window.
-     This is the window you see as background, 
+     This is the window you see as background,
      however, it may or may not be the real physical root window,
      since some window managers install a virtual root window on top
      of the real one. If this is the case, that views id is returned here."
@@ -2171,10 +2230,10 @@
 		unsigned long nitems, bytesafter;
 		unsigned char *retVal = 0;
 
-		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom, 
+		ignoreVRoot = XGetWindowProperty(dpy, rootWin, kwinAtom,
 				       0L, 1L, False, kwinAtom,
-				       &actual_type, &actual_format, 
-				       &nitems, &bytesafter, &retVal) == Success 
+				       &actual_type, &actual_format,
+				       &nitems, &bytesafter, &retVal) == Success
 			      && actual_type != 0;
 		if (retVal)
 		    XFree(retVal);
@@ -2183,8 +2242,8 @@
 	    if (!ignoreVRoot) {
 		vRootAtom = XInternAtom(dpy, "__SWM_VROOT", True);
 		if (vRootAtom != None) {
-		    if (XQueryTree(dpy, rootWin, 
-				       &rootReturn, &parentReturn, 
+		    if (XQueryTree(dpy, rootWin,
+				       &rootReturn, &parentReturn,
 				       &children, &numChildren)) {
 			for (i=0; i < numChildren; i++) {
 			    Atom actual_type;
@@ -2193,15 +2252,15 @@
 			    Window* newRoot = (Window*) 0;
 
 			    if (children[i]) {
-				if (XGetWindowProperty(dpy, children[i], vRootAtom, 
+				if (XGetWindowProperty(dpy, children[i], vRootAtom,
 						       0L, 1L, False, XA_WINDOW,
-						       &actual_type, &actual_format, 
+						       &actual_type, &actual_format,
 						       &nitems, &bytesafter,
 						       (unsigned char**) &newRoot
 						      ) == Success && newRoot) {
 				    vRootWin = *newRoot;
 				    XFree(newRoot); /* XXX */
-				    break; 
+				    break;
 				}
 			    }
 			}
@@ -2268,7 +2327,7 @@
      Dont use this method, colornames are mostly X specific"
 
     <context: #return>
-%{  
+%{
 
     char *colorname;
     XColor scolor, ecolor;
@@ -2324,7 +2383,7 @@
     Status ok;
     int id;
 
-    if (__bothSmallInteger(r, g) 
+    if (__bothSmallInteger(r, g)
      && __isSmallInteger(b)
      && ISCONNECTED) {
 	ecolor.red = __intVal(r);
@@ -2363,8 +2422,8 @@
     ^ (100.0 * aDeviceValue / 16rFFFF)
 
     "
-     Display deviceColorValueToPercent:0      
-     Display deviceColorValueToPercent:16r8000      
+     Display deviceColorValueToPercent:0
+     Display deviceColorValueToPercent:16r8000
      Display deviceColorValueToPercent:16rFFFF
     "
 !
@@ -2429,7 +2488,7 @@
 	LEAVE_XLIB();
 
 
-	/* 
+	/*
 	 * have to compensate for an error in X ?, which does not scale
 	 * colors correctly if lesser than 16bits are valid in a color,
 	 * (for example, color white on a 4bitsPerRGB server will Return
@@ -2463,11 +2522,11 @@
      && __isNonNilObject(colorName)
      && (__qIsString(colorName) || __qIsSymbol(colorName))) {
 	Display *dpy = myDpy;
-        
-
-	if (XParseColor(dpy, DefaultColormap(dpy, screen), 
+
+
+	if (XParseColor(dpy, DefaultColormap(dpy, screen),
 			     (char *) __stringVal(colorName), &color)) {
-	    /* 
+	    /*
 	     * have to compensate for an error in X ?, which does not scale
 	     * colors correctly if lesser than 16bits are valid in a color,
 	     * (for example, color white on a 4bitsPerRGB server will Return
@@ -2548,7 +2607,7 @@
      This method is a noop for StaticGrey, StaticGrey and TrueColor displays."
 
     <context: #return>
-%{ 
+%{
 
     char *colorname;
     XColor color;
@@ -2604,26 +2663,26 @@
 	#upRightHand            "/ XC_hand1
 	#upDownArrow            "/ XC_sb_v_double_arrow
 	#leftRightArrow         "/ XC_sb_h_double_arrow
-	#upLimitArrow           "/ XC_top_side         
-	#downLimitArrow         "/ XC_bottom_side   
+	#upLimitArrow           "/ XC_top_side
+	#downLimitArrow         "/ XC_bottom_side
 	#leftLimitArrow         "/ XC_left_side
 	#rightLimitArrow        "/ XC_right_side
-	#text                   "/ XC_xterm     
+	#text                   "/ XC_xterm
 	#upRightArrow           "/ XC_draft_large
-	#leftHand               "/ XC_hand2   
+	#leftHand               "/ XC_hand2
 	#questionMark           "/ XC_question_arrow
-	#cross                  "/ XC_X_cursor    
-	#wait                   "/ XC_watch   
-	#crossHair              "/ XC_tcross  
+	#cross                  "/ XC_X_cursor
+	#wait                   "/ XC_watch
+	#crossHair              "/ XC_tcross
 	#origin                 "/ XC_ul_angle
-	#topLeft                "/ XC_ul_angle    
+	#topLeft                "/ XC_ul_angle
 	#corner                 "/ XC_lr_angle
-	#bottomRight            "/ XC_lr_angle      
-	#topRight               "/ XC_ur_angle    
-	#bottomLeft             "/ XC_ll_angle      
-	#square                 "/ XC_dotbox     
-	#fourWay                "/ XC_fleur     
-	#crossCursor            "/ XC_X_cursor 
+	#bottomRight            "/ XC_lr_angle
+	#topRight               "/ XC_ur_angle
+	#bottomLeft             "/ XC_ll_angle
+	#square                 "/ XC_dotbox
+	#fourWay                "/ XC_fleur
+	#crossCursor            "/ XC_X_cursor
       )
 
     "Created: 8.4.1997 / 10:12:30 / cg"
@@ -2649,7 +2708,7 @@
     if (ISCONNECTED
      && __isExternalAddress(aCursorId)
      && __bothSmallInteger(fgG, fgB)
-     && __bothSmallInteger(bgR, bgG) 
+     && __bothSmallInteger(bgR, bgG)
      && __bothSmallInteger(bgB, fgR)) {
 
 	fgcolor.red = __intVal(fgR);
@@ -2685,9 +2744,9 @@
     "create a cursor given 2 bitmaps (source, mask) and a hotspot"
 
     ^ self
-	primCreateCursorSourceFormId:sourceForm id 
+	primCreateCursorSourceFormId:sourceForm id
 	maskFormId:maskForm id
-	hotX:hx hotY:hy 
+	hotX:hx hotY:hy
 	width:w height:h
 !
 
@@ -2945,14 +3004,14 @@
 
 	self
 	    setProperty:(self atomIDOf:#DndSelection)
-	    type:(self atomIDOf:#STRING) 
-	    value:val 
+	    type:(self atomIDOf:#STRING)
+	    value:val
 	    for:rootId.
 
 	^ self
-	    sendClientEvent:msgType 
-	    format:32 
-	    to:destinationId 
+	    sendClientEvent:msgType
+	    format:32
+	    to:destinationId
 	    data1:dropTypeCode
 	    data2:0
 	    data3:destinationId
@@ -2969,7 +3028,7 @@
 dndDropTypes
     "return the dropTypes as supported by DND"
 
-    ^ #( 
+    ^ #(
 	    DndUnknown      "/ 0
 	    DndRawData      "/ 1
 	    DndFile         "/ 2
@@ -2993,10 +3052,10 @@
     "/
     (self atomIDOf:#DndProtocol) notNil ifTrue:[
 	^ self
-	    dndDrop:aCollectionOfDropObjects 
-	    inWindowID:destinationId 
-	    position:destinationPoint 
-	    rootPosition:rootPoint        
+	    dndDrop:aCollectionOfDropObjects
+	    inWindowID:destinationId
+	    position:destinationPoint
+	    rootPosition:rootPoint
     ].
 
     "/ add more drag&drop protocols here.
@@ -3059,7 +3118,7 @@
      This is basically the same as copyFromId:..., but does not generate expose events."
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     Drawable source, dest;
@@ -3094,14 +3153,14 @@
 !
 
 copyPlaneFromId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
-    "do a bit-blt, but only copy the low-bit plane; 
+    "do a bit-blt, but only copy the low-bit plane;
      copy bits from the rectangle defined by
      srcX/srcY and w/h from the sourceId drawable to the rectangle
      below dstX/dstY in the destId drawable. Trigger an error if any
      argument is not integer."
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     Drawable source, dest;
@@ -3132,7 +3191,7 @@
 !
 
 copyPlaneFromPixmapId:sourceId x:srcX y:srcY gc:srcGCId to:destId x:dstX y:dstY gc:dstGCId width:w height:h
-    "do a bit-blt from a pix- or bitmap, but only copy the low-bit plane; 
+    "do a bit-blt from a pix- or bitmap, but only copy the low-bit plane;
      copy bits from the rectangle defined by
      srcX/srcY and w/h from the sourceId drawable to the rectangle
      below dstX/dstY in the destId drawable. Trigger an error if any
@@ -3140,7 +3199,7 @@
      This is the same as copyPlaneFromId:..., but does not generate graphics exposes"
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     Drawable source, dest;
@@ -3179,7 +3238,7 @@
      The angles may be floats or integer - they are given in degrees."
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     Window win;
@@ -3235,7 +3294,7 @@
 !
 
 displayLineFromX:x0 y:y0 toX:x1 y:y1 in:aDrawableId with:aGCId
-    "draw a line. If the coordinates are not integers, an error is triggered." 
+    "draw a line. If the coordinates are not integers, an error is triggered."
 
     <context: #return>
 %{
@@ -3313,11 +3372,11 @@
 	gc = __GCVal(aGCId);
 	win = __WindowVal(aDrawableId);
 
-	if( __isSmallInteger(scaleY) ) 
+	if( __isSmallInteger(scaleY) )
 	    sY = (float) __intVal( scaleY );
-	else if (__isFloat(scaleY)) 
+	else if (__isFloat(scaleY))
 	    sY = __floatVal( scaleY );
-	else if (__isShortFloat(scaleY)) 
+	else if (__isShortFloat(scaleY))
 	    sY = __shortFloatVal( scaleY );
 	else {
 	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
@@ -3325,11 +3384,11 @@
 	    sY = __floatVal( t );
 	}
 
-	if( __isSmallInteger(transY) ) 
+	if( __isSmallInteger(transY) )
 	    tY = (float) __intVal( transY );
-	else if (__isFloat(transY)) 
+	else if (__isFloat(transY))
 	    tY = __floatVal( transY );
-	else if (__isShortFloat(transY)) 
+	else if (__isShortFloat(transY))
 	    tY = __shortFloatVal( transY );
 	else {
 	    t = __SSEND0(transY, @symbol(asFloat), 0);
@@ -3337,11 +3396,11 @@
 	    tY = __floatVal( t );
 	}
 
-	if( __isSmallInteger(startX) ) 
+	if( __isSmallInteger(startX) )
 	    x = (float) __intVal( startX );
-	else if (__isFloat(startX)) 
+	else if (__isFloat(startX))
 	    x = __floatVal( startX );
-	else if (__isShortFloat(startX)) 
+	else if (__isShortFloat(startX))
 	    x = __shortFloatVal( startX );
 	else {
 	    t = __SSEND0(startX, @symbol(asFloat), 0);
@@ -3349,11 +3408,11 @@
 	    x = __floatVal( t );
 	}
 
-	if( __isSmallInteger(stepX) ) 
+	if( __isSmallInteger(stepX) )
 	    step = (float) __intVal( stepX );
-	else if (__isFloat(stepX)) 
+	else if (__isFloat(stepX))
 	    step = __floatVal( stepX );
-	else if (__isShortFloat(stepX)) 
+	else if (__isShortFloat(stepX))
 	    step = __shortFloatVal( stepX );
 	else {
 	    t = __SSEND0(stepX, @symbol(asFloat), 0);
@@ -3421,10 +3480,10 @@
 !
 
 displayPointX:x y:y in:aDrawableId with:aGCId
-    "draw a point. If x/y are not integers, an error is triggered." 
-
-    <context: #return>
-%{  
+    "draw a point. If x/y are not integers, an error is triggered."
+
+    <context: #return>
+%{
 
     GC gc;
     Window win;
@@ -3532,10 +3591,10 @@
 !
 
 displayRectangleX:x y:y width:width height:height in:aDrawableId with:aGCId
-    "draw a rectangle. If the coordinates are not integers, an error is triggered." 
-
-    <context: #return>
-%{  
+    "draw a rectangle. If the coordinates are not integers, an error is triggered."
+
+    <context: #return>
+%{
 
     GC gc;
     Window win;
@@ -3577,13 +3636,13 @@
     self primitiveFailedOrClosedConnection
 !
 
-displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque 
+displayString:aString from:index1 to:index2 x:x y:y in:aDrawableId with:aGCId opaque:opaque
     "draw a sub-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>
-%{  
+%{
 
     GC gc;
     Window win;
@@ -3677,7 +3736,7 @@
 		     * convert as required
 		     */
 		    u.s = 0x1234;
-		    if (u.b[0] != 0x12) 
+		    if (u.b[0] != 0x12)
 # endif
 		    {
 			if (l <= NLOCALBUFFER) {
@@ -3693,12 +3752,12 @@
 			cp = (char *) cp2;
 		    }
 #endif
-		    ENTER_XLIB();  
+		    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();  
+		    LEAVE_XLIB();
 
 		    if (mustFree) {
 			free(cp2);
@@ -3744,12 +3803,12 @@
 		    }
 		    cp = (char *) cp2;
 
-		    ENTER_XLIB();  
+		    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();  
+		    LEAVE_XLIB();
 
 		    if (mustFree) {
 			free(cp2);
@@ -3772,13 +3831,13 @@
     self primitiveFailedOrClosedConnection
 !
 
-displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque 
+displayString:aString x:x y:y in:aDrawableId with:aGCId 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>
-%{  
+%{
 
     GC gc;
     Window win;
@@ -3855,7 +3914,7 @@
 	     * convert as required
 	     */
 	    u.s = 0x1234;
-	    if (u.b[0] != 0x12) 
+	    if (u.b[0] != 0x12)
 # endif
 	    {
 		if (n <= NLOCALBUFFER) {
@@ -3889,15 +3948,15 @@
     }
 #undef NLOCALBUFFER
 %}.
-    ^ super displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque 
+    ^ super displayString:aString x:x y:y in:aDrawableId with:aGCId opaque:opaque
 !
 
 drawBits:givenBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:givenPadding
-	width:imageWidth height:imageHeight 
+	width:imageWidth height:imageHeight
 	x:srcx y:srcy
-	into:aDrawableId 
-	x:dstx y:dsty 
-	width:w height:h 
+	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
@@ -3927,9 +3986,9 @@
 	].
 	wantedPadding := fmt at:#padding.
 	wantedPadding > givenPadding ifTrue:[
-	    bits := self 
-			    repadBits:givenBits 
-			    width:imageWidth 
+	    bits := self
+			    repadBits:givenBits
+			    width:imageWidth
 			    height:imageHeight
 			    depth:imageDepth
 			    from:givenPadding
@@ -3942,21 +4001,21 @@
      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 
+    (self
+	primDrawBits:bits
+	bitsPerPixel:bitsPerPixel
+	depth:imageDepth
+	msb:true
 	padding:padding
-	width:imageWidth height:imageHeight 
+	width:imageWidth height:imageHeight
 	x:srcx y:srcy
-	into:aDrawableId 
-	x:dstx y:dsty 
-	width:w height:h 
+	into:aDrawableId
+	x:dstx y:dsty
+	width:w height:h
 	with:aGCId)
     ifFalse:[
 	"
-	 also happens, if a segmentation violation occurs in the 
+	 also happens, if a segmentation violation occurs in the
 	 XPutImage ...
 	"
 	self primitiveFailedOrClosedConnection
@@ -3969,7 +4028,7 @@
      The angles may be floats or integer - they are given in degrees."
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     Window win;
@@ -4025,7 +4084,7 @@
 !
 
 fillPolygon:aPolygon in:aDrawableId with:aGCId
-    "fill a polygon given by its points. 
+    "fill a polygon given by its points.
      If any coordinate is not integer, an error is triggered."
 
     <context: #return>
@@ -4091,7 +4150,7 @@
     "fill a rectangle. If any coordinate is not integer, an error is triggered."
 
     <context: #return>
-%{ 
+%{
 
     int w, h;
 
@@ -4121,8 +4180,8 @@
 
 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb masks:maskArray padding:bitPadding
 			     extent:imageExtent sourceOrigin:srcOrg
-			       into:aDrawableId 
-		  destinationOrigin:dstOrg extent:dstExtent 
+			       into:aDrawableId
+		  destinationOrigin:dstOrg extent:dstExtent
 			       with:aGCId
 
     <context: #return>
@@ -4141,7 +4200,7 @@
     w := dstExtent x.
     h := dstExtent y.
 
-    "since XPutImage may allocate huge amount of stack space 
+    "since XPutImage may allocate huge amount of stack space
      (some implementations use alloca), this must run with unlimited stack."
 
 %{  /* UNLIMITEDSTACK */
@@ -4172,7 +4231,7 @@
 
 	gc = __GCVal(aGCId);
 	win = __WindowVal(aDrawableId);
-	if (! gc || !win) 
+	if (! gc || !win)
 	    goto fail;
 #ifdef ARGDEBUG
 	printf("args ok\n");
@@ -4242,16 +4301,16 @@
 !
 
 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
-			      width:imageWidth height:imageHeight 
+			      width:imageWidth height:imageHeight
 				  x:srcx y:srcy
-			       into:aDrawableId 
-				  x:dstx y:dsty 
-			      width:w height:h 
+			       into:aDrawableId
+				  x:dstx y:dsty
+			      width:w height:h
 			       with:aGCId
 
     <context: #return>
 
-    "since XPutImage may allocate huge amount of stack space 
+    "since XPutImage may allocate huge amount of stack space
      (some implementations use alloca), this must run with unlimited stack."
 
 %{  /* UNLIMITEDSTACK */
@@ -4280,7 +4339,7 @@
 
 	gc = __GCVal(aGCId);
 	win = __WindowVal(aDrawableId);
-	if (! gc || !win) 
+	if (! gc || !win)
 	    goto fail;
 #ifdef ARGDEBUG
 	printf("args ok\n");
@@ -4487,7 +4546,7 @@
     "/ see def's in DragAndDropTypes.h
     dropType := (self dndDropTypes) at:dropType+1 ifAbsent:#DndNotDnd.
 
-    self 
+    self
 	getProperty:(self atomIDOf:#DndSelection)
 	from:rootId
 	delete:false
@@ -4570,7 +4629,7 @@
 	dropType := #rawData.
     ] ifFalse:[
 	'XWorkstation [info]: unsupported dropType: ' infoPrint. dropType infoPrintCR.
-	'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR. 
+	'XWorkstation [info]: data: ' infoPrint. dropValue infoPrintCR.
 
 	dropValue := dropValue.
 	dropType := #unknown.
@@ -4630,7 +4689,7 @@
 
     key isNil ifTrue:[
 	"/ happens sometimes on some systems
-	"/ (alt-graph on sun has no keysym) 
+	"/ (alt-graph on sun has no keysym)
 	^ self
     ].
     eventRootX := rX.
@@ -4650,7 +4709,7 @@
 
     key isNil ifTrue:[
 	"/ happens sometimes on some systems
-	"/ (alt-graph on sun has no keysym) 
+	"/ (alt-graph on sun has no keysym)
 	^ self
     ].
     eventRootX := rX.
@@ -4734,7 +4793,7 @@
     |clipBoardContents|
 
 "/    Transcript show:'seletionNotify selID:'.
-"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '. 
+"/    Transcript show:selectionID; show:' ('; show:(self atomName:selectionID); show:') '.
 "/    Transcript show:' targetID:'.
 "/    Transcript show:targetID; show:' ('; show:(self atomName:targetID); show:') '.
 "/    Transcript show:' propertyID:'.
@@ -4762,9 +4821,9 @@
 "/        ('XWorkstation: unsupported selection target ', (self atomName:targetID)) errorPrintCR.
 
 	"sending property None tells client, that i cannot convert"
-	self 
-	    sendSelectionNotifySelection:selectionID 
-	    property:nil 
+	self
+	    sendSelectionNotifySelection:selectionID
+	    property:nil
 	    target:targetID
 	    time:time
 "/            from:aView id  BAD: nobody understands this
@@ -4779,13 +4838,13 @@
 	targetIdOut := self atomIDOf:#STRING.
     ].
 
-    self sendSelection:selection 
-	 selection:selectionID 
-	 property:propertyID 
-	 target:targetIdOut 
-	 time:time 
+    self sendSelection:selection
+	 selection:selectionID
+	 property:propertyID
+	 target:targetIdOut
+	 time:time
 "/         from:aView id    BAD: nobody understands this
-	 from:requestorID 
+	 from:requestorID
 	 to:requestorID.
 !
 
@@ -4911,7 +4970,7 @@
      otherwise only events for the view with given id are processed.
      If the argument aMask is nonNil, only events for this eventMask are
      handled.
-     WARNING: this may block to wait for an event - you better check for a 
+     WARNING: this may block to wait for an event - you better check for a
 	      pending event before calling this."
 
     |eventArray|
@@ -4933,7 +4992,7 @@
     "get next expose event and send appropriate message to the sensor or view.
      If the argument aViewIdOrNil is nil, events for any view are processed,
      otherwise only events for the view with given id are processed.
-     WARNING: this may block to wait for an event - you better check for a 
+     WARNING: this may block to wait for an event - you better check for a
 	      pending event before calling this."
 
     self dispatchEventFor:aViewIdOrNil withMask:(self eventMaskFor:#expose)
@@ -4992,7 +5051,7 @@
 disposeEventsWithMask:aMask for:aWindowIdOrNil
     "dispose (throw away) specific events. If aWindowId is nil,
      events matching the mask are thrown away regardless of which
-     view they are for. Otherwise, only matching events for that 
+     view they are for. Otherwise, only matching events for that
      view are flushed."
 
     <context: #return>
@@ -5047,7 +5106,7 @@
 !
 
 eventPending
-    "return true, if any event is pending. 
+    "return true, if any event is pending.
      This looks for both the internal queue and the display connection."
 
     "/ ConservativeSync is required for some Xlib implementation,
@@ -5105,7 +5164,7 @@
 !
 
 eventPendingWithSync:doSync
-    "return true, if any event is pending. 
+    "return true, if any event is pending.
      If doSync is true, do a sync output buffer (i.e. send all to the display and wait until its processed)
      before checking."
 
@@ -5203,8 +5262,8 @@
 !
 
 getEventFor:aViewIdOrNil withMask:eventMask into:anEventArray
-    "read next event if there is one and put events data into anEventArray. 
-     If aViewIdOrNil is nil, events for any view are fetched; 
+    "read next event if there is one and put events data into anEventArray.
+     If aViewIdOrNil is nil, events for any view are fetched;
      otherwise only events for that specific view will be fetched.
      Returns true, if there was an event, false otherwise.
      This method may block - so you better check for pending events
@@ -5220,7 +5279,7 @@
 
      Sorry I had to split dispatch into this fetch method and a separate
      handler method to allow UNLIMITEDSTACK here.
-     (some Xlibs do a big alloca there which cannot be done in 
+     (some Xlibs do a big alloca there which cannot be done in
       #dispatchEvent:, since it dispatches out into ST-methods).
     "
 
@@ -5232,7 +5291,7 @@
     XEvent ev;
     OBJ eB;
     KeySym keySym;
-    unsigned char buffer[10];                                               
+    unsigned char buffer[10];
     int i, nchars;
     char *keySymString;
     char keySymStringBuffer[32];
@@ -5328,7 +5387,7 @@
 	keyPressAndRelease:
 	    arg = nil;
 	    nchars = XLookupString(ke, (char *)buffer, sizeof(buffer), &keySym, NULL);
-	    if (nchars 
+	    if (nchars
 	     && (((buffer[0] >= ' ') && (buffer[0] <= '~'))
 		 || (buffer[0] >= 0x80))) {
 		arg = __MKCHARACTER(buffer[0])/* *_CharacterTable[buffer[0]] */;
@@ -5576,7 +5635,7 @@
 
 	case SelectionClear:
 	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionClear:atom:time:);
-	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection); 
+	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(sce->selection);
 	    __ArrayInstPtr(anEventArray)->a_element[4] = t = __MKUINT(sce->time);         __STORE(anEventArray, t);
 	    break;
 
@@ -5586,9 +5645,9 @@
 	     */
 	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionRequest:requestor:selection:target:property:time:);
 	    __ArrayInstPtr(anEventArray)->a_element[3] = t = __MKEXTERNALADDRESS(ev.xselectionrequest.requestor); __STORE(anEventArray, t);
-	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection); 
-	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);    
-	    __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);  
+	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselectionrequest.selection);
+	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselectionrequest.target);
+	    __ArrayInstPtr(anEventArray)->a_element[6] = __MKATOMOBJ(ev.xselectionrequest.property);
 	    __ArrayInstPtr(anEventArray)->a_element[7] = t = __MKUINT(ev.xselectionrequest.time);         __STORE(anEventArray, t);
 	    break;
 
@@ -5597,9 +5656,9 @@
 	     * returned selection value (answer from SelectionRequest)
 	     */
 	    __ArrayInstPtr(anEventArray)->a_element[2] = @symbol(selectionNotify:selection:target:property:requestor:time:);
-	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection); 
-	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);    
-	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);  
+	    __ArrayInstPtr(anEventArray)->a_element[3] = __MKATOMOBJ(ev.xselection.selection);
+	    __ArrayInstPtr(anEventArray)->a_element[4] = __MKATOMOBJ(ev.xselection.target);
+	    __ArrayInstPtr(anEventArray)->a_element[5] = __MKATOMOBJ(ev.xselection.property);
 	    __ArrayInstPtr(anEventArray)->a_element[6] = t = __MKEXTERNALADDRESS(ev.xselection.requestor); __STORE(anEventArray, t);
 	    __ArrayInstPtr(anEventArray)->a_element[7] = t = __MKUINT(ev.xselection.time); __STORE(anEventArray, t);
 	    break;
@@ -5713,7 +5772,7 @@
      is the bitwise or of the eventMask bits (see 'eventMaskFor:')"
 
     <context: #return>
-%{  
+%{
 
     int mask;
 
@@ -5797,7 +5856,7 @@
     "/ XSendEvent(dpy,DispatchWindow,True,NoEventMask,&Event);
 
     <context: #return>
-%{  
+%{
     int type;
     int state;
 
@@ -5892,7 +5951,7 @@
      (not very user friendly)"
 
     <context: #return>
-%{ 
+%{
     int type;
     int state;
 
@@ -6039,7 +6098,7 @@
     "extract family, face, style and size from an
      X-font name
      1 2     3      4    5     6         7 8      9    10   11   12 13 14       15
-      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding; 
+      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding;
      evaluate aBlock with these"
 
     |family face style moreStyle fheight size
@@ -6103,7 +6162,7 @@
     ^ self extractEncodingFromRegistry:reg encoding:enc charSetCollections:coll
 
      "
-       Screen current encodingOf:Screen current getDefaultFont 
+       Screen current encodingOf:Screen current getDefaultFont
      "
 !
 
@@ -6125,7 +6184,7 @@
 	(encoding size ~~ 0) ifTrue:[
 	    enc := encoding asLowercase asSymbol
 	] ifFalse:[
-	    charSets := charSetCollections.    
+	    charSets := charSetCollections.
 	    (charSets notNil and:[charSets notEmpty]) ifTrue:[
 		charSets := charSets asUppercase asCollectionOfWords.
 		(charSets includes:'ISO8859-1') ifTrue:[
@@ -6143,7 +6202,7 @@
 			]
 		    ]
 		]
-	    ] 
+	    ]
 	]
     ].
     ^  enc
@@ -6171,7 +6230,7 @@
     "extract family, face, style and size from an
      X-font name
      1 2     3      4    5     6         7 8      9    10   11   12 13 14       15
-      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding; 
+      -brand-family-face-style-moreStyle- -height-size-resX-resY-??-??-registry-encoding;
      evaluate aBlock with these"
 
     |family face style moreStyle fheight size
@@ -6233,7 +6292,7 @@
     "
 !
 
-fontMetricsOf:fontId 
+fontMetricsOf:fontId
     "return a fonts metrics info object"
 
     <context: #return>
@@ -6251,10 +6310,10 @@
 	    if (f) {
 		minCode = __MKUINT((f->min_byte1<<8) + f->min_char_or_byte2);
 		maxCode = __MKUINT((f->max_byte1<<8) + f->max_char_or_byte2);
-                
+
 		if (f->direction == FontLeftToRight) {
 		    dir = @symbol(LeftToRight);
-		} else if (f->direction == FontRightToLeft) { 
+		} else if (f->direction == FontRightToLeft) {
 		    dir = @symbol(RightToLeft);
 		}
 		avgDescent = __MKSMALLINT(f->descent);
@@ -6318,8 +6377,8 @@
     ^ propertyNames collect:[:propName | props at:propName ifAbsent:nil].
 
     "
-     Screen current 
-	fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' #'RESOLUTION' notExistant) 
+     Screen current
+	fontProperties:#(#'PIXEL_SIZE' #'POINT_SIZE' #'RESOLUTION' notExistant)
 	of:Screen current getDefaultFont
     "
 !
@@ -6334,7 +6393,7 @@
 
     |propsArray result|
 
-%{ 
+%{
     XFontStruct *f;
     XFontProp *prop;
     int n, i;
@@ -6367,7 +6426,7 @@
      (Screen current fontPropertiesOf:Screen current getDefaultFont) pairWiseDo:[:name :value|
 	  d at:((Screen current atomName:name) ? name) put:value
      ].
-     d 
+     d
     "
 !
 
@@ -6418,7 +6477,7 @@
     ^ nil.
 
     "
-     Screen current fullFontNameOf:(Screen current getDefaultFont) 
+     Screen current fullFontNameOf:(Screen current getDefaultFont)
     "
 !
 
@@ -6494,7 +6553,7 @@
      as family and the other parameters as nil. For example, the cursor font
      can be aquired that way."
 
-    |styleString theName theId xlatedStyle 
+    |styleString theName theId xlatedStyle
      id spacing encodingMatch idx roundedSize|
 
     styleString := styleArgString.
@@ -6527,7 +6586,7 @@
     "/ in style
 
     (styleString notNil
-     and:[(styleString endsWith:'-narrow') 
+     and:[(styleString endsWith:'-narrow')
 	  or:[styleString endsWith:'-semicondensed']]) ifTrue:[
 	|i|
 	i := styleString lastIndexOf:$-.
@@ -6553,14 +6612,14 @@
 	].
     ].
 
-    id := self 
+    id := self
 	    getFontWithFoundry:'*'
 	    family:familyString asLowercase
 	    weight:faceString
 	    slant:xlatedStyle
 	    spacing:spacing
 	    pixelSize:nil
-	    size:roundedSize 
+	    size:roundedSize
 	    encoding:encodingMatch.
 
     id isNil ifTrue:[
@@ -6568,24 +6627,24 @@
 	    "/ too stupid: registries come in both cases
 	    "/ and X does not ignore case
 	    "/
-	    id := self 
+	    id := self
 		    getFontWithFoundry:'*'
 		    family:familyString asLowercase
 		    weight:faceString
 		    slant:xlatedStyle
 		    spacing:spacing
 		    pixelSize:nil
-		    size:roundedSize 
+		    size:roundedSize
 		    encoding:encodingMatch asUppercase.
 	    id isNil ifTrue:[
-		id := self 
+		id := self
 			getFontWithFoundry:'*'
 			family:familyString asLowercase
 			weight:faceString
 			slant:xlatedStyle
 			spacing:spacing
 			pixelSize:nil
-			size:roundedSize 
+			size:roundedSize
 			encoding:encodingMatch asLowercase.
 	    ]
 	]
@@ -6597,7 +6656,7 @@
 !
 
 getFontWithFoundry:foundry family:family weight:weight
-	      slant:slant spacing:spc pixelSize:pSize size:size 
+	      slant:slant spacing:spc pixelSize:pSize size:size
 	      encoding:encoding
 
     "get the specified font, if not available, return nil.
@@ -6615,7 +6674,7 @@
      encoding:  iso8859-*, iso8859-1, iso10646-1 ... '*'
     "
 
-    |theName sizeMatch 
+    |theName sizeMatch
      foundryMatch familyMatch weightMatch slantMatch spcMatch
      pSizeMatch encodingMatch|
 
@@ -6672,7 +6731,7 @@
     theName := ('-' , foundryMatch,
 		'-' , familyMatch,
 		'-' , weightMatch ,
-		'-' , slantMatch , 
+		'-' , slantMatch ,
 		'-' , spcMatch ,
 		'-*' ,
 		'-' , pSizeMatch ,
@@ -6683,10 +6742,10 @@
 "/  Transcript showCR:theName; endEntry.
 
     ^ self createFontFor:theName.
-        
-
-    "
-     Display 
+
+
+    "
+     Display
 	getFontWithFoundry:'*'
 	family:'courier'
 	weight:'medium'
@@ -6734,7 +6793,7 @@
 releaseFont:aFontId
 
     <context: #return>
-%{  
+%{
 
     XFontStruct *f;
 
@@ -6799,166 +6858,166 @@
     XCharStruct overAllReturn;
 
     if (ISCONNECTED) {
-        if (__bothSmallInteger(index1, index2)
-         && __isExternalAddress(aFontId)
-         && __isNonNilObject(aString)) {
-            int lMax = __intVal(@global(MaxStringLength));
-            f = __FontVal(aFontId);
-            if (! f) goto fail;
-
-            i1 = __intVal(index1) - 1;
-            cls = __qClass(aString);
-
-            if (i1 >= 0) {
-                i2 = __intVal(index2) - 1;
-                if (i2 < i1) {
-                    RETURN ( __MKSMALLINT(0) );
-                }
-
-                cp = (char *) __stringVal(aString);
-                l = i2 - i1 + 1;
-
-                if ((cls == @global(String)) || (cls == @global(Symbol))) {
-                    n = __stringSize(aString);
-                    if (i2 < n) {
-                        cp += i1;
+	if (__bothSmallInteger(index1, index2)
+	 && __isExternalAddress(aFontId)
+	 && __isNonNilObject(aString)) {
+	    int lMax = __intVal(@global(MaxStringLength));
+	    f = __FontVal(aFontId);
+	    if (! f) goto fail;
+
+	    i1 = __intVal(index1) - 1;
+	    cls = __qClass(aString);
+
+	    if (i1 >= 0) {
+		i2 = __intVal(index2) - 1;
+		if (i2 < i1) {
+		    RETURN ( __MKSMALLINT(0) );
+		}
+
+		cp = (char *) __stringVal(aString);
+		l = i2 - i1 + 1;
+
+		if ((cls == @global(String)) || (cls == @global(Symbol))) {
+		    n = __stringSize(aString);
+		    if (i2 < n) {
+			cp += i1;
 
 #if 0
-                        ENTER_XLIB();
-                        len = XQueryTextExtents(myDpy, f->fid, cp, l, 
-                                                &directionReturn, &fontAscentReturn, &fontDescentReturn,
-                                                &overAllReturn);
-                        LEAVE_XLIB();
-                        printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
-#endif
-                        ENTER_XLIB();
-                        len = XTextWidth(f, cp, l);
-                        LEAVE_XLIB();
-
-                        RETURN ( __MKSMALLINT(len) );
-                    }
-                }
-
-                nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-                cp += nInstBytes;
-
-                if (__isBytes(aString)) {
-                    n = __byteArraySize(aString) - nInstBytes;
-                    if (i2 < n) {
-                        cp += i1;
-
-                        ENTER_XLIB();
-                        len = XTextWidth(f, cp, l);
-                        LEAVE_XLIB();
-
-                        RETURN ( __MKSMALLINT(len) );
-                    }
-                }
-
-                /* 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;
-
-                        /*
-                         * 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) {
-                            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;
-                        }
-
-                        ENTER_XLIB();
-                        len = XTextWidth16(f, (XChar2b *)cp, l);
-                        LEAVE_XLIB();
-
-
-                        if (mustFree) {
-                            free(cp2);
-                        }
-
-                        RETURN ( __MKSMALLINT(len) );
-                    }
-                }
-                /* FOURBYTESTRINGS */
-                if (__isLongs(aString)) {
-                    int i;
-                    XChar2b *cp2;
-                    int mustFree = 0;
-
-                    n = (__byteArraySize(aString) - nInstBytes) / 4;
-                    if (i2 < n) {
-                        union {
-                            char b[2];
-                            unsigned short s;
-                        } u;
-                        int i;
-                        XChar2b *cp2 = (XChar2b *)0;
-                        int mustFree = 0;
-
-                        cp += (i1 * 4);
-                        if (l > lMax) l = lMax;
-
-                        /*
-                         * For now: X does not support 32bit characters without the new 32Unicode extensions.
-                         * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?).
-                         */
-                        if (l <= NLOCALBUFFER) {
-                            cp2 = xlatebuffer;
-                        } else {
-                            cp2 = (XChar2b *)(malloc(l * 2));
-                            mustFree = 1;
-                        }
-                        for (i=0; i<l; i++) {
-                            int codePoint;
-
-                            codePoint = ((unsigned int32 *)cp)[i];
-                            if (codePoint > 0xFFFF) {
-                                codePoint = 0xFFFF;
-                            }
-                            cp2[i].byte1 = codePoint & 0xFF;
-                            cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
-                        }
-                        cp = (char *) cp2;
-
-                        ENTER_XLIB();
-                        len = XTextWidth16(f, (XChar2b *)cp, l);
-                        LEAVE_XLIB();
-
-
-                        if (mustFree) {
-                            free(cp2);
-                        }
-
-                        RETURN ( __MKSMALLINT(len) );
-                    }
-                }
-            }
-        }
+			ENTER_XLIB();
+			len = XQueryTextExtents(myDpy, f->fid, cp, l,
+						&directionReturn, &fontAscentReturn, &fontDescentReturn,
+						&overAllReturn);
+			LEAVE_XLIB();
+			printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
+#endif
+			ENTER_XLIB();
+			len = XTextWidth(f, cp, l);
+			LEAVE_XLIB();
+
+			RETURN ( __MKSMALLINT(len) );
+		    }
+		}
+
+		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+		cp += nInstBytes;
+
+		if (__isBytes(aString)) {
+		    n = __byteArraySize(aString) - nInstBytes;
+		    if (i2 < n) {
+			cp += i1;
+
+			ENTER_XLIB();
+			len = XTextWidth(f, cp, l);
+			LEAVE_XLIB();
+
+			RETURN ( __MKSMALLINT(len) );
+		    }
+		}
+
+		/* 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;
+
+			/*
+			 * 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) {
+			    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;
+			}
+
+			ENTER_XLIB();
+			len = XTextWidth16(f, (XChar2b *)cp, l);
+			LEAVE_XLIB();
+
+
+			if (mustFree) {
+			    free(cp2);
+			}
+
+			RETURN ( __MKSMALLINT(len) );
+		    }
+		}
+		/* FOURBYTESTRINGS */
+		if (__isLongs(aString)) {
+		    int i;
+		    XChar2b *cp2;
+		    int mustFree = 0;
+
+		    n = (__byteArraySize(aString) - nInstBytes) / 4;
+		    if (i2 < n) {
+			union {
+			    char b[2];
+			    unsigned short s;
+			} u;
+			int i;
+			XChar2b *cp2 = (XChar2b *)0;
+			int mustFree = 0;
+
+			cp += (i1 * 4);
+			if (l > lMax) l = lMax;
+
+			/*
+			 * For now: X does not support 32bit characters without the new 32Unicode extensions.
+			 * For now, treat chars above 0xFFFF as 0xFFFF (should we use default-char ?).
+			 */
+			if (l <= NLOCALBUFFER) {
+			    cp2 = xlatebuffer;
+			} else {
+			    cp2 = (XChar2b *)(malloc(l * 2));
+			    mustFree = 1;
+			}
+			for (i=0; i<l; i++) {
+			    int codePoint;
+
+			    codePoint = ((unsigned int32 *)cp)[i];
+			    if (codePoint > 0xFFFF) {
+				codePoint = 0xFFFF;
+			    }
+			    cp2[i].byte1 = codePoint & 0xFF;
+			    cp2[i].byte2 = (codePoint >> 8) & 0xFF;;
+			}
+			cp = (char *) cp2;
+
+			ENTER_XLIB();
+			len = XTextWidth16(f, (XChar2b *)cp, l);
+			LEAVE_XLIB();
+
+
+			if (mustFree) {
+			    free(cp2);
+			}
+
+			RETURN ( __MKSMALLINT(len) );
+		    }
+		}
+	    }
+	}
     }
 #undef NLOCALBUFFER
 fail: ;
@@ -6983,97 +7042,97 @@
     XCharStruct overAllReturn;
 
     if (ISCONNECTED) {
-        if (__isExternalAddress(aFontId)
-         && __isNonNilObject(aString)) {
-            int lMax = __intVal(@global(MaxStringLength));
-            f = __FontVal(aFontId);
-            if (! f) goto fail;
-
-            cls = __qClass(aString);
-
-            cp = (char *) __stringVal(aString);
-
-            if ((cls == @global(String)) || (cls == @global(Symbol))) {
-                n = __stringSize(aString);
+	if (__isExternalAddress(aFontId)
+	 && __isNonNilObject(aString)) {
+	    int lMax = __intVal(@global(MaxStringLength));
+	    f = __FontVal(aFontId);
+	    if (! f) goto fail;
+
+	    cls = __qClass(aString);
+
+	    cp = (char *) __stringVal(aString);
+
+	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
+		n = __stringSize(aString);
 
 #if 0
-                ENTER_XLIB();
-                len = XQueryTextExtents(myDpy, f->fid, cp, n, 
-                                        &directionReturn, &fontAscentReturn, &fontDescentReturn,
-                                        &overAllReturn);
-                LEAVE_XLIB();
-                printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
-#endif
-
-                ENTER_XLIB();
-                len = XTextWidth(f, cp, n);
-                LEAVE_XLIB();
-
-                RETURN ( __MKSMALLINT(len) );
-            }
-
-            nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
-            cp += nInstBytes;
-
-            if (__isBytes(aString)) {
-                n = __byteArraySize(aString) - nInstBytes;
-
-
-                ENTER_XLIB();
-                len = XTextWidth(f, cp, n);
-                LEAVE_XLIB();
-
-                RETURN ( __MKSMALLINT(len) );
-            }
-
-            /* 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;
-
-                /*
-                 * 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) {
-                    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;
-                }
-
-
-                ENTER_XLIB();
-                len = XTextWidth16(f, (XChar2b *)cp, n);
-                LEAVE_XLIB();
-
-
-                if (mustFree) {
-                    free(cp2);
-                }
-
-                RETURN ( __MKSMALLINT(len) );
-            }
-        }
+		ENTER_XLIB();
+		len = XQueryTextExtents(myDpy, f->fid, cp, n,
+					&directionReturn, &fontAscentReturn, &fontDescentReturn,
+					&overAllReturn);
+		LEAVE_XLIB();
+		printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
+#endif
+
+		ENTER_XLIB();
+		len = XTextWidth(f, cp, n);
+		LEAVE_XLIB();
+
+		RETURN ( __MKSMALLINT(len) );
+	    }
+
+	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
+	    cp += nInstBytes;
+
+	    if (__isBytes(aString)) {
+		n = __byteArraySize(aString) - nInstBytes;
+
+
+		ENTER_XLIB();
+		len = XTextWidth(f, cp, n);
+		LEAVE_XLIB();
+
+		RETURN ( __MKSMALLINT(len) );
+	    }
+
+	    /* 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;
+
+		/*
+		 * 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) {
+		    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;
+		}
+
+
+		ENTER_XLIB();
+		len = XTextWidth16(f, (XChar2b *)cp, n);
+		LEAVE_XLIB();
+
+
+		if (mustFree) {
+		    free(cp2);
+		}
+
+		RETURN ( __MKSMALLINT(len) );
+	    }
+	}
     }
 #undef NLOCALBUFFER
   fail: ;
@@ -7141,22 +7200,22 @@
 
 	    ok = 0;
 	    switch(result) {
-		case AlreadyGrabbed: 
+		case AlreadyGrabbed:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab keyboard: AlreadyGrabbed\n");
 		    }
 		    break;
-		case GrabNotViewable: 
+		case GrabNotViewable:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab keyboard: GrabNotViewable\n");
 		    }
 		    break;
-		case GrabInvalidTime: 
+		case GrabInvalidTime:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab keyboard: InvalidTime\n");
 		    }
 		    break;
-		case GrabFrozen: 
+		case GrabFrozen:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab keyboard: Frozen\n");
 		    }
@@ -7184,7 +7243,7 @@
     "grap the pointer - return true if ok"
 
     <context: #return>
-%{ 
+%{
 
     int result, ok, evMask;
     Window confineWin;
@@ -7193,12 +7252,12 @@
 
     if (ISCONNECTED) {
 	if (__isExternalAddress(aWindowId)) {
-	    if (__isExternalAddress(confineId)) 
+	    if (__isExternalAddress(confineId))
 		confineWin = __WindowVal(confineId);
 	    else
 		confineWin = (Window) None;
 
-	    if (__isExternalAddress(aCursorId)) 
+	    if (__isExternalAddress(aCursorId))
 		curs = __CursorVal(aCursorId);
 	    else
 		curs = (Cursor) None;
@@ -7223,8 +7282,8 @@
 	    ENTER_XLIB();
 */
 	    result = XGrabPointer(myDpy,
-				  __WindowVal(aWindowId), 
-				  False, 
+				  __WindowVal(aWindowId),
+				  False,
 				  evMask,
 				  pointer_mode, keyboard_mode,
 				  confineWin,
@@ -7237,22 +7296,22 @@
 
 	    ok = 0;
 	    switch (result) {
-		case AlreadyGrabbed: 
+		case AlreadyGrabbed:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab pointer: AlreadyGrabbed\n");
 		    }
 		    break;
-		case GrabNotViewable: 
+		case GrabNotViewable:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab pointer: GrabNotViewable\n");
 		    }
 		    break;
-		case GrabInvalidTime: 
+		case GrabInvalidTime:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab pointer: InvalidTime\n");
 		    }
 		    break;
-		case GrabFrozen: 
+		case GrabFrozen:
 		    if (@global(ErrorPrinting) == true) {
 			fprintf(stderr, "XWorkstation [warning]: grab pointer: Frozen\n");
 		    }
@@ -7284,11 +7343,11 @@
     "grap the pointer - return true if ok"
 
     ^ self
-	grabPointerIn:aWindowId 
-	withCursor:aCursorId 
+	grabPointerIn:aWindowId
+	withCursor:aCursorId
 	eventMask:nil
-	pointerMode:pMode 
-	keyboardMode:kMode 
+	pointerMode:pMode
+	keyboardMode:kMode
 	confineTo:confineId
 
     "Modified: / 28.7.1998 / 02:47:51 / cg"
@@ -7298,7 +7357,7 @@
     "release the keyboard"
 
     <context: #return>
-%{ 
+%{
 
     if (ISCONNECTED) {
 	Display *dpy = myDpy;
@@ -7354,7 +7413,7 @@
     "disable clipping rectangle"
 
     <context: #return>
-%{ 
+%{
 
     XGCValues gcv;
     GC gc;
@@ -7377,7 +7436,7 @@
     "set background color to be drawn with"
 
     <context: #return>
-%{ 
+%{
 
     if (ISCONNECTED) {
 	if (__isExternalAddress(aGCId)
@@ -7396,7 +7455,7 @@
     "set or clear the drawing mask - a bitmap mask using current fg/bg"
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     Pixmap bitmap;
@@ -7430,7 +7489,7 @@
     "enable/disable drawing into child views"
 
     <context: #return>
-%{ 
+%{
 
     XGCValues gcv;
     GC gc;
@@ -7457,7 +7516,7 @@
     "clip to a rectangle"
 
     <context: #return>
-%{ 
+%{
 
     XRectangle r;
 
@@ -7483,14 +7542,14 @@
     "set line attributes"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED) {
 	if (__isExternalAddress(aGCId)
 	 && __isSmallInteger(offset)
 	 && __isByteArray(dashList)) {
 	    ENTER_XLIB();
-	    XSetDashes(myDpy, __GCVal(aGCId), 
+	    XSetDashes(myDpy, __GCVal(aGCId),
 		       __intVal(offset),
 		       __ByteArrayInstPtr(dashList)->ba_element,
 		       __byteArraySize(dashList));
@@ -7512,7 +7571,7 @@
     "set font to be drawn in"
 
     <context: #return>
-%{  
+%{
 
     XFontStruct *f;
 
@@ -7537,7 +7596,7 @@
     "set foreground and background colors to be drawn with"
 
     <context: #return>
-%{  
+%{
 
     GC gc;
 
@@ -7562,7 +7621,7 @@
     "set foreground color to be drawn with"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED) {
 	if (__isExternalAddress(aGCId)
@@ -7581,7 +7640,7 @@
     "set alu function to be drawn with"
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     int fun = -1;
@@ -7625,7 +7684,7 @@
     "set or clear the graphics exposures flag"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED) {
 	if (__isExternalAddress(aGCId)) {
@@ -7640,13 +7699,13 @@
 !
 
 setLineWidth:aNumber style:lineStyle cap:capStyle join:joinStyle in:aGCId
-    "set line attributes; 
+    "set line attributes;
      lineStyle must be one of #solid, #dashed or #doubleDashed;
      capStyle one of: #notLast, #butt, #round or #projecting;
      joinStyle one of: #miter, #bevel or #round."
 
     <context: #return>
-%{ 
+%{
 
     int x_style, x_cap, x_join;
     static char dashList[2] = { 1,1 };
@@ -7724,7 +7783,7 @@
     "set the mask origin"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED) {
 	if (__bothSmallInteger(orgX, orgY) && __isExternalAddress(aGCid)) {
@@ -7742,7 +7801,7 @@
     "set or clear the drawing mask - a pixmap mask providing full color"
 
     <context: #return>
-%{  
+%{
 
     GC gc;
     Pixmap pixmap;
@@ -7799,7 +7858,7 @@
     "low level close of the displays connection (without sending any buffered
      requests to the display). Only used in case of emergency (brokenConnection)"
 
-%{ 
+%{
     if (ISCONNECTED) {
 	Display *dpy = myDpy;
 
@@ -7834,7 +7893,7 @@
 initializeFor:aDisplayName
     "initialize the receiver for a connection to an X-Server;
      the argument, aDisplayName may be nil (for the default server from
-     DISPLAY-variable or command line argument) or the name of the server 
+     DISPLAY-variable or command line argument) or the name of the server
      as hostname:number"
 
     displayId notNil ifTrue:[
@@ -7849,6 +7908,9 @@
 	^ nil
     ].
 
+    xlibTimeout := xlibTimeout ? DefaultXLibTimeout.
+    xlibTimeoutForWindowCreation := xlibTimeoutForWindowCreation ? DefaultXLibTimeoutForWindowCreation.
+
     dispatching := false.
     dispatchingExpose := false.
     isSlow := false.
@@ -7886,7 +7948,7 @@
 
     |map|
 
-    super initializeModifierMappings.                                     
+    super initializeModifierMappings.
 
     rawKeySymTranslation := RawKeySymTranslation.
 
@@ -7905,11 +7967,11 @@
 	altModifierMask := 0.
 	metaModifierMask := 0.
 
-	stringFromKeyCode := [:key | 
-				    |s| 
-				    s := self stringFromKeycode:key. 
-				    s notNil 
-					ifTrue:[s asSymbol] 
+	stringFromKeyCode := [:key |
+				    |s|
+				    s := self stringFromKeycode:key.
+				    s notNil
+					ifTrue:[s asSymbol]
 					ifFalse:[nil]
 			     ].
 	nonNilOnes := [:str | str notNil].
@@ -7938,7 +8000,7 @@
 		altModifierMask := 1 bitShift:(5-1).
 	    ].
 	]
-    ].                                                          
+    ].
 
     "
      Display initializeModifierMappings
@@ -8139,7 +8201,7 @@
     ^ nil
 
     "
-     Display queryCells 
+     Display queryCells
     "
 !
 
@@ -8162,7 +8224,7 @@
     ^ false
 
     "
-     Display queryDPSExtension  
+     Display queryDPSExtension
     "
 !
 
@@ -8179,7 +8241,7 @@
     ^ nil
 
     "
-     Display queryDefaultScreen  
+     Display queryDefaultScreen
     "
 !
 
@@ -8230,7 +8292,7 @@
     ^ nil
 
     "
-     Display queryDepth  
+     Display queryDepth
     "
 !
 
@@ -8249,7 +8311,7 @@
     ^ nil
 
     "
-     Display queryHeight      
+     Display queryHeight
     "
 !
 
@@ -8268,7 +8330,7 @@
     ^ nil
 
     "
-     Display queryHeightMM      
+     Display queryHeightMM
     "
 !
 
@@ -8291,7 +8353,7 @@
     ^ false
 
     "
-     Display queryMBUFExtension  
+     Display queryMBUFExtension
     "
 !
 
@@ -8361,7 +8423,7 @@
     ^ false
 
     "
-     Display querySHMExtension  
+     Display querySHMExtension
     "
 !
 
@@ -8403,7 +8465,7 @@
     ^ nil
 
     "
-     Display queryWhitePixel    
+     Display queryWhitePixel
     "
 !
 
@@ -8422,7 +8484,7 @@
     ^ nil
 
     "
-     Display queryWidth 
+     Display queryWidth
     "
 !
 
@@ -8441,7 +8503,7 @@
     ^ nil
 
     "
-     Display queryWidthMM 
+     Display queryWidthMM
     "
 !
 
@@ -8510,7 +8572,7 @@
     ^ false
 
     "
-     Display queryXVideoExtension  
+     Display queryXVideoExtension
     "
 !
 
@@ -8669,7 +8731,7 @@
      |mapping|
 
      mapping := Display modifierMapping.
-     ^ mapping collect:[:eachRow | 
+     ^ mapping collect:[:eachRow |
 			     eachRow notNil ifTrue:[
 				 eachRow collect:[ :key | Display stringFromKeycode:key ].
 			     ] ifFalse:[
@@ -8707,14 +8769,14 @@
 	   maxKeyPerMod = __MKSMALLINT(modmap->max_keypermod);
 	   modifierKeyMap = __BYTEARRAY_UNINITIALIZED_NEW_INT(modmap->max_keypermod * 8);
 	   if (modifierKeyMap != nil) {
-		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element, 
+		memcpy((char *)__ByteArrayInstPtr(modifierKeyMap)->ba_element,
 		       (char *)modmap->modifiermap, modmap->max_keypermod * 8);
 	   }
 	   XFreeModifiermap(modmap);
 	}
     }
 %}.
-    ^ modifierKeyMap 
+    ^ modifierKeyMap
 
     "
 	Display rawModifierMapping
@@ -8743,7 +8805,7 @@
 	Display *dpy = myDpy;
 
 	if ((keysym = XKeycodeToKeysym(dpy, __intVal(code), 0)) != NoSymbol &&
-	    (keystring = XKeysymToString(keysym)) != 0) 
+	    (keystring = XKeysymToString(keysym)) != 0)
 	    str = __MKSTRING(keystring);
     }
 %}.
@@ -8762,7 +8824,7 @@
 
 translateKey:untranslatedKey forView:aView
     "Return the key translated via the translation table.
-     Here, we preTranslate the key into a common ST/X symbolic name, 
+     Here, we preTranslate the key into a common ST/X symbolic name,
      which gets further processed in the superclasses translation method."
 
     |key|
@@ -8816,7 +8878,7 @@
      See #unBuffered for additional info."
 
     <context: #return>
-%{  
+%{
     if (ISCONNECTED) {
 	ENTER_XLIB();
 	XSynchronize(myDpy, 0);
@@ -8837,7 +8899,7 @@
      See also #sync, which even waits until the request has been processed."
 
     <context: #return>
-%{ 
+%{
     if (ISCONNECTED) {
 	ENTER_XLIB();
 	XFlush(myDpy);
@@ -8871,7 +8933,7 @@
      to be finished. See also #flush."
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED) {
 
@@ -8929,7 +8991,7 @@
      given to the parent view, the root view or no view."
 
     <context: #return>
-%{  
+%{
     int arg;
     Window focusWindow;
 
@@ -8944,7 +9006,7 @@
 	    arg = RevertToParent;
 	else if (revertSymbol == @symbol(root))
 	    arg = RevertToPointerRoot;
-	else 
+	else
 	    arg = RevertToNone;
 
 
@@ -8973,7 +9035,7 @@
 unBuffered
     "make all drawing be sent immediately to the display.
      This makes all graphics synchronous and turns off any buffering
-     (i.e. each individual draw-request is sent immediately without 
+     (i.e. each individual draw-request is sent immediately without
       packing multiple requests into a larger message buffer).
      Be prepared, that this slows down graphics considerably.
      However, it allows display errors to be handled immediately and
@@ -8981,7 +9043,7 @@
      which was responsible for it. See also #buffered."
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED) {
 
@@ -9017,7 +9079,7 @@
      shiftMask/controlMask and modifierMask methods for the meaning of the bits."
 
     <context: #return>
-%{  
+%{
     Window w;
     int screen = __intVal(__INST(screen));
     Window rootRet, childRet;
@@ -9053,18 +9115,18 @@
     ^ nil
 
     "
-     Display buttonStates     
+     Display buttonStates
     "
 
     "is the control-key pressed ?
 
-     Display buttonStates bitTest:(Display controlMask)    
+     Display buttonStates bitTest:(Display controlMask)
     "
 
     "is the alt/meta-key pressed ?
 
-     Display buttonStates bitTest:(Display altModifierMask)    
-     Display buttonStates bitTest:(Display metaModifierMask)    
+     Display buttonStates bitTest:(Display altModifierMask)
+     Display buttonStates bitTest:(Display metaModifierMask)
     "
 !
 
@@ -9174,7 +9236,7 @@
 	Window w = __WindowVal(aWindowId);
 
 	ENTER_XLIB();
-	XWarpPointer(dpy, 
+	XWarpPointer(dpy,
 		     None,  /* src window */
 		     w,  /* dst window */
 		     0,  /* src_x */
@@ -9232,10 +9294,10 @@
 getObjectProperty:propertyID from:aWindowID
     "get an object property from the server; return object or nil"
 
-    self 
-	getProperty:propertyID 
-	from:aWindowID 
-	delete:true 
+    self
+	getProperty:propertyID
+	from:aWindowID
+	delete:true
 	into:
 	    [:type :value |
 		type == stringAtom ifTrue:[
@@ -9329,7 +9391,7 @@
 		    XFree(data);
 		    goto fail;
 		}
-    
+
 		nread += nitems;
 		bcopy(data, cp2, nitems);
 		XFree(data);
@@ -9337,7 +9399,7 @@
 		fprintf(stderr, "- <nitems:%d bytes_after:%d>\n", nitems, bytes_after);
 #endif
 	    } while (bytes_after > 0);
-    
+
 	    if (ok) {
 		if (actual_type == XA_STRING) {
 		    cp[nread] = '\0';
@@ -9359,7 +9421,7 @@
     ^ true
 
     "
-     Display 
+     Display
 	getProperty:#'_DESKTOP_COLORS'
 	from:nil
 	delete:false
@@ -9397,10 +9459,10 @@
 getTextProperty:propertyID from:aWindowID
     "get a text property; return string or nil"
 
-    self 
-	getProperty:propertyID 
-	from:aWindowID 
-	delete:true 
+    self
+	getProperty:propertyID
+	from:aWindowID
+	delete:true
 	into:
 	    [:type :value |
 		|stringClass|
@@ -9408,22 +9470,22 @@
 		type == stringAtom ifTrue:[
 		    clipBoardEncoding notNil ifTrue:[
 			^ value decodeFrom:clipBoardEncoding
-		    ].    
+		    ].
 		    ^ value
 		].
 
 		type == (self atomIDOf:#'UTF8_STRING') ifTrue:[
-"/ Transcript show:'UTF8: '; showCR:value storeString.    
+"/ Transcript show:'UTF8: '; showCR:value storeString.
 		    ^ CharacterArray fromUTF8Bytes:value
 		].
 
 		type == (self atomIDOf:#'TEXT') ifTrue:[
-"/ Transcript show:'TEXT: '; showCR:value storeString.    
+"/ Transcript show:'TEXT: '; showCR:value storeString.
 		    ^ value asString
 		].
 
 		type == (self atomIDOf:#'COMPOUND_TEXT') ifTrue:[
-"/ Transcript show:'COMPOUND_TEXT: '; showCR:value storeString.    
+"/ Transcript show:'COMPOUND_TEXT: '; showCR:value storeString.
 		    ^ value asString
 		].
 
@@ -9443,8 +9505,8 @@
     "Modified: 30.6.1997 / 20:54:59 / cg"
 
     "
-     Display getTextProperty:#'_KDE_GENERAL' from:nil.   
-     Display getTextProperty:#'_DESKTOP_FONTS' from:nil.   
+     Display getTextProperty:#'_KDE_GENERAL' from:nil.
+     Display getTextProperty:#'_DESKTOP_FONTS' from:nil.
     "
 !
 
@@ -9578,7 +9640,7 @@
 			    (char *)__integerArrayVal(anObject),
 			    __integerArraySize(anObject));
 #endif
-	} else if (__isString(anObject) || __isSymbol(anObject)) { 
+	} else if (__isString(anObject) || __isSymbol(anObject)) {
 	    XChangeProperty(dpy, window, prop, type, 8,
 			    PropModeReplace,
 			    __stringVal(anObject),
@@ -9598,7 +9660,7 @@
 
 supportedClipboards
     "answer a collection of symbols with the supported clipboards.
-     X11 additionaly supports a buffer containing the currently selected text 
+     X11 additionaly supports a buffer containing the currently selected text
      (in xterm) - the PRIMARY selection"
 
     ^ #(clipboard selection)
@@ -9621,10 +9683,10 @@
     ^ self atomIDOf:aStringOrSymbol create:true
 
     "
-     Display atomIDOf:#'FACE_NAME'      
-     Display atomIDOf:#'FULL_NAME' 
-     Display atomIDOf:#DndProtocol 
-     Display atomIDOf:#DndSelection 
+     Display atomIDOf:#'FACE_NAME'
+     Display atomIDOf:#'FULL_NAME'
+     Display atomIDOf:#DndProtocol
+     Display atomIDOf:#DndSelection
     "
 
     "Modified: 4.4.1997 / 13:38:48 / cg"
@@ -9639,7 +9701,7 @@
 
     |atomSymbol atom|
 
-    atomSymbol := aStringOrSymbol asSymbol.   
+    atomSymbol := aStringOrSymbol asSymbol.
     (atoms notNil and:[(atom := atoms at:atomSymbol ifAbsent:nil) notNil]) ifTrue:[
 	^ atom.
     ].
@@ -9659,7 +9721,7 @@
      Display atomIDOf:#CLIPBOARD create:false
      Display atomIDOf:'STRING' create:false
      Display atomIDOf:'PRIMARY' create:false
-     Display atomIDOf:'blabla' create:false 
+     Display atomIDOf:'blabla' create:false
     "
 !
 
@@ -9669,7 +9731,7 @@
 
     <context: #return>
 
-%{ 
+%{
     OBJ str;
     char *name;
 
@@ -9692,11 +9754,11 @@
      Display atomName:1    'PRIMARY'
      Display atomName:130  '_DEC_DEVICE_FONTNAMES'
      Display atomName:132  'FONTNAME_REGISTRY'
-     Display atomName:135 'FOUNDRY' 
+     Display atomName:135 'FOUNDRY'
      Display atomName:150  'CHARSET_REGISTRY'
      Display atomName:151  'ISO8859'
      Display atomName:152 'CHARSET_ENCODING'
-     Display atomName:154 
+     Display atomName:154
     "
 !
 
@@ -9705,7 +9767,7 @@
      of name in a resource class.
      This is highly X specific and  currently not used.
 
-     Notice: 
+     Notice:
 	we do not plan to use X's resources for ST/X's defaults,
 	styles or resources. This would make porting of applications
 	to different platforms much more difficult (Windows has no resource
@@ -9738,14 +9800,14 @@
 	OpenWindows.Beep:       notices
      the following returns 'notices'.
 
-	 Display getResource:'Beep' class:'OpenWindows'   
+	 Display getResource:'Beep' class:'OpenWindows'
 
      if your ~/.Xdefaults contains an entry such as:
 	*.beNiceToColormap:       false
      the following return 'false'.
 
-	 Display getResource:'beNiceToColormap' class:'any'  
-	 Display getResource:'beNiceToColormap' class:''  
+	 Display getResource:'beNiceToColormap' class:'any'
+	 Display getResource:'beNiceToColormap' class:''
     "
 !
 
@@ -9755,7 +9817,7 @@
 
     <context: #return>
 
-%{ 
+%{
     Atom prop;
 
     if (ISCONNECTED
@@ -9763,7 +9825,7 @@
      && (__qIsString(aStringOrSymbol) || __qIsSymbol(aStringOrSymbol))) {
 
 	ENTER_XLIB();
-	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol), 
+	prop = XInternAtom(myDpy, __stringVal(aStringOrSymbol),
 				  (create == true) ? False : True);
 	LEAVE_XLIB();
 	if (prop == None) {
@@ -9868,7 +9930,7 @@
 !
 
 primGetBitsFrom:aDrawableId x:srcx y:srcy width:w height:h into:imageBits infoInto:info
-    "since XGetImage may allocate huge amount of stack space 
+    "since XGetImage may allocate huge amount of stack space
      (some implementations use alloca), this must run with unlimited stack."
 
     <context: #return>
@@ -9928,7 +9990,7 @@
 	    /* imageBits too small */
 	    fprintf(stderr, "Workstation [warning]: byteArray too small in primGetBits\n");
 	    fprintf(stderr, "  bytes need:%d given:%d\n", numBytes, __byteArraySize(imageBits));
-	    fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n", 
+	    fprintf(stderr, "  pad:%d depth:%d imgBytesPerLine:%d\n",
 				image->bitmap_pad, image->depth, image->bytes_per_line);
 	    goto fail;
 	}
@@ -9948,7 +10010,7 @@
 	    __ArrayInstPtr(info)->a_element[4] = @symbol(XYPixmap);
 	else if (image->format == ZPixmap)
 	    __ArrayInstPtr(info)->a_element[4] = @symbol(ZPixmap);
-        
+
 	__ArrayInstPtr(info)->a_element[5] = __MKSMALLINT(image->bitmap_unit);
 	__ArrayInstPtr(info)->a_element[6] = __MKSMALLINT(image->bitmap_pad);
 	__ArrayInstPtr(info)->a_element[7] = __MKSMALLINT(image->bits_per_pixel);
@@ -9956,7 +10018,7 @@
 	XDestroyImage(image);
 	RETURN ( true );
     }
-fail: 
+fail:
     if (image) {
 	XDestroyImage(image);
     }
@@ -9990,10 +10052,10 @@
 	^ copyBuffer
     ].
 
-    self 
-	requestSelection:clipboardAtom 
-	property:(self atomIDOf:#'ST_SELECTION') 
-	type:(self atomIDOf:#'ST_OBJECT') 
+    self
+	requestSelection:clipboardAtom
+	property:(self atomIDOf:#'ST_SELECTION')
+	type:(self atomIDOf:#'ST_OBJECT')
 	for:drawableId.
     ^ nil
 
@@ -10002,37 +10064,37 @@
 
 getTextSelection:selectionBufferSymbol for:drawableId
     "get the text selection -  either immediate, or asynchronous.
-     Returns nil, if async request is on its way 
+     Returns nil, if async request is on its way
      or if no selection is available"
 
     |selectionId selectionOwnerWindowId|
 
     selectionBufferSymbol == #selection ifTrue:[
-        selectionId := primaryAtom.
+	selectionId := primaryAtom.
     ] ifFalse:[
-        selectionId := clipboardAtom.
+	selectionId := clipboardAtom.
     ].
 
     selectionOwnerWindowId := self getSelectionOwnerOf:selectionId.
     selectionOwnerWindowId isNil ifTrue:[
-        ^ nil       "no selection"
+	^ nil       "no selection"
     ].
 
     selectionOwnerWindowId == selectionOwner ifTrue:[
-        "I still hold the selection, so return my locally buffered data"
-        ^ self selectionAsString.
-    ].
-
-    self 
-        requestSelection:selectionId 
-        property:(self atomIDOf:#'VT_SELECTION') 
-        type:(self atomIDOf:#'UTF8_STRING')      
-        for:drawableId.
-
-"/    self 
-"/        requestSelection:selectionId 
-"/        property:(self atomIDOf:#'VT_SELECTION') 
-"/        type:stringAtom      
+	"I still hold the selection, so return my locally buffered data"
+	^ self selectionAsString.
+    ].
+
+    self
+	requestSelection:selectionId
+	property:(self atomIDOf:#'VT_SELECTION')
+	type:(self atomIDOf:#'UTF8_STRING')
+	for:drawableId.
+
+"/    self
+"/        requestSelection:selectionId
+"/        property:(self atomIDOf:#'VT_SELECTION')
+"/        type:stringAtom
 "/        for:drawableId.
 
     ^ nil.
@@ -10055,7 +10117,7 @@
 
     (aTargetAtom == (self atomIDOf:#STRING)) ifTrue:[
 	"the other view wants the selection as string"
-	^ self selectionAsString. 
+	^ self selectionAsString.
     ].
 
     (aTargetAtom == (self atomIDOf:#TARGETS)) ifTrue:[
@@ -10075,7 +10137,7 @@
 	 LENGTH is deprecated, since we do not know how the selection is
 	 going to be converted. The client must not rely on the length returned"
 
-	^ self selectionAsString size 
+	^ self selectionAsString size
     ].
 
     "we do not support the requestet target"
@@ -10095,16 +10157,16 @@
 	property := targetID.
     ].
 
-    self setProperty:property 
-	 type:targetID 
-	 value:something 
+    self setProperty:property
+	 type:targetID
+	 value:something
 	 for:requestorID.
 
-    self sendSelectionNotifySelection:selectionID 
-	 property:property 
+    self sendSelectionNotifySelection:selectionID
+	 property:property
 	 target:targetID
-	 time:t 
-	 from:windowID 
+	 time:t
+	 from:windowID
 	 to:requestorID.
 !
 
@@ -10120,7 +10182,7 @@
     "set the text selection, and make aWindowId be the owner.
      This can be used by any other X application.
 
-     We set both the PRIMARY and CLIPBOARD, so that you can paste 
+     We set both the PRIMARY and CLIPBOARD, so that you can paste
      into xterm."
 
     (self setSelectionOwner:aWindowId of:clipboardAtom) ifFalse:[
@@ -10141,7 +10203,7 @@
     supportedTargets := #(ST_OBJECT STRING TARGETS LENGTH).
 
     numericTargetArray := IntegerArray new:supportedTargets size.
-    supportedTargets keysAndValuesDo:[:index :targetSymbol| 
+    supportedTargets keysAndValuesDo:[:index :targetSymbol|
 	numericTargetArray at:index put:(self atomIDOf:targetSymbol)
     ].
 
@@ -10163,7 +10225,7 @@
 	selectionAtomID := selectionAtomSymbolOrID.
     ].
 
-%{  
+%{
     Window window;
 
     if (__isAtomID(selectionAtomID) && ISCONNECTED) {
@@ -10186,7 +10248,7 @@
 
     <context:#return>
 
-%{  
+%{
     Atom sel_prop;
     char *cp;
 
@@ -10206,7 +10268,7 @@
 	}
 
 	ENTER_XLIB();
-	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID), 
+	XConvertSelection(dpy, __AtomVal(selectionID), __AtomVal(typeID),
 			       __AtomVal(propertyID), w, CurrentTime);
 	LEAVE_XLIB();
 
@@ -10217,14 +10279,14 @@
     ^ false
 
     "
-     Display 
+     Display
 	requestSelection:(Display atomIDOf:'PRIMARY')
 	property:(Display atomIDOf:'VT_SELECTION')
 	type:(Display atomIDOf:'STRING')
 	for:Transcript id
     "
     "
-     Display 
+     Display
 	requestSelection:(Display atomIDOf:'PRIMARY')
 	property:(Display atomIDOf:'VT_SELECTION')
 	type:(Display atomIDOf:'C_STRING')
@@ -10236,7 +10298,7 @@
     "send a selectionNotify back from a SelectionRequest"
 
     <context: #return>
-%{  
+%{
     if (ISCONNECTED
 	&& (__isAtomID(propertyID) || propertyID == nil)
 	&& __isAtomID(targetID) && __isAtomID(selectionID)) {
@@ -10290,7 +10352,7 @@
 	/* send nil property if selection cannot be converted */
 	if (propertyID == nil)
 	    ev.xselection.property = None;
-	else 
+	else
 	    ev.xselection.property = __AtomVal(propertyID);
 
 
@@ -10340,7 +10402,7 @@
 	selectionAtomID := selectionAtomSymbolOrID.
     ].
 
-%{ 
+%{
     Window win;
 
     if (__isExternalAddress(aWindowId)
@@ -10371,7 +10433,7 @@
     "clear a rectangular area to viewbackground"
 
     <context: #return>
-%{  
+%{
 
     int w, h;
 
@@ -10400,7 +10462,7 @@
     "clear a window to viewbackground"
 
     <context: #return>
-%{ 
+%{
 
     if (ISCONNECTED) {
 	if (__isExternalAddress(aWindowId)) {
@@ -10418,7 +10480,7 @@
     "configure stacking operation of aWindowId w.r.t siblingId"
 
     <context: #return>
-%{  
+%{
 
     XWindowChanges chg;
     int mask = CWSibling | CWStackMode;
@@ -10454,8 +10516,8 @@
 !
 
 getGeometryOf:aWindowId
-    "get a windows geometry. 
-     NOTICE: X-WindowManagers usually do wrap client topViews into their own 
+    "get a windows geometry.
+     NOTICE: X-WindowManagers usually do wrap client topViews into their own
      decoration views (top label, resize boundaries etc.).
      Thus, the numbers returned here for topViews are the physical (real) dimensions
      relative to such a wrapper.
@@ -10466,18 +10528,18 @@
 
     |x y width height depth borderWidth info|
 
-%{  
+%{
     int x_ret, y_ret;
-    unsigned int width_ret, height_ret, 
+    unsigned int width_ret, height_ret,
 		 border_width_ret, depth_ret;
     Window root_ret;
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
 	ENTER_XLIB();
-	XGetGeometry(myDpy, __WindowVal(aWindowId), 
-		     &root_ret, 
-		     &x_ret, &y_ret, 
+	XGetGeometry(myDpy, __WindowVal(aWindowId),
+		     &root_ret,
+		     &x_ret, &y_ret,
 		     &width_ret, &height_ret, &border_width_ret,
 		     &depth_ret);
 	LEAVE_XLIB();
@@ -10523,12 +10585,12 @@
 
 isValidWindowId:aWindowId
     "return true, if the given window ID is (still) valid.
-     Especially useful, if the passed windowID is 
+     Especially useful, if the passed windowID is
      an alien (external) windows id."
 
     |ret|
 
-%{ 
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
@@ -10538,7 +10600,7 @@
 	int nChildren;
 
 /*        ENTER_XLIB(); */
-	ok = XQueryTree(myDpy, __WindowVal(aWindowId), 
+	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
 			&root, &parent, &children, &nChildren);
 	if (children) {
 	    XFree(children);
@@ -10573,7 +10635,7 @@
     "bring a window to back"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
@@ -10586,12 +10648,12 @@
     self primitiveFailedOrClosedConnection
 !
 
-mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos 
+mapView:aView id:aWindowId iconified:aBoolean atX:xPos y:yPos
 	      width:w height:h minExtent:minExt maxExtent:maxExt
 
     <context: #return>
 
-    "make a window visible - either as icon or as a real view 
+    "make a window visible - either as icon or as a real view
      in addition, allow change of extend, position, minExtend and maxExtent.
      Needed for restart, to allow recreating a view as iconified,
      and to collaps/expand windows."
@@ -10617,7 +10679,7 @@
 	maxW := maxExt x.
 	maxH := maxExt y.
     ].
-%{  
+%{
 
     XWMHints wmhints;
     XSizeHints szhints;
@@ -10716,7 +10778,7 @@
     "make a window visible"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
@@ -10733,7 +10795,7 @@
     "move and resize a window"
 
     <context: #return>
-%{  
+%{
 
     int newWidth, newHeight;
 
@@ -10760,7 +10822,7 @@
     "move a window"
 
     <context: #return>
-%{ 
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId) && __bothSmallInteger(x, y)) {
@@ -10777,7 +10839,7 @@
     "return a windows parent-window id.
      Useful with getGeometryOf:, to compute information about the decoration."
 
-%{ 
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
@@ -10786,7 +10848,7 @@
 	int nChildren;
 
 /*        ENTER_XLIB(); */
-	ok = XQueryTree(myDpy, __WindowVal(aWindowId), 
+	ok = XQueryTree(myDpy, __WindowVal(aWindowId),
 			&root, &parent, &children, &nChildren);
 	if (children) {
 	    XFree(children);
@@ -10813,16 +10875,16 @@
     "define a windows name"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isNonNilObject(aString)
      && (__qIsString(aString) || __qIsSymbol(aString))
      && __isExternalAddress(aWindowId)) {
-        ENTER_XLIB();
-        XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
-        LEAVE_XLIB();
-        RETURN ( self );
+	ENTER_XLIB();
+	XStoreName(myDpy, __WindowVal(aWindowId), (char *) __stringVal(aString));
+	LEAVE_XLIB();
+	RETURN ( self );
     }
 %}.
     self primitiveFailedOrClosedConnection
@@ -10832,7 +10894,7 @@
     "bring a window to front"
 
     <context: #return>
-%{ 
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
@@ -10888,7 +10950,7 @@
     "resize a window"
 
     <context: #return>
-%{  
+%{
 
     int newWidth, newHeight;
 
@@ -10911,7 +10973,7 @@
     "turn on/off backing-store for a window"
 
     <context: #return>
-%{  
+%{
 
     XSetWindowAttributes wa;
 
@@ -10938,7 +11000,7 @@
     "set bit gravity for a window"
 
     <context: #return>
-%{  
+%{
 
     XSetWindowAttributes wa;
 
@@ -10981,7 +11043,7 @@
     "define a windows cursor"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)
@@ -11005,7 +11067,7 @@
     "define a windows iconname"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isNonNilObject(aString)
@@ -11024,7 +11086,7 @@
     "turn on/off save-under for a window"
 
     <context: #return>
-%{  
+%{
 
     XSetWindowAttributes wa;
 
@@ -11046,7 +11108,7 @@
     "set aWindowId to be a transient of aMainWindow"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
@@ -11077,7 +11139,7 @@
      the background drawing color, which is used with opaque drawing."
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)
@@ -11093,12 +11155,12 @@
 
 setWindowBackgroundPixmap:aPixmapId in:aWindowId
     "set the windows background pattern to be a form.
-     This is the pattern with which the view is filled whenever exposed. 
-     Do not confuse this with the background drawing color, which is used 
+     This is the pattern with which the view is filled whenever exposed.
+     Do not confuse this with the background drawing color, which is used
      with opaque drawing."
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)
@@ -11116,7 +11178,7 @@
     "set the windows border color"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)
@@ -11134,7 +11196,7 @@
     "set the windows border pattern"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)
@@ -11155,7 +11217,7 @@
 
     hasShapeExtension ifFalse:[^ self].
 
-%{ 
+%{
 
 #ifdef SHAPE
     Pixmap shapeBitmap;
@@ -11182,7 +11244,7 @@
     "set the windows border width"
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)
@@ -11233,7 +11295,7 @@
     "set window gravity for a window"
 
     <context: #return>
-%{  
+%{
 
     XSetWindowAttributes wa;
 
@@ -11367,7 +11429,7 @@
      nil arguments are ignored."
 
     <context: #return>
-%{  
+%{
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
 	Display *dpy = myDpy;
@@ -11404,11 +11466,11 @@
 
     stringUsed := aString.
     self supportsUTF8WindowLabels ifTrue:[
-        stringUsed := aString utf8Encoded.
+	stringUsed := aString utf8Encoded.
     ] ifFalse:[
-        aString bitsPerCharacter > 8 ifTrue:[
-            stringUsed := aString utf8Encoded.
-        ].
+	aString bitsPerCharacter > 8 ifTrue:[
+	    stringUsed := aString utf8Encoded.
+	].
     ].
 
     self primSetWindowName:stringUsed in:aWindowId
@@ -11423,7 +11485,7 @@
 
     hasShapeExtension ifFalse:[^ self].
 
-%{ 
+%{
 
 #ifdef SHAPE
     Pixmap shapeBitmap;
@@ -11451,7 +11513,7 @@
     "make a window invisible"
 
     <context: #return>
-%{  
+%{
 
     if (!ISCONNECTED) {
 	RETURN ( self );
@@ -11472,7 +11534,7 @@
      The passed windowID may be an alien windows id."
 
     <context: #return>
-%{  
+%{
 
     if (ISCONNECTED
      && __isExternalAddress(aWindowId)) {
@@ -11507,7 +11569,7 @@
 !XWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.459 2004-05-11 08:01:01 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.460 2004-09-14 12:30:34 cg Exp $'
 ! !
 
 XWorkstation initialize!