*** empty log message ***
authorclaus
Tue, 07 Mar 1995 22:57:31 +0100
changeset 115 1d93fd8c5371
parent 114 4f27fbcf1e1c
child 116 c0db6a8ab4ac
*** empty log message ***
Color.st
Cursor.st
DevWorkst.st
DeviceWorkstation.st
Font.st
Form.st
Image.st
WEvent.st
WSensor.st
WindowEvent.st
WindowSensor.st
XWorkstat.st
XWorkstation.st
--- a/Color.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/Color.st	Tue Mar 07 22:57:31 1995 +0100
@@ -26,7 +26,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Color.st,v 1.21 1995-03-01 00:11:34 claus Exp $
+$Header: /cvs/stx/stx/libview/Color.st,v 1.22 1995-03-07 21:55:02 claus Exp $
 '!
 
 !Color class methodsFor:'documentation'!
@@ -47,7 +47,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Color.st,v 1.21 1995-03-01 00:11:34 claus Exp $
+$Header: /cvs/stx/stx/libview/Color.st,v 1.22 1995-03-07 21:55:02 claus Exp $
 "
 !
 
@@ -315,7 +315,7 @@
 
     "if all colors are registered in Lobby, use:"
 "
-    Lobby contentsDo:[:aColor |
+    Lobby do:[:aColor |
 	aColor restored.
 	Lobby unregister:aColor
     ].
@@ -327,7 +327,7 @@
 	aColor restored
     ].
 
-    Lobby contentsDo:[:aColor |
+    Lobby do:[:aColor |
 	Lobby unregister:aColor
     ]
 !
@@ -438,13 +438,6 @@
     ^ Grey
 !
 
-brightness:grey
-    "return a grey color. For ST-80 compatibility,
-     the grey value is given in 0..1 instead of percent"
-
-    ^ self grey:(grey * 100)
-!
-
 grey:grey
     "return a grey color. The argument, grey is interpreted as
      percent (0..100)."
@@ -533,7 +526,8 @@
      are initially undefined. The components can be set to any value
      using Color>>red:green:blue. Care should be taken, since this call
      fails on static color or b&w displays (i.e. it depends on the device
-     being a pseudocolor device using colormaps)."
+     being a pseudocolor device using colormaps).
+     Returns nil, if no more colorCells are available."
 
     |c lutIndex|
 
@@ -572,7 +566,7 @@
 
     "look if already known"
 
-    Lobby contentsDo:[:aColor |
+    Lobby do:[:aColor |
 	(rr = aColor red) ifTrue:[
 	    (rg = aColor green) ifTrue:[
 		(rb = aColor blue) ifTrue:[
@@ -658,17 +652,12 @@
     ^ newColor
 !
 
-nearestColorRed:r green:g blue:b error:error on:aDevice
-    "return a device color on aDevice with RGB values
-     same or near r/g/b, if there is one, nil otherwise.
-     Near is defined as having an error less than the argument
-     error (in percent). The error is computed by the color
-     vector distance (which is not the best possible solution)."
+nearestPreallocatedColorRed:r green:g blue:b on:aDevice
+    "return a device color on aDevice with rgb values same or near r/g/b.
+     This looks for preallocated colors only and is quite fast 
+     (no need to search)"
 
-    "first try exact color"
-
-    |delta minDelta bestSoFar rr rg rb
-     sR  "{ Class: SmallInteger }"
+    |sR  "{ Class: SmallInteger }"
      sG  "{ Class: SmallInteger }"
      sB  "{ Class: SmallInteger }"
      idx "{ Class: SmallInteger }"
@@ -700,21 +689,34 @@
 	idx := (((rI * nG) + gI) * nB + bI) + 1.
 	^ FixColors at:idx
     ].
-    "round to 1/300 i.e. to about 0.3%"
+    ^ nil
+!
+
+nearestColorRed:r green:g blue:b error:error on:aDevice in:colors
+    "return the nearest color on aDevice with RGB values
+     same or near r/g/b in a collection of colors.
+     If there is one, return it; nil otherwise.
+     Near is defined as having an error less than the argument
+     error (in percent). The error is computed by the color
+     vector distance (which may not be the best possible solution)."
 
-"/    rr := (r * 3.0) rounded / 3.0.
-"/    rg := (g * 3.0) rounded / 3.0.
-"/    rb := (b * 3.0) rounded / 3.0.
+    |delta minDelta bestSoFar rr rg rb|
+
+    "
+     round values somewhat - the human eye cannot distinguish
+     more than about 100 grades anyway ...
+    "
+
+"/    rr := (r * 3.0) rounded / 3.0.   "round to about 0.3%"
+"/    rg := (g * 3.0) rounded / 3.0.   "round to about 0.3%"
+"/    rb := (b * 3.0) rounded / 3.0.   "round to about 0.3%"
 
     rr := r rounded.                "round to 1%"
     rg := (g * 2.0) rounded / 2.0.  "round to 0.5%"
     rb := (b / 2) rounded * 2.      "round to 2%"
 
-    "exact color was not available, search for the one with the
-     smallest delta"
-
     minDelta := 999999.
-    Lobby contentsDo:[:aColor |
+    colors do:[:aColor |
 	|cr cg cb|
 
 	(aColor device == aDevice) ifTrue:[
@@ -723,10 +725,14 @@
 "/                cr := (aColor red * 3.0) rounded / 3.0.
 "/                cg := (aColor green * 3.0) rounded / 3.0.
 "/                cb := (aColor blue * 3.0) rounded / 3.0.
+
 		cr := aColor red rounded.
 		cg := (aColor green * 2.0) rounded / 2.0.
 		cb := (aColor blue / 2) rounded * 2.
 
+		"
+		 an exact fit - no need to continue search
+		"
 		(rr = cr) ifTrue:[
 		    (rg = cg) ifTrue:[
 			(rb = cb) ifTrue:[
@@ -735,6 +741,9 @@
 		    ]
 		].
 
+		"
+		 Q: how should component errors be weighted ?
+		"
 		delta := ((rr - cr) squared * 3)
 			 + ((rg - cg) squared * 4)
 			 + ((rb - cb) squared * 2).
@@ -754,98 +763,64 @@
     ^ nil
 !
 
+nearestColorRed:r green:g blue:b error:error on:aDevice
+    "return a device color on aDevice with RGB values
+     same or near r/g/b, if there is one, nil otherwise.
+     Near is defined as having an error less than the argument
+     error (in percent). The error is computed by the color
+     vector distance (which may not be the best possible solution)."
+
+    "
+     if there are preallocated colors, things are much easier ...
+    "
+    (FixColors notNil and:[aDevice == Display]) ifTrue:[
+	^ self nearestPreallocatedColorRed:r green:g blue:b on:aDevice
+    ].
+
+    "
+     search in existing colors ...
+    "
+    ^ self nearestColorRed:r 
+		     green:g 
+		      blue:b 
+		     error:error 
+			on:aDevice 
+			in:Lobby
+!
+
 quickNearestColorRed:r green:g blue:b error:error on:aDevice
     "return a device color on aDevice with rgb values
      same or near r/g/b.
+     Near is defined as having an error less than the argument
+     error (in percent). The error is computed by the color
+     vector distance (which may not be the best possible solution).
      This looks for primary colors only and is thus faster
      than the general nearestColor search (slightly uglier though)."
 
-    "first try exact color"
-
-    |delta minDelta bestSoFar rr rg rb colors
-     sR  "{ Class: SmallInteger }"
-     sG  "{ Class: SmallInteger }"
-     sB  "{ Class: SmallInteger }"
-     idx "{ Class: SmallInteger }"
-     nR  "{ Class: SmallInteger }"
-     nG  "{ Class: SmallInteger }"
-     nB  "{ Class: SmallInteger }"
-     rI  "{ Class: SmallInteger }"
-     gI  "{ Class: SmallInteger }"
-     bI  "{ Class: SmallInteger }"|
+    |colors|
 
     "
      if there are preallocated colors, thungs are much easier ...
     "
     (FixColors notNil and:[aDevice == Display]) ifTrue:[
-	"
-	 round to the step given by FixColors
-	"
-	nR := NumFixRed.
-	nG := NumFixGreen.
-	nB := NumFixBlue.
-
-	sR := 100 // (nR - 1).
-	sG := 100 // (nG - 1).
-	sB := 100 // (nB - 1).
-
-	rI := (r + (sR // 2)) // sR.
-	gI := (g + (sG // 2)) // sG.
-	bI := (b + (sB // 2)) // sB.
-	idx := (((rI * nG) + gI) * nB + bI) + 1.
-	^ FixColors at:idx
+	^ self nearestPreallocatedColorRed:r green:g blue:b on:aDevice
     ].
 
-    "round to 1/300 i.e. to about 0.3%"
-
-"/    rr := (r * 3.0) rounded.
-"/    rg := (g * 3.0) rounded.
-"/    rb := (b * 3.0) rounded.
-    rr := r rounded.                "round to 1%"
-    rg := (g * 2.0) rounded.        "round to 0.5%"
-    rb := (b / 2) rounded.          "round to 2%"
-
     aDevice == Display ifTrue:[
 	colors := DitherColors
     ] ifFalse:[
 	colors := DitherColors collect:[:aColor | aColor on:aDevice]
     ].
 
-    "exact color was not available, search for the one with the
-     smallest delta"
-
-    minDelta := 999999.
-    colors do:[:aColor |
-	|cr cg cb|
-
-"/        cr := (aColor red * 3.0) rounded.
-"/        cg := (aColor green * 3.0) rounded.
-"/        cb := (aColor blue * 3.0) rounded.
-	cr := aColor red rounded.
-	cg := (aColor green * 2.0) rounded.
-	cb := (aColor blue / 2) rounded.
-	(rr == cr) ifTrue:[
-	    (rg == cg) ifTrue:[
-		(rb == cb) ifTrue:[
-		    ^ aColor
-		]
-	    ]
-	].
-
-	"
-	 Q: how should component errors be weighted ?
-	"
-	delta := ((rr - cr) squared * 3)
-		 + ((rg - cg) squared * 4)
-		 + ((rb - cb) squared * 2).
-
-	delta < minDelta ifTrue:[
-	    bestSoFar := aColor.
-	    minDelta := delta
-	]
-    ].
-
-    ^ bestSoFar
+    "
+     search in existing colors ...
+    "
+    ^ self nearestColorRed:r 
+		     green:g 
+		      blue:b 
+		     error:error 
+			on:aDevice 
+			in:colors
 !
 
 hue:h light:l saturation:s
@@ -895,7 +870,7 @@
     ].
     "look if already known"
 
-    Lobby contentsDo:[:aColor |
+    Lobby do:[:aColor |
 	(aColor colorId == id) ifTrue:[
 	    ^ aColor
 	]
@@ -914,11 +889,12 @@
 "/    rr := (r * 3.0) rounded / 3.0.
 "/    rg := (g * 3.0) rounded / 3.0.
 "/    rb := (b * 3.0) rounded / 3.0.
+
     rr := r rounded.                "round to 1%"
     rg := (g * 2.0) rounded / 2.0.  "round to 0.5%"
     rb := (b / 2) rounded * 2.      "round to 2%"
 
-    Lobby contentsDo:[:aColor |
+    Lobby do:[:aColor |
 "/        aColor colorId notNil ifTrue:[
 	    (rr = aColor red) ifTrue:[
 		(rg = aColor green) ifTrue:[
@@ -946,12 +922,13 @@
 "/    rr := (r * 3.0) rounded / 3.0.
 "/    rg := (g * 3.0) rounded / 3.0.
 "/    rb := (b * 3.0) rounded / 3.0.
+
     rr := r rounded.                "round to 1%"
     rg := (g * 2.0) rounded / 2.0.  "round to 0.5%"
     rb := (b / 2) rounded * 2.      "round to 2%"
 
     minDelta := 100*100*100.
-    Lobby contentsDo:[:aColor |
+    Lobby do:[:aColor |
 	(aColor device == aDevice) ifTrue:[
 "/            (aColor colorId notNil) ifTrue:[
 		dRed := rr - aColor red.
@@ -1199,7 +1176,7 @@
 	hiL := nil.
 
 	"find the 2 bounding colors"
-	Lobby contentsDo:[:aColor |
+	Lobby do:[:aColor |
 	    aColor colorId notNil ifTrue:[
                 
 		Color withHLSFromRed:aColor red green:aColor green blue:aColor blue do:[:h :l :s |
@@ -1267,7 +1244,7 @@
     lowH := nil.
     hiH := nil.
 
-    Lobby contentsDo:[:aColor |
+    Lobby do:[:aColor |
 	aColor colorId notNil ifTrue:[
 	    Color withHLSFromRed:aColor red green:aColor green blue:aColor blue do:[:h :l :s |
 		| cl ch cs|
@@ -1445,7 +1422,7 @@
      This code uses the table of preallocated fix-colors to find
      dither colors."
 
-    |rh rl rs 
+    | 
      nR "{ Class: SmallInteger }"
      nG "{ Class: SmallInteger }"
      nB "{ Class: SmallInteger }"
@@ -2022,37 +1999,11 @@
      if one already exists, return the one. If no exact match is found,
      search for one with an error less than the argument error (in percent)."
 
-    |newColor id 
-     sR  "{ Class: SmallInteger }"
-     sG  "{ Class: SmallInteger }"
-     sB  "{ Class: SmallInteger }"
-     idx "{ Class: SmallInteger }"
-     nR  "{ Class: SmallInteger }"
-     nG  "{ Class: SmallInteger }"
-     nB  "{ Class: SmallInteger }"
-     rI  "{ Class: SmallInteger }"
-     gI  "{ Class: SmallInteger }"
-     bI  "{ Class: SmallInteger }"|
+    |newColor id|
 
     "if I'am already assigned to that device ..."
     (device == aDevice) ifTrue:[^ self].
 
-    (FixColors notNil and:[aDevice == Display]) ifTrue:[
-	nR := NumFixRed.
-	nG := NumFixGreen.
-	nB := NumFixBlue.
-
-	sR := 100 // (nR - 1).
-	sG := 100 // (nG - 1).
-	sB := 100 // (nB - 1).
-
-	rI := (redVal + (sR // 2)) // sR.
-	gI := (greenVal + (sG // 2)) // sG.
-	bI := (blueVal + (sB // 2)) // sB.
-	idx := (((rI * nG) + gI) * nB + bI) + 1.
-	^ FixColors at:idx
-    ].
-
     "first look if not already there"
     newColor := Color nearestColorRed:redVal green:greenVal blue:blueVal 
 				error:error on:aDevice.
--- a/Cursor.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/Cursor.st	Tue Mar 07 22:57:31 1995 +0100
@@ -28,7 +28,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Cursor.st,v 1.14 1995-02-06 00:35:38 claus Exp $
+$Header: /cvs/stx/stx/libview/Cursor.st,v 1.15 1995-03-07 21:55:19 claus Exp $
 '!
 
 !Cursor class methodsFor:'documentation'!
@@ -49,7 +49,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Cursor.st,v 1.14 1995-02-06 00:35:38 claus Exp $
+$Header: /cvs/stx/stx/libview/Cursor.st,v 1.15 1995-03-07 21:55:19 claus Exp $
 "
 !
 
@@ -94,7 +94,7 @@
 flushDeviceCursors
     "unassign all cursors from their device"
 
-    Lobby contentsDo:[:aCursor |
+    Lobby do:[:aCursor |
 	aCursor restored.
 	Lobby changed:aCursor
     ]
@@ -174,7 +174,7 @@
     |newCursor|
 
     "first look if not already known"
-    Lobby contentsDo:[:aCursor |
+    Lobby do:[:aCursor |
 	(aCursor sourceForm == sourceForm) ifTrue:[
 	    (aCursor maskForm == maskForm) ifTrue:[
 		(aCursor hotX == hotX) ifTrue:[
@@ -203,7 +203,7 @@
     |newCursor|
 
     "first look if not already known"
-    Lobby contentsDo:[:aCursor |
+    Lobby do:[:aCursor |
 	(aCursor shape == aShape) ifTrue:[
 	    ^ aCursor
 	]
@@ -220,7 +220,7 @@
     |newCursor oldCursor|
 
     "first look if not already known"
-    Lobby contentsDo:[:aCursor |
+    Lobby do:[:aCursor |
 	(aCursor shape == aShape) ifTrue:[
 	    (aCursor device == aDevice) ifTrue:[^ aCursor].
 	    oldCursor := aCursor
@@ -592,7 +592,7 @@
     (device == aDevice) ifTrue:[^ self].
 
     "first look if not already there"
-    Lobby contentsDo:[:aCursor |
+    Lobby do:[:aCursor |
 	(aCursor device == aDevice) ifTrue:[
 	    shape notNil ifTrue:[
 		(aCursor shape == shape) ifTrue:[
--- a/DevWorkst.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/DevWorkst.st	Tue Mar 07 22:57:31 1995 +0100
@@ -34,7 +34,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.28 1995-02-27 10:17:50 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.29 1995-03-07 21:55:41 claus Exp $
 '!
 
 !DeviceWorkstation class methodsFor:'documentation'!
@@ -55,7 +55,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.28 1995-02-27 10:17:50 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/DevWorkst.st,v 1.29 1995-03-07 21:55:41 claus Exp $
 "
 !
 
@@ -1045,44 +1045,6 @@
 
 !DeviceWorkstation methodsFor:'keyboard mapping'!
 
-sendKeyPress:untranslatedKey x:x y:y to:someone
-    "forward a key-press event to some handler;
-     the key is translated via the translation table here."
-
-    |xlatedKey delegate dest|
-
-    xlatedKey := self translateKey:untranslatedKey.
-    xlatedKey notNil ifTrue:[
-	(delegate := someone delegate) notNil ifTrue:[
-	    delegate keyPress:xlatedKey x:x y:y view:someone
-	] ifFalse:[
-	    (dest := someone controller) isNil ifTrue:[
-		dest := someone
-	    ].
-	    dest keyPress:xlatedKey x:x y:y
-	]
-    ]
-!
-
-sendKeyRelease:untranslatedKey x:x y:y to:someone
-    "forward a key-release event to some handler;
-     the key is translated via the translation table here."
-
-    |xlatedKey delegate dest|
-
-    xlatedKey := self translateKey:untranslatedKey.
-    xlatedKey notNil ifTrue:[
-	(delegate := someone delegate) notNil ifTrue:[
-	    delegate keyRelease:xlatedKey x:x y:y view:someone
-	] ifFalse:[
-	    (dest := someone controller) isNil ifTrue:[
-		dest := someone
-	    ].
-	    dest keyRelease:xlatedKey x:x y:y
-	]
-    ]
-!
-
 translateKey:untranslatedKey
     "Return the key translated via the translation table.
      Your application program should never depend on the values returned
@@ -1120,6 +1082,368 @@
     ^ xlatedKey
 ! !
 
+!DeviceWorkstation methodsFor:'event forwarding'!
+
+keyPress:untranslatedKey x:x y:y view:aView
+    "forward a key-press event for some view"
+
+    |xlatedKey sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor keyPress:untranslatedKey x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	xlatedKey := self translateKey:untranslatedKey.
+	xlatedKey notNil ifTrue:[
+	    WindowEvent
+	      sendEvent:#keyPress:x:y:
+	      arguments:(Array with:xlatedKey with:x with:y)
+	      view:aView
+	]
+    ]
+!
+
+keyRelease:untranslatedKey x:x y:y view:aView
+    "forward a key-release event for some view"
+
+    |xlatedKey sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor keyRelease:untranslatedKey x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	xlatedKey := self translateKey:untranslatedKey.
+	xlatedKey notNil ifTrue:[
+	    WindowEvent
+		sendEvent:#keyRelease:x:y:
+		arguments:(Array with:xlatedKey with:x with:y)
+		view:aView
+	]
+    ]
+!
+
+buttonPress:button x:x y:y view:aView
+    "forward a button-press event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonPress:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonPress:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonShiftPress:button x:x y:y view:aView
+    "forward a button-shift-press event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonShiftPress:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonShiftPress:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonMultiPress:button x:x y:y view:aView
+    "forward a button-multi-press event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonMultiPress:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonMultiPress:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonRelease:button x:x y:y view:aView
+    "forward a button-release event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonRelease:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonRelease:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonMotion:button x:x y:y view:aView
+    "forward a button-motion for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonMotion:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonMotion:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+pointerEnter:buttonState x:x y:y view:aView
+    "forward a pointer enter for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor pointerEnter:buttonState x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#pointerEnter:x:y:
+	    arguments:(Array with:buttonState with:x with:y)
+	    view:aView
+    ]
+!
+
+pointerLeave:buttonState view:aView
+    "forward a pointer leave for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor pointerLeave:buttonState view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#pointerLeave:
+	    arguments:(Array with:buttonState)
+	    view:aView
+    ]
+!
+
+focusInView:aView
+    "forward a focusIn event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor focusInView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#focusIn
+	    arguments:nil
+	    view:aView
+    ]
+!
+
+focusOutView:aView 
+    "forward a focusOut event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor focusOutView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#focusOut
+	    arguments:nil
+	    view:aView
+    ]
+!
+
+terminateView:aView
+    "forward a terminate event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor terminateView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView terminate
+    ]
+!
+
+saveAndTerminateView:aView
+    "forward a saveAndTerminate event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor saveAndTerminateView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView saveAndTerminate
+    ]
+!
+
+destroyedView:aView
+    "forward a destroyed event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor destroyedView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView destroyed
+    ]
+!
+
+unmappedView:aView
+    "forward an unmapped event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor unmappedView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView unmapped
+    ]
+!
+
+mappedView:aView
+    "forward a mapped event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor mappedView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView mapped
+    ]
+!
+
+coveredBy:otherView view:aView
+    "forward a covered for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor coveredBy:otherView view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView coveredBy:otherView 
+    ]
+!
+
+configureX:x y:y width:w height:h view:aView
+    "forward a configure for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor configureX:x y:y width:w height:h view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView configureX:x y:y width:w height:h 
+    ]
+!
+
+exposeX:x y:y width:w height:h view:aView
+    "forward an expose for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor exposeX:x y:y width:w height:h view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#exposeX:y:width:height:
+	    arguments:(Array with:x with:y with:width with:height)
+	    view:aView
+    ]
+!
+
+graphicExposeX:x y:y width:w height:h view:aView
+    "forward a graphic expose for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor graphicExposeX:x y:y width:w height:h view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#graphicExposeX:y:width:height:
+	    arguments:(Array with:x with:y with:width with:height)
+	    view:aView
+    ]
+!
+
+noExposeView:aView
+    "forward a noExpose event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor noExposeView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView noExpose 
+    ]
+! !
+
 !DeviceWorkstation methodsFor:'view registration'!
 
 addKnownView:aView withId:aNumber
--- a/DeviceWorkstation.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/DeviceWorkstation.st	Tue Mar 07 22:57:31 1995 +0100
@@ -34,7 +34,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.28 1995-02-27 10:17:50 claus Exp $
+$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.29 1995-03-07 21:55:41 claus Exp $
 '!
 
 !DeviceWorkstation class methodsFor:'documentation'!
@@ -55,7 +55,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.28 1995-02-27 10:17:50 claus Exp $
+$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.29 1995-03-07 21:55:41 claus Exp $
 "
 !
 
@@ -1045,44 +1045,6 @@
 
 !DeviceWorkstation methodsFor:'keyboard mapping'!
 
-sendKeyPress:untranslatedKey x:x y:y to:someone
-    "forward a key-press event to some handler;
-     the key is translated via the translation table here."
-
-    |xlatedKey delegate dest|
-
-    xlatedKey := self translateKey:untranslatedKey.
-    xlatedKey notNil ifTrue:[
-	(delegate := someone delegate) notNil ifTrue:[
-	    delegate keyPress:xlatedKey x:x y:y view:someone
-	] ifFalse:[
-	    (dest := someone controller) isNil ifTrue:[
-		dest := someone
-	    ].
-	    dest keyPress:xlatedKey x:x y:y
-	]
-    ]
-!
-
-sendKeyRelease:untranslatedKey x:x y:y to:someone
-    "forward a key-release event to some handler;
-     the key is translated via the translation table here."
-
-    |xlatedKey delegate dest|
-
-    xlatedKey := self translateKey:untranslatedKey.
-    xlatedKey notNil ifTrue:[
-	(delegate := someone delegate) notNil ifTrue:[
-	    delegate keyRelease:xlatedKey x:x y:y view:someone
-	] ifFalse:[
-	    (dest := someone controller) isNil ifTrue:[
-		dest := someone
-	    ].
-	    dest keyRelease:xlatedKey x:x y:y
-	]
-    ]
-!
-
 translateKey:untranslatedKey
     "Return the key translated via the translation table.
      Your application program should never depend on the values returned
@@ -1120,6 +1082,368 @@
     ^ xlatedKey
 ! !
 
+!DeviceWorkstation methodsFor:'event forwarding'!
+
+keyPress:untranslatedKey x:x y:y view:aView
+    "forward a key-press event for some view"
+
+    |xlatedKey sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor keyPress:untranslatedKey x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	xlatedKey := self translateKey:untranslatedKey.
+	xlatedKey notNil ifTrue:[
+	    WindowEvent
+	      sendEvent:#keyPress:x:y:
+	      arguments:(Array with:xlatedKey with:x with:y)
+	      view:aView
+	]
+    ]
+!
+
+keyRelease:untranslatedKey x:x y:y view:aView
+    "forward a key-release event for some view"
+
+    |xlatedKey sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor keyRelease:untranslatedKey x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	xlatedKey := self translateKey:untranslatedKey.
+	xlatedKey notNil ifTrue:[
+	    WindowEvent
+		sendEvent:#keyRelease:x:y:
+		arguments:(Array with:xlatedKey with:x with:y)
+		view:aView
+	]
+    ]
+!
+
+buttonPress:button x:x y:y view:aView
+    "forward a button-press event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonPress:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonPress:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonShiftPress:button x:x y:y view:aView
+    "forward a button-shift-press event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonShiftPress:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonShiftPress:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonMultiPress:button x:x y:y view:aView
+    "forward a button-multi-press event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonMultiPress:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonMultiPress:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonRelease:button x:x y:y view:aView
+    "forward a button-release event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonRelease:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonRelease:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+buttonMotion:button x:x y:y view:aView
+    "forward a button-motion for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor buttonMotion:button x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#buttonMotion:x:y:
+	    arguments:(Array with:button with:x with:y)
+	    view:aView
+    ]
+!
+
+pointerEnter:buttonState x:x y:y view:aView
+    "forward a pointer enter for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor pointerEnter:buttonState x:x y:y view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#pointerEnter:x:y:
+	    arguments:(Array with:buttonState with:x with:y)
+	    view:aView
+    ]
+!
+
+pointerLeave:buttonState view:aView
+    "forward a pointer leave for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor pointerLeave:buttonState view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#pointerLeave:
+	    arguments:(Array with:buttonState)
+	    view:aView
+    ]
+!
+
+focusInView:aView
+    "forward a focusIn event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor focusInView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#focusIn
+	    arguments:nil
+	    view:aView
+    ]
+!
+
+focusOutView:aView 
+    "forward a focusOut event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor focusOutView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#focusOut
+	    arguments:nil
+	    view:aView
+    ]
+!
+
+terminateView:aView
+    "forward a terminate event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor terminateView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView terminate
+    ]
+!
+
+saveAndTerminateView:aView
+    "forward a saveAndTerminate event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor saveAndTerminateView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView saveAndTerminate
+    ]
+!
+
+destroyedView:aView
+    "forward a destroyed event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor destroyedView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView destroyed
+    ]
+!
+
+unmappedView:aView
+    "forward an unmapped event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor unmappedView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView unmapped
+    ]
+!
+
+mappedView:aView
+    "forward a mapped event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor mappedView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView mapped
+    ]
+!
+
+coveredBy:otherView view:aView
+    "forward a covered for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor coveredBy:otherView view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView coveredBy:otherView 
+    ]
+!
+
+configureX:x y:y width:w height:h view:aView
+    "forward a configure for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor configureX:x y:y width:w height:h view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView configureX:x y:y width:w height:h 
+    ]
+!
+
+exposeX:x y:y width:w height:h view:aView
+    "forward an expose for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor exposeX:x y:y width:w height:h view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#exposeX:y:width:height:
+	    arguments:(Array with:x with:y with:width with:height)
+	    view:aView
+    ]
+!
+
+graphicExposeX:x y:y width:w height:h view:aView
+    "forward a graphic expose for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor graphicExposeX:x y:y width:w height:h view:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	WindowEvent
+	    sendEvent:#graphicExposeX:y:width:height:
+	    arguments:(Array with:x with:y with:width with:height)
+	    view:aView
+    ]
+!
+
+noExposeView:aView
+    "forward a noExpose event for some view"
+
+    |sensor|
+
+    (sensor := aView sensor) notNil ifTrue:[
+	sensor noExposeView:aView
+    ] ifFalse:[
+	"
+	 if there is no sensor ...
+	"
+	aView noExpose 
+    ]
+! !
+
 !DeviceWorkstation methodsFor:'view registration'!
 
 addKnownView:aView withId:aNumber
--- a/Font.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/Font.st	Tue Mar 07 22:57:31 1995 +0100
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1992 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Font.st,v 1.15 1995-02-27 10:18:01 claus Exp $
+$Header: /cvs/stx/stx/libview/Font.st,v 1.16 1995-03-07 21:55:56 claus Exp $
 '!
 
 !Font class methodsFor:'documentation'!
@@ -44,7 +44,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Font.st,v 1.15 1995-02-27 10:18:01 claus Exp $
+$Header: /cvs/stx/stx/libview/Font.st,v 1.16 1995-03-07 21:55:56 claus Exp $
 "
 !
 
@@ -158,7 +158,7 @@
 flushDeviceFonts
     "unassign all fonts from their device"
 
-    Lobby contentsDo:[:aFont |
+    Lobby do:[:aFont |
 	aFont restored.
 	Lobby changed:aFont
     ]
@@ -191,7 +191,7 @@
 
     "look if this font is already known"
 
-    Lobby contentsDo:[:aFont |
+    Lobby do:[:aFont |
 	(aFont family = family) ifTrue:[
 	    (aFont face = faceString) ifTrue:[
 		(aFont style = styleString) ifTrue:[
@@ -244,7 +244,7 @@
     (device == aDevice) ifTrue:[^ self].
 
     "first look if not already there"
-    Lobby contentsDo:[:aFont |
+    Lobby do:[:aFont |
 	(aDevice == aFont device) ifTrue:[
 	    (size == aFont size) ifTrue:[
 		(family = aFont family) ifTrue:[
--- a/Form.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/Form.st	Tue Mar 07 22:57:31 1995 +0100
@@ -26,7 +26,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Form.st,v 1.19 1995-02-27 10:18:21 claus Exp $
+$Header: /cvs/stx/stx/libview/Form.st,v 1.20 1995-03-07 21:56:08 claus Exp $
 '!
 
 !Form class methodsFor:'documentation'!
@@ -47,7 +47,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Form.st,v 1.19 1995-02-27 10:18:21 claus Exp $
+$Header: /cvs/stx/stx/libview/Form.st,v 1.20 1995-03-07 21:56:08 claus Exp $
 "
 !
 
@@ -81,7 +81,7 @@
     "recreate all forms on aDevice; called by Workstation, to
      have all background bitmaps at hand, when views are restored"
 
-    Lobby contentsDo:[:aForm |
+    Lobby do:[:aForm |
 	(aForm device == aDevice) ifTrue:[
 	    "now, try to recreate it"
 	    aForm recreate.
@@ -95,13 +95,13 @@
 
     (something == #save) ifTrue:[
 	"get all bits from the device into saveable arrays"
-	Lobby contentsDo:[:aForm |
+	Lobby do:[:aForm |
 	    aForm getBits
 	]
     ].
     (something == #restarted) ifTrue:[
 	"remove all left-over device info"
-	Lobby contentsDo:[:aForm |
+	Lobby do:[:aForm |
 	    aForm restored.
 	    Lobby changed:self
 	]
--- a/Image.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/Image.st	Tue Mar 07 22:57:31 1995 +0100
@@ -28,7 +28,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Image.st,v 1.24 1995-03-06 21:02:16 claus Exp $
+$Header: /cvs/stx/stx/libview/Image.st,v 1.25 1995-03-07 21:56:21 claus Exp $
 '!
 
 !Image class methodsFor:'documentation'!
@@ -49,7 +49,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Image.st,v 1.24 1995-03-06 21:02:16 claus Exp $
+$Header: /cvs/stx/stx/libview/Image.st,v 1.25 1995-03-07 21:56:21 claus Exp $
 "
 !
 
@@ -236,7 +236,7 @@
 flushDeviceImages
     "simply unassign all pictures from their device"
 
-    Lobby contentsDo:[:anImage |
+    Lobby do:[:anImage |
 	anImage restored
     ]
 !
--- a/WEvent.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/WEvent.st	Tue Mar 07 22:57:31 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Attic/WEvent.st,v 1.11 1995-02-06 00:38:02 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/WEvent.st,v 1.12 1995-03-07 21:56:53 claus Exp $
 '!
 
 !WindowEvent class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Attic/WEvent.st,v 1.11 1995-02-06 00:38:02 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/WEvent.st,v 1.12 1995-03-07 21:56:53 claus Exp $
 "
 !
 
@@ -157,78 +157,127 @@
     ^ nil
 ! !
 
-!WindowEvent methodsFor:'sending'!
+!WindowEvent class methodsFor:'forwarding events'!
+
+sendEvent:type arguments:arguments view:view
+    "forward the event represented by type and arguments to the views delegate,
+     the views controller or the view. 
 
-sendEvent
-    "forward the event represented by the receiver to the delegate,
-     the controller or the view. Only messages which are understood by
-     the delegate are forwarded.
-     Delegated messages get the original view as an extra argument."
+     If there is a delegate, only messages which are understood by it are 
+     forwarded. Also, the delegate is asked if it is willing to handle the event
+     before.
+     Delegated messages get the original view as an extra argument.
+     Delegation has higher priority than controller forwarding."
 
-    self sendEventWithFocusOn:nil
+    self sendEvent:type arguments:arguments view:view withFocusOn:nil 
 !
 
-sendEventWithFocusOn:focusView
-    "forward the event represented by the receiver to the delegate,
-     the controller or the view. If focusView is nonNil, and its a keyboard
-     event, the event is forwarded to it (but not if there is a delegate).
+sendEvent:type arguments:argArray view:view withFocusOn:focusView
+    "forward the event represented by type and arguments to the views delegate,
+     the views controller or the view. 
+     If focusView is nonNil, and it is a keyboard event, it is forwarded to this
+     view (but not if there was a delegate in the first place).
+
      If there is a delegate, only messages which are understood by it are 
-     forwarded. Delegated messages get the original view as an extra argument.
+     forwarded. Also, the delegate is asked if it is willing to handle the event
+     before.
+     Delegated messages get the original view as an extra argument.
      Delegation has higher priority than both controller or focusView 
      forwarding."
 
-    |delegate selector eventReceiver controller|
+    |delegate selector delegateMessage delegateQuery 
+     eventReceiver controller deviceMessage
+     isKeyEvent isButtonEvent isPointerEvent trans|
+
+    isKeyEvent := isButtonEvent := isPointerEvent := false.
 
-    selector := type.
+    (type == #'keyPress:x:y:') ifTrue:[
+	isKeyEvent := true.
+	deviceMessage := #'deviceKeyPress:x:y:'.
+	delegateMessage := #'keyPress:x:y:view:'.
+	delegateQuery := #'handlesKeyPress:inView:'.
+    ] ifFalse:[ (type == #'keyRelease:x:y:') ifTrue:[
+	isKeyEvent := true.
+	deviceMessage := #'deviceKeyRelease:x:y:'.
+	delegateMessage := #'keyRelease:x:y:view:'.
+	delegateQuery := #'handlesKeyRelease:inView:'.
+    ] ifFalse:[ (type == #'buttonPress:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonPress:x:y:'.
+	delegateMessage := #'buttonPress:x:y:view:'.
+	delegateQuery := #'handlesButtonPress:inView:'.
+    ] ifFalse:[ (type == #'buttonRelease:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonRelease:x:y:'.
+	delegateMessage := #'buttonRelease:x:y:view:'.
+	delegateQuery := #'handlesButtonRelease:inView:'.
+    ] ifFalse:[ (type == #'buttonShiftPress:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonShiftPress:x:y:'.
+	delegateMessage := #'buttonShiftPress:x:y:view:'.
+	delegateQuery := #'handlesButtonShiftPress:inView:'.
+    ] ifFalse:[ (type == #'buttonMultiPress:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonMultiPress:x:y:'.
+	delegateMessage := #'buttonMultiPress:x:y:view:'.
+	delegateQuery := #'handlesButtonMultiPress:inView:'.
+    ] ifFalse:[ (type == #'buttonMotion:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonMotion:x:y:'.
+	delegateMessage := #'buttonMotion:x:y:view:'.
+	delegateQuery := #'handlesButtonMotion:inView:'.
+    ] ifFalse:[ (type == #'pointerEnter:x:y:') ifTrue:[
+	isPointerEvent := true.
+	deviceMessage := #'devicePointerEnter:x:y:'.
+	delegateMessage := #'pointerEnter:x:y:view:'.
+	delegateQuery := #'handlesPointerEnter:inView:'.
+    ] ifFalse:[ (type == #'pointerLeave:') ifTrue:[
+	isPointerEvent := true.
+	delegateMessage := #'pointerLeave:view:'.
+	delegateQuery := #'handlesPointerLeave:inView:'.
+    ] ifFalse:[ (type == #'exposeX:y:width:height:') ifTrue:[
+	deviceMessage := #'deviceExposeX:y:width:height:'.
+    ] ifFalse:[ (type == #'graphicExposeX:y:width:height:') ifTrue:[
+	deviceMessage := #'deviceGraphicExposeX:y:width:height:'.
+    ]]]]]]]]]]].
 
-    delegate := view delegate.
-    delegate notNil ifTrue:[
+    "
+     handle delegated messages
+    "
+    (isKeyEvent 
+     or:[isButtonEvent 
+     or:[isPointerEvent]]) ifTrue:[
+	delegate := view delegate.
+
 	"
-	 what a kludge - sending to delegate needs another
-	 selector and an additional argument.
-	 have to edit the selector ...
+	 what a kludge - sending to delegate requires
+	 another selector and an additional argument ...
 	"
-	(selector endsWith:':') ifTrue:[
-	    selector := (selector , 'view:') asSymbol.
-	] ifFalse:[
-	    selector := (selector , 'View:') asSymbol.
-	].
-	(delegate respondsTo:selector) ifTrue:[
+	(delegate respondsTo:delegateMessage) ifTrue:[
 	    "
-	     mhmh have to convert to logical coordinates ...
-	    "        
-	    view transformation notNil ifTrue:[
-		(#(
-		  #'buttonPress:x:y:'
-		  #'buttonRelease:x:y:'
-		  #'buttonShiftPress:x:y:'
-		  #'buttonMultiPress:x:y:'
-		  #'buttonMotion:x:y:'
-		  #'keyPress:x:y:'
-		  #'keyRelease:x:y:'
-		  #'pointerEnter:x:y:'
-		  #'exposeX:y:width:height:'
-		  #'graphicExposeX:y:width:height:'
-		)includes:type) ifTrue:[
-		    arguments at:2 put:(view transformation applyInverseToX:(arguments at:2)).
-		    arguments at:3 put:(view transformation applyInverseToY:(arguments at:3)).
-		    (#(
-		      #'exposeX:y:width:height:'
-		      #'graphicExposeX:y:width:height:'
-		    )includes:type) ifTrue:[
-			arguments at:4 put:(view transformation applyInverseScaleX:(arguments at:4)).
-			arguments at:5 put:(view transformation applyInverseScaleY:(arguments at:5)).
+	     is the delegate interrested in that event ?
+	     (if it does not respond to the handlesXXX message,
+	      we assume: yes)
+	    "
+	    ((delegate respondsTo:delegateQuery) not
+	    or:[delegate perform:delegateQuery with:view]) ifTrue:[
+		"
+		 mhmh ... have to convert to logical coordinates
+		"        
+		(trans := view transformation) notNil ifTrue:[
+		    argArray size > 2 ifTrue:[
+			argArray at:2 put:(trans applyInverseToX:(argArray at:2)).
+			argArray at:3 put:(trans applyInverseToY:(argArray at:3)).
 		    ].
 		].
-	    ].
-	    arguments isNil ifTrue:[
-		delegate perform:selector with:view
-	    ] ifFalse:[
-		delegate perform:selector withArguments:(arguments copyWith:view)
-	    ].
-	    ^ self
+		argArray isNil ifTrue:[
+		    delegate perform:delegateMessage with:view
+		] ifFalse:[
+		    delegate perform:delegateMessage withArguments:(argArray copyWith:view)
+		].
+		^ self
+	    ]
 	].
-	selector := type.
     ].
 
     "
@@ -236,46 +285,37 @@
     "
     eventReceiver := view.
     (controller := view controller) notNil ifTrue:[  
-	(#(
-	  #'buttonPress:x:y:'
-	  #'buttonRelease:x:y:'
-	  #'buttonShiftPress:x:y:'
-	  #'buttonMultiPress:x:y:'
-	  #'buttonMotion:x:y:'
-	  #'keyPress:x:y:'
-	  #'keyRelease:x:y:'
-	  #'focusIn'
-	  #'focusOut'
-	  #'pointerEnter:x:y:'
-	  #'pointerLeave:'
-	) includes:selector) ifTrue:[
+	(isKeyEvent 
+	 or:[isButtonEvent 
+	 or:[isPointerEvent
+	 or:[(type == #focusIn)
+	 or:[(type == #focusOut)]]]]) ifTrue:[
 	    eventReceiver := controller.
 	]
     ].
 
     "
      if there is a focusView, and its a keyboard event, pass it
-     to that view (or its controller). In this case, some coordinate which is outside of
-     the focusView is passed as x/y coordinates.
+     to that view (or its controller). 
+     In this case, a coordinate which is outside of
+     the focusView (-1 @ -1) is passed as x/y coordinates.
+     Q: should we follow its delegate again ?
     "
-    focusView notNil ifTrue:[
-	(#(#'keyPress:x:y:'
-	   #'keyRelease:x:y:'
-	)includes:selector) ifTrue:[
-	    eventReceiver := focusView.
-	    (controller := focusView controller) notNil ifTrue:[  
-		eventReceiver := controller.
-	    ].
-	    eventReceiver perform:selector 
-		    withArguments:(Array with:(arguments at:1)
-					 with:-1
-					 with:-1).
-	    ^ self
-	]
+    (focusView notNil 
+    and:[isKeyEvent]) ifTrue:[
+	eventReceiver := focusView.
+	(controller := focusView controller) notNil ifTrue:[  
+	    eventReceiver := controller.
+	].
+	eventReceiver perform:type 
+		withArguments:(Array with:(argArray at:1)
+				     with:-1
+				     with:-1).
+	^ self
     ].
 
     "
-     another one:
+     finally, another one:
      if the view has a transformation, edit the selector
      from #foo to #deviceFoo...
      This allows the view to handle the event either in device or
@@ -285,25 +325,35 @@
      (event sending is no high frequency operation), but that just adds 
      another context to any debuggers walkback, making things less clear.
     "
+    selector := type.
+
     view transformation notNil ifTrue:[
-	(#(
-	  #'buttonPress:x:y:'
-	  #'buttonRelease:x:y:'
-	  #'buttonShiftPress:x:y:'
-	  #'buttonMultiPress:x:y:'
-	  #'buttonMotion:x:y:'
-	  #'keyPress:x:y:'
-	  #'keyRelease:x:y:'
-	  #'exposeX:y:width:height:'
-	  #'graphicExposeX:y:width:height:'
-	  #'pointerEnter:x:y:'
-	) includes:selector) ifTrue:[
-	    selector := selector asString.
-	    selector at:1 put:(selector at:1) asUppercase.
-	    selector := ('device' , selector) asSymbol
+	(isKeyEvent
+	 or:[isButtonEvent
+	 or:[(type == #'pointerEnter:x:y:')
+	 or:[(type == #'exposeX:y:width:height:')
+	 or:[(type == #'graphicExposeX:y:width:height:')]]]]) ifTrue:[
+	    selector := deviceMessage
 	]        
     ].
-    eventReceiver perform:selector withArguments:arguments
+    eventReceiver perform:selector withArguments:argArray
+! !
+
+!WindowEvent methodsFor:'sending'!
+
+sendEvent
+    "forward the event represented by the receiver to the delegate,
+     the controller or the view."
+
+    self sendEventWithFocusOn:nil
+!
+
+sendEventWithFocusOn:focusView
+    "forward the event represented by the receiver to the delegate,
+     the controller or the view. If focusView is nonNil, and its a keyboard
+     event, the event is forwarded to it."
+
+    self class sendEvent:type arguments:arguments view:view withFocusOn:focusView
 ! !
 
 !WindowEvent methodsFor:'private accessing'!
--- a/WSensor.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/WSensor.st	Tue Mar 07 22:57:31 1995 +0100
@@ -25,7 +25,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.18 1995-02-28 21:51:15 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.19 1995-03-07 21:57:01 claus Exp $
 '!
 
 !WindowSensor class methodsFor:'documentation'!
@@ -46,7 +46,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.18 1995-02-28 21:51:15 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/WSensor.st,v 1.19 1995-03-07 21:57:01 claus Exp $
 "
 !
 
@@ -453,7 +453,7 @@
 
 notifyEventArrival
     "an event arrived - if there is an eventSemaphore,
-     signal it, to wake up any controller process"
+     signal it, to wake up any windowGroup process"
 
     catchExpose == true ifTrue:[
 	"
@@ -485,6 +485,8 @@
 !
 
 graphicExposeX:left y:top width:width height:height view:aView
+    "a graphic expose event arrived - this is sent from the device (Display)"
+
     self addDamage:(left @ top extent:width @ height) view:aView.
 !
 
@@ -588,6 +590,7 @@
     ] ifFalse:[
 	xlatedKey := key.
     ].
+    xlatedKey isNil ifTrue:[^ self].
 
     (xlatedKey == #CtrlV) ifTrue:[
 	'Smalltalk/X ' errorPrint. 
@@ -638,6 +641,8 @@
     ] ifFalse:[
 	xlatedKey := key.
     ].
+    xlatedKey isNil ifTrue:[^ self].
+
     mouseAndKeyboard
 	addLast:(WindowEvent
 		     for:aView
@@ -669,6 +674,8 @@
 !
 
 configureX:x y:y width:w height:h view:aView
+    "a views size or position has changed - this is sent from the device (Display)"
+
     damage
 	addLast:(WindowEvent
 		     for:aView
@@ -678,7 +685,7 @@
 !
 
 coveredBy:sibling view:aView
-    "aView was covered by one of its siblings"
+    "aView was covered by one of its siblings - this is sent from the device (Display)"
 
     damage
 	 addLast:(WindowEvent
@@ -709,7 +716,7 @@
 !
 
 mappedView:aView
-    "view was mapped (from window manager)"
+    "view was mapped (from window manager) - this is sent from the device (Display)"
 
     damage
 	 addLast:(WindowEvent
@@ -719,7 +726,7 @@
 !
 
 unmappedView:aView
-    "view was unmapped (from window manager)"
+    "view was unmapped (from window manager) - this is sent from the device (Display)"
 
     damage
 	 addLast:(WindowEvent
@@ -729,7 +736,7 @@
 !
 
 terminateView:aView
-    "view should terminate (from window manager)"
+    "view should terminate (from window manager) - this is sent from the device (Display)"
 
     self flushEventsFor:aView.
     damage
@@ -740,7 +747,7 @@
 !
 
 saveAndTerminateView:aView
-    "view should save & terminate (from window manager)"
+    "view should save & terminate (from window manager) - this is sent from the device (Display)"
 
     self flushEventsFor:aView.
     damage
@@ -751,7 +758,7 @@
 !
 
 destroyedView:aView
-    "view was destroyed (from window manager)"
+    "view was destroyed (from window manager) - this is sent from the device (Display)"
 
     "at this time, the view is already gone; remove
      all pending events for this one ..."
@@ -773,13 +780,15 @@
     mouseAndKeyboard := OrderedCollection new.
     gotExpose := true.
     catchExpose := false.
+
     compressMotionEvents := true.
     ignoreUserInput := false.
     translateKeyboardEvents := true
 !
 
 reinitialize
-    "reinitialize the event queues to empty; leave other setup as-is"
+    "called when an image is restarted;
+     reinitialize the event queues to empty; leave other setup as-is"
 
     self flushUserEvents.
     self flushExposeEvents.
@@ -790,10 +799,14 @@
 !WindowSensor methodsFor:'accessing'!
 
 ignoreUserInput:aBoolean
+    "turn on/off ignoring of Ctrl-C processing"
+
     ignoreUserInput := aBoolean
 !
 
 ignoreUserInput
+    "return true, if Ctrl-C processing is currently turned off"
+
     ^ ignoreUserInput
 !
 
@@ -810,5 +823,7 @@
 !
 
 compressMotionEvents:aBoolean
+    "turn on/off motion event compression"
+
     compressMotionEvents := aBoolean
 ! !
--- a/WindowEvent.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/WindowEvent.st	Tue Mar 07 22:57:31 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.11 1995-02-06 00:38:02 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.12 1995-03-07 21:56:53 claus Exp $
 '!
 
 !WindowEvent class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.11 1995-02-06 00:38:02 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.12 1995-03-07 21:56:53 claus Exp $
 "
 !
 
@@ -157,78 +157,127 @@
     ^ nil
 ! !
 
-!WindowEvent methodsFor:'sending'!
+!WindowEvent class methodsFor:'forwarding events'!
+
+sendEvent:type arguments:arguments view:view
+    "forward the event represented by type and arguments to the views delegate,
+     the views controller or the view. 
 
-sendEvent
-    "forward the event represented by the receiver to the delegate,
-     the controller or the view. Only messages which are understood by
-     the delegate are forwarded.
-     Delegated messages get the original view as an extra argument."
+     If there is a delegate, only messages which are understood by it are 
+     forwarded. Also, the delegate is asked if it is willing to handle the event
+     before.
+     Delegated messages get the original view as an extra argument.
+     Delegation has higher priority than controller forwarding."
 
-    self sendEventWithFocusOn:nil
+    self sendEvent:type arguments:arguments view:view withFocusOn:nil 
 !
 
-sendEventWithFocusOn:focusView
-    "forward the event represented by the receiver to the delegate,
-     the controller or the view. If focusView is nonNil, and its a keyboard
-     event, the event is forwarded to it (but not if there is a delegate).
+sendEvent:type arguments:argArray view:view withFocusOn:focusView
+    "forward the event represented by type and arguments to the views delegate,
+     the views controller or the view. 
+     If focusView is nonNil, and it is a keyboard event, it is forwarded to this
+     view (but not if there was a delegate in the first place).
+
      If there is a delegate, only messages which are understood by it are 
-     forwarded. Delegated messages get the original view as an extra argument.
+     forwarded. Also, the delegate is asked if it is willing to handle the event
+     before.
+     Delegated messages get the original view as an extra argument.
      Delegation has higher priority than both controller or focusView 
      forwarding."
 
-    |delegate selector eventReceiver controller|
+    |delegate selector delegateMessage delegateQuery 
+     eventReceiver controller deviceMessage
+     isKeyEvent isButtonEvent isPointerEvent trans|
+
+    isKeyEvent := isButtonEvent := isPointerEvent := false.
 
-    selector := type.
+    (type == #'keyPress:x:y:') ifTrue:[
+	isKeyEvent := true.
+	deviceMessage := #'deviceKeyPress:x:y:'.
+	delegateMessage := #'keyPress:x:y:view:'.
+	delegateQuery := #'handlesKeyPress:inView:'.
+    ] ifFalse:[ (type == #'keyRelease:x:y:') ifTrue:[
+	isKeyEvent := true.
+	deviceMessage := #'deviceKeyRelease:x:y:'.
+	delegateMessage := #'keyRelease:x:y:view:'.
+	delegateQuery := #'handlesKeyRelease:inView:'.
+    ] ifFalse:[ (type == #'buttonPress:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonPress:x:y:'.
+	delegateMessage := #'buttonPress:x:y:view:'.
+	delegateQuery := #'handlesButtonPress:inView:'.
+    ] ifFalse:[ (type == #'buttonRelease:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonRelease:x:y:'.
+	delegateMessage := #'buttonRelease:x:y:view:'.
+	delegateQuery := #'handlesButtonRelease:inView:'.
+    ] ifFalse:[ (type == #'buttonShiftPress:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonShiftPress:x:y:'.
+	delegateMessage := #'buttonShiftPress:x:y:view:'.
+	delegateQuery := #'handlesButtonShiftPress:inView:'.
+    ] ifFalse:[ (type == #'buttonMultiPress:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonMultiPress:x:y:'.
+	delegateMessage := #'buttonMultiPress:x:y:view:'.
+	delegateQuery := #'handlesButtonMultiPress:inView:'.
+    ] ifFalse:[ (type == #'buttonMotion:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonMotion:x:y:'.
+	delegateMessage := #'buttonMotion:x:y:view:'.
+	delegateQuery := #'handlesButtonMotion:inView:'.
+    ] ifFalse:[ (type == #'pointerEnter:x:y:') ifTrue:[
+	isPointerEvent := true.
+	deviceMessage := #'devicePointerEnter:x:y:'.
+	delegateMessage := #'pointerEnter:x:y:view:'.
+	delegateQuery := #'handlesPointerEnter:inView:'.
+    ] ifFalse:[ (type == #'pointerLeave:') ifTrue:[
+	isPointerEvent := true.
+	delegateMessage := #'pointerLeave:view:'.
+	delegateQuery := #'handlesPointerLeave:inView:'.
+    ] ifFalse:[ (type == #'exposeX:y:width:height:') ifTrue:[
+	deviceMessage := #'deviceExposeX:y:width:height:'.
+    ] ifFalse:[ (type == #'graphicExposeX:y:width:height:') ifTrue:[
+	deviceMessage := #'deviceGraphicExposeX:y:width:height:'.
+    ]]]]]]]]]]].
 
-    delegate := view delegate.
-    delegate notNil ifTrue:[
+    "
+     handle delegated messages
+    "
+    (isKeyEvent 
+     or:[isButtonEvent 
+     or:[isPointerEvent]]) ifTrue:[
+	delegate := view delegate.
+
 	"
-	 what a kludge - sending to delegate needs another
-	 selector and an additional argument.
-	 have to edit the selector ...
+	 what a kludge - sending to delegate requires
+	 another selector and an additional argument ...
 	"
-	(selector endsWith:':') ifTrue:[
-	    selector := (selector , 'view:') asSymbol.
-	] ifFalse:[
-	    selector := (selector , 'View:') asSymbol.
-	].
-	(delegate respondsTo:selector) ifTrue:[
+	(delegate respondsTo:delegateMessage) ifTrue:[
 	    "
-	     mhmh have to convert to logical coordinates ...
-	    "        
-	    view transformation notNil ifTrue:[
-		(#(
-		  #'buttonPress:x:y:'
-		  #'buttonRelease:x:y:'
-		  #'buttonShiftPress:x:y:'
-		  #'buttonMultiPress:x:y:'
-		  #'buttonMotion:x:y:'
-		  #'keyPress:x:y:'
-		  #'keyRelease:x:y:'
-		  #'pointerEnter:x:y:'
-		  #'exposeX:y:width:height:'
-		  #'graphicExposeX:y:width:height:'
-		)includes:type) ifTrue:[
-		    arguments at:2 put:(view transformation applyInverseToX:(arguments at:2)).
-		    arguments at:3 put:(view transformation applyInverseToY:(arguments at:3)).
-		    (#(
-		      #'exposeX:y:width:height:'
-		      #'graphicExposeX:y:width:height:'
-		    )includes:type) ifTrue:[
-			arguments at:4 put:(view transformation applyInverseScaleX:(arguments at:4)).
-			arguments at:5 put:(view transformation applyInverseScaleY:(arguments at:5)).
+	     is the delegate interrested in that event ?
+	     (if it does not respond to the handlesXXX message,
+	      we assume: yes)
+	    "
+	    ((delegate respondsTo:delegateQuery) not
+	    or:[delegate perform:delegateQuery with:view]) ifTrue:[
+		"
+		 mhmh ... have to convert to logical coordinates
+		"        
+		(trans := view transformation) notNil ifTrue:[
+		    argArray size > 2 ifTrue:[
+			argArray at:2 put:(trans applyInverseToX:(argArray at:2)).
+			argArray at:3 put:(trans applyInverseToY:(argArray at:3)).
 		    ].
 		].
-	    ].
-	    arguments isNil ifTrue:[
-		delegate perform:selector with:view
-	    ] ifFalse:[
-		delegate perform:selector withArguments:(arguments copyWith:view)
-	    ].
-	    ^ self
+		argArray isNil ifTrue:[
+		    delegate perform:delegateMessage with:view
+		] ifFalse:[
+		    delegate perform:delegateMessage withArguments:(argArray copyWith:view)
+		].
+		^ self
+	    ]
 	].
-	selector := type.
     ].
 
     "
@@ -236,46 +285,37 @@
     "
     eventReceiver := view.
     (controller := view controller) notNil ifTrue:[  
-	(#(
-	  #'buttonPress:x:y:'
-	  #'buttonRelease:x:y:'
-	  #'buttonShiftPress:x:y:'
-	  #'buttonMultiPress:x:y:'
-	  #'buttonMotion:x:y:'
-	  #'keyPress:x:y:'
-	  #'keyRelease:x:y:'
-	  #'focusIn'
-	  #'focusOut'
-	  #'pointerEnter:x:y:'
-	  #'pointerLeave:'
-	) includes:selector) ifTrue:[
+	(isKeyEvent 
+	 or:[isButtonEvent 
+	 or:[isPointerEvent
+	 or:[(type == #focusIn)
+	 or:[(type == #focusOut)]]]]) ifTrue:[
 	    eventReceiver := controller.
 	]
     ].
 
     "
      if there is a focusView, and its a keyboard event, pass it
-     to that view (or its controller). In this case, some coordinate which is outside of
-     the focusView is passed as x/y coordinates.
+     to that view (or its controller). 
+     In this case, a coordinate which is outside of
+     the focusView (-1 @ -1) is passed as x/y coordinates.
+     Q: should we follow its delegate again ?
     "
-    focusView notNil ifTrue:[
-	(#(#'keyPress:x:y:'
-	   #'keyRelease:x:y:'
-	)includes:selector) ifTrue:[
-	    eventReceiver := focusView.
-	    (controller := focusView controller) notNil ifTrue:[  
-		eventReceiver := controller.
-	    ].
-	    eventReceiver perform:selector 
-		    withArguments:(Array with:(arguments at:1)
-					 with:-1
-					 with:-1).
-	    ^ self
-	]
+    (focusView notNil 
+    and:[isKeyEvent]) ifTrue:[
+	eventReceiver := focusView.
+	(controller := focusView controller) notNil ifTrue:[  
+	    eventReceiver := controller.
+	].
+	eventReceiver perform:type 
+		withArguments:(Array with:(argArray at:1)
+				     with:-1
+				     with:-1).
+	^ self
     ].
 
     "
-     another one:
+     finally, another one:
      if the view has a transformation, edit the selector
      from #foo to #deviceFoo...
      This allows the view to handle the event either in device or
@@ -285,25 +325,35 @@
      (event sending is no high frequency operation), but that just adds 
      another context to any debuggers walkback, making things less clear.
     "
+    selector := type.
+
     view transformation notNil ifTrue:[
-	(#(
-	  #'buttonPress:x:y:'
-	  #'buttonRelease:x:y:'
-	  #'buttonShiftPress:x:y:'
-	  #'buttonMultiPress:x:y:'
-	  #'buttonMotion:x:y:'
-	  #'keyPress:x:y:'
-	  #'keyRelease:x:y:'
-	  #'exposeX:y:width:height:'
-	  #'graphicExposeX:y:width:height:'
-	  #'pointerEnter:x:y:'
-	) includes:selector) ifTrue:[
-	    selector := selector asString.
-	    selector at:1 put:(selector at:1) asUppercase.
-	    selector := ('device' , selector) asSymbol
+	(isKeyEvent
+	 or:[isButtonEvent
+	 or:[(type == #'pointerEnter:x:y:')
+	 or:[(type == #'exposeX:y:width:height:')
+	 or:[(type == #'graphicExposeX:y:width:height:')]]]]) ifTrue:[
+	    selector := deviceMessage
 	]        
     ].
-    eventReceiver perform:selector withArguments:arguments
+    eventReceiver perform:selector withArguments:argArray
+! !
+
+!WindowEvent methodsFor:'sending'!
+
+sendEvent
+    "forward the event represented by the receiver to the delegate,
+     the controller or the view."
+
+    self sendEventWithFocusOn:nil
+!
+
+sendEventWithFocusOn:focusView
+    "forward the event represented by the receiver to the delegate,
+     the controller or the view. If focusView is nonNil, and its a keyboard
+     event, the event is forwarded to it."
+
+    self class sendEvent:type arguments:arguments view:view withFocusOn:focusView
 ! !
 
 !WindowEvent methodsFor:'private accessing'!
--- a/WindowSensor.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/WindowSensor.st	Tue Mar 07 22:57:31 1995 +0100
@@ -25,7 +25,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.18 1995-02-28 21:51:15 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.19 1995-03-07 21:57:01 claus Exp $
 '!
 
 !WindowSensor class methodsFor:'documentation'!
@@ -46,7 +46,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.18 1995-02-28 21:51:15 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.19 1995-03-07 21:57:01 claus Exp $
 "
 !
 
@@ -453,7 +453,7 @@
 
 notifyEventArrival
     "an event arrived - if there is an eventSemaphore,
-     signal it, to wake up any controller process"
+     signal it, to wake up any windowGroup process"
 
     catchExpose == true ifTrue:[
 	"
@@ -485,6 +485,8 @@
 !
 
 graphicExposeX:left y:top width:width height:height view:aView
+    "a graphic expose event arrived - this is sent from the device (Display)"
+
     self addDamage:(left @ top extent:width @ height) view:aView.
 !
 
@@ -588,6 +590,7 @@
     ] ifFalse:[
 	xlatedKey := key.
     ].
+    xlatedKey isNil ifTrue:[^ self].
 
     (xlatedKey == #CtrlV) ifTrue:[
 	'Smalltalk/X ' errorPrint. 
@@ -638,6 +641,8 @@
     ] ifFalse:[
 	xlatedKey := key.
     ].
+    xlatedKey isNil ifTrue:[^ self].
+
     mouseAndKeyboard
 	addLast:(WindowEvent
 		     for:aView
@@ -669,6 +674,8 @@
 !
 
 configureX:x y:y width:w height:h view:aView
+    "a views size or position has changed - this is sent from the device (Display)"
+
     damage
 	addLast:(WindowEvent
 		     for:aView
@@ -678,7 +685,7 @@
 !
 
 coveredBy:sibling view:aView
-    "aView was covered by one of its siblings"
+    "aView was covered by one of its siblings - this is sent from the device (Display)"
 
     damage
 	 addLast:(WindowEvent
@@ -709,7 +716,7 @@
 !
 
 mappedView:aView
-    "view was mapped (from window manager)"
+    "view was mapped (from window manager) - this is sent from the device (Display)"
 
     damage
 	 addLast:(WindowEvent
@@ -719,7 +726,7 @@
 !
 
 unmappedView:aView
-    "view was unmapped (from window manager)"
+    "view was unmapped (from window manager) - this is sent from the device (Display)"
 
     damage
 	 addLast:(WindowEvent
@@ -729,7 +736,7 @@
 !
 
 terminateView:aView
-    "view should terminate (from window manager)"
+    "view should terminate (from window manager) - this is sent from the device (Display)"
 
     self flushEventsFor:aView.
     damage
@@ -740,7 +747,7 @@
 !
 
 saveAndTerminateView:aView
-    "view should save & terminate (from window manager)"
+    "view should save & terminate (from window manager) - this is sent from the device (Display)"
 
     self flushEventsFor:aView.
     damage
@@ -751,7 +758,7 @@
 !
 
 destroyedView:aView
-    "view was destroyed (from window manager)"
+    "view was destroyed (from window manager) - this is sent from the device (Display)"
 
     "at this time, the view is already gone; remove
      all pending events for this one ..."
@@ -773,13 +780,15 @@
     mouseAndKeyboard := OrderedCollection new.
     gotExpose := true.
     catchExpose := false.
+
     compressMotionEvents := true.
     ignoreUserInput := false.
     translateKeyboardEvents := true
 !
 
 reinitialize
-    "reinitialize the event queues to empty; leave other setup as-is"
+    "called when an image is restarted;
+     reinitialize the event queues to empty; leave other setup as-is"
 
     self flushUserEvents.
     self flushExposeEvents.
@@ -790,10 +799,14 @@
 !WindowSensor methodsFor:'accessing'!
 
 ignoreUserInput:aBoolean
+    "turn on/off ignoring of Ctrl-C processing"
+
     ignoreUserInput := aBoolean
 !
 
 ignoreUserInput
+    "return true, if Ctrl-C processing is currently turned off"
+
     ^ ignoreUserInput
 !
 
@@ -810,5 +823,7 @@
 !
 
 compressMotionEvents:aBoolean
+    "turn on/off motion event compression"
+
     compressMotionEvents := aBoolean
 ! !
--- a/XWorkstat.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/XWorkstat.st	Tue Mar 07 22:57:31 1995 +0100
@@ -30,7 +30,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.34 1995-02-27 10:20:20 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.35 1995-03-07 21:57:31 claus Exp $
 '!
 
 !XWorkstation class methodsFor:'documentation'!
@@ -51,7 +51,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.34 1995-02-27 10:20:20 claus Exp $
+$Header: /cvs/stx/stx/libview/Attic/XWorkstat.st,v 1.35 1995-03-07 21:57:31 claus Exp $
 "
 !
 
@@ -876,8 +876,8 @@
 
 %{  /* NOCONTEXT */
     RETURN (_MKSMALLINT( ExposureMask | StructureNotifyMask |
-		         KeyPressMask |
-		         ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
+			 KeyPressMask |
+			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
 %}
 !
 
@@ -5303,9 +5303,7 @@
 !
 
 dispatchLastEvent
-    |theView controller sensor delegate 
-     keyButtonReceiver exposeReceiver
-     sym symS symC arg butt sibling|
+    |theView symS arg butt sibling|
 
 %{  /* STACK: 8000 */
 #   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
@@ -5329,29 +5327,9 @@
     char keySymStringBuffer[32];
     static unsigned multiClickTime = 0;
     unsigned nextMultiClickTime;
-    OBJ userEventReceiver;
-
-    struct inlineCache *ip, *ipS;
+
+    struct inlineCache *ipS;
     static struct inlineCache vid = _ILC1;
-    static struct inlineCache exp = _ILC4;
-    static struct inlineCache gexp = _ILC4;
-    static struct inlineCache nexp = _ILC0;
-    static struct inlineCache conf = _ILC4;
-    static struct inlineCache covered = _ILC1;
-    static struct inlineCache unmap = _ILC0;
-    static struct inlineCache map = _ILC0;
-    static struct inlineCache mot = _ILC3;
-    static struct inlineCache bp = _ILC3;
-    static struct inlineCache bmp = _ILC3;
-    static struct inlineCache bsp = _ILC3;
-    static struct inlineCache br = _ILC3;
-    static struct inlineCache focIn = _ILC0;
-    static struct inlineCache focOut = _ILC0;
-    static struct inlineCache pe = _ILC3;
-    static struct inlineCache pl = _ILC1;
-    static struct inlineCache term = _ILC0;
-    static struct inlineCache savterm = _ILC0;
-    static struct inlineCache destr = _ILC0;
 
     static struct inlineCache expS = _ILC5;
     static struct inlineCache gexpS = _ILC5;
@@ -5386,12 +5364,7 @@
     static struct inlineCache colormap = _ILC0;
     static struct inlineCache vis = _ILC1;
 
-    static struct inlineCache contr = _ILC0;
-    static struct inlineCache sens = _ILC0;
-    static struct inlineCache deleg = _ILC0;
-    static struct inlineCache skp = _ILC4;
     static struct inlineCache skpS = _ILC4;
-    static struct inlineCache skr = _ILC4;
     static struct inlineCache skrS = _ILC4;
 
     theView = (*vid.ilc_func)(self, @symbol(viewFromId:) COMMA_CON, nil, &vid, 
@@ -5410,42 +5383,19 @@
      * or (if there is none) to the view
      *
      * sensor and delegate get view as additional argument
+     * all of this has been taken out of here to corresponding methods
+     * in DeviceWorkstation.
      */
 
-    sensor = (*sens.ilc_func)(theView, @symbol(sensor) COMMA_CON, nil, &sens);
-
-    userEventReceiver = theView;
-    if (sensor != nil) {
-	keyButtonReceiver = sensor;
-	exposeReceiver = sensor;
-    } else {
-	delegate = (*deleg.ilc_func)(theView, @symbol(delegate) COMMA_CON, nil, &deleg);
-	if (delegate != nil) {
-	    keyButtonReceiver = delegate;
-	} else {
-	    controller = (*contr.ilc_func)(theView, @symbol(controller) COMMA_CON, nil, &contr);
-	    if (controller != nil)
-		userEventReceiver = controller;
-	}
-    }
-
-    /*
-     * now, receiver is in variables keyButtonReceiver, exposeReceiver (to send with view)
-     * or theView if not.
-     */
     switch (__ev__.type) {
 	case KeyRelease:
-	    sym = @symbol(keyRelease:x:y:view:);
-	    symS = @symbol(sendKeyRelease:x:y:to:);
-	    ip = &skr;
+	    symS = @symbol(keyRelease:x:y:view:);
 	    ipS = &skrS;
 	    goto keyPressAndRelease;
 	    break;
 
 	case KeyPress:
-	    sym = @symbol(keyPress:x:y:view:);
-	    symS = @symbol(sendKeyPress:x:y:to:);
-	    ip = &skp;
+	    symS = @symbol(keyPress:x:y:view:);
 	    ipS = &skpS;
 
 	keyPressAndRelease:
@@ -5497,20 +5447,11 @@
 		break;
 	    }
 
-	    if (keyButtonReceiver != nil) {
-		(*(*ipS).ilc_func)(keyButtonReceiver, sym COMMA_CON, nil, ipS,
-				 arg, 
-				 _MKSMALLINT(ke->x), 
-				 _MKSMALLINT(ke->y),
-				 theView);
-		break;
-	    }
-
-	    (*(*ip).ilc_func)(self, symS COMMA_CON, nil, ip,
-			    arg, 
-			    _MKSMALLINT(ke->x), 
-			    _MKSMALLINT(ke->y),
-			    theView);
+	    (*(*ipS).ilc_func)(self, symS COMMA_CON, nil, ipS,
+			       arg, 
+			       _MKSMALLINT(ke->x), 
+			       _MKSMALLINT(ke->y),
+			       theView);
 	    break;
 
 	case ButtonPress:
@@ -5526,9 +5467,7 @@
 	    if (multiClickTime) {
 		if (be->time < multiClickTime) {
 		    multiClickTime = nextMultiClickTime;
-		    ip = &bmp;
 		    ipS = &bmpS;
-		    sym = @symbol(buttonMultiPress:x:y:);
 		    symS = @symbol(buttonMultiPress:x:y:view:);
 		    goto sendButtonEvent;
 		    break;
@@ -5536,15 +5475,11 @@
 	    }
 	    multiClickTime = nextMultiClickTime;
 	    if (be->state & ShiftMask) {
-		ip = &bsp;
 		ipS = &bspS;
-		sym = @symbol(buttonShiftPress:x:y:);
 		symS = @symbol(buttonShiftPress:x:y:view:);
 		goto sendButtonEvent;
 	    }
-	    ip = &bp;
 	    ipS = &bpS;
-	    sym = @symbol(buttonPress:x:y:);
 	    symS = @symbol(buttonPress:x:y:view:);
 	    goto sendButtonEvent;
             
@@ -5554,9 +5489,7 @@
 	    _INST(buttonsPressed) = _MKSMALLINT(_intVal(_INST(buttonsPressed)) & ~(1 << be->button));
 	    _INST(eventRootX) = _MKSMALLINT(be->x_root);
 	    _INST(eventRootY) = _MKSMALLINT(be->y_root);
-	    ip = &br;
 	    ipS = &brS;
-	    sym = @symbol(buttonRelease:x:y:);
 	    symS = @symbol(buttonRelease:x:y:view:);
 	    /* fall into */
 
@@ -5573,23 +5506,13 @@
 		butt = _AT_(_INST(buttonTranslation), butt);
             
 
-	    if (keyButtonReceiver != nil) {
-		(*(*ipS).ilc_func)(keyButtonReceiver, 
-				   symS
-				   COMMA_CON, nil, ipS,
-				   butt, 
-				   _MKSMALLINT(ke->x), 
-				   _MKSMALLINT(ke->y),
-				   theView);
-		break;
-	    }
-
-	    (*(*ip).ilc_func)(userEventReceiver, 
-			      sym 
-			      COMMA_CON, nil, ip,
-			      butt,
-			      _MKSMALLINT(be->x), 
-			      _MKSMALLINT(be->y));
+	    (*(*ipS).ilc_func)(self, 
+			       symS
+			       COMMA_CON, nil, ipS,
+			       butt, 
+			       _MKSMALLINT(ke->x), 
+			       _MKSMALLINT(ke->y),
+			       theView);
 	    break;
 
 	case MotionNotify:
@@ -5600,149 +5523,78 @@
 	    _INST(eventRootX) = _MKSMALLINT(me->x_root);
 	    _INST(eventRootY) = _MKSMALLINT(me->y_root);
 
-	    if (keyButtonReceiver != nil) {
-		(*motS.ilc_func)(keyButtonReceiver, 
-				 @symbol(buttonMotion:x:y:view:)
-				 COMMA_CON, nil, &motS,
-				 _MKSMALLINT(me->state),
-				 _MKSMALLINT(me->x),
-				 _MKSMALLINT(me->y),
-				 theView);
-		break;
-	    }
-	    (*mot.ilc_func)(userEventReceiver, 
-			    @symbol(buttonMotion:x:y:)
-			    COMMA_CON, nil, &mot,
-			    _MKSMALLINT(me->state),
-			    _MKSMALLINT(me->x),
-			    _MKSMALLINT(me->y));
+	    (*motS.ilc_func)(self, 
+			     @symbol(buttonMotion:x:y:view:)
+			     COMMA_CON, nil, &motS,
+			     _MKSMALLINT(me->state),
+			     _MKSMALLINT(me->x),
+			     _MKSMALLINT(me->y),
+			     theView);
 	    break;
 
 	case FocusIn:
-	    if (keyButtonReceiver != nil) {
-		(*focInS.ilc_func)(keyButtonReceiver, 
-				   @symbol(focusInView:)
-				   COMMA_CON, nil, &focInS, 
-				   theView);
-		break;
-                        
-	    }
-	    (*focIn.ilc_func)(userEventReceiver, 
-			      @symbol(focusIn)
-			      COMMA_CON, nil, &focIn);
+	    (*focInS.ilc_func)(self, 
+			       @symbol(focusInView:)
+			       COMMA_CON, nil, &focInS, 
+			       theView);
 	    break;
 
 	case FocusOut:
-	    if (keyButtonReceiver != nil) {
-		(*focOutS.ilc_func)(keyButtonReceiver, 
-				    @symbol(focusOutView:)
-				    COMMA_CON, nil, &focOutS, 
-				    theView);
-		break;
-	    }
-	    (*focOut.ilc_func)(userEventReceiver, 
-			       @symbol(focusOut)
-			       COMMA_CON, nil, &focOut);
+	    (*focOutS.ilc_func)(self, 
+				@symbol(focusOutView:)
+				COMMA_CON, nil, &focOutS, 
+				theView);
 	    break;
 
 	case EnterNotify:
-	    if (keyButtonReceiver != nil) {
-		(*peS.ilc_func)(keyButtonReceiver, 
-				@symbol(pointerEnter:x:y:view:)
-				COMMA_CON, nil, &peS,
-				_MKSMALLINT(ewe->state),
-				_MKSMALLINT(ewe->x), 
-				_MKSMALLINT(ewe->y),
-				theView);
-		break;
-	    }
-	    (*pe.ilc_func)(userEventReceiver, 
-			   @symbol(pointerEnter:x:y:)
-			   COMMA_CON, nil, &pe,
-			   _MKSMALLINT(ewe->state),
-			   _MKSMALLINT(ewe->x), 
-			   _MKSMALLINT(ewe->y));
+	    (*peS.ilc_func)(self, 
+			    @symbol(pointerEnter:x:y:view:)
+			    COMMA_CON, nil, &peS,
+			    _MKSMALLINT(ewe->state),
+			    _MKSMALLINT(ewe->x), 
+			    _MKSMALLINT(ewe->y),
+			    theView);
 	    break;
 
 	case LeaveNotify:
-	    if (keyButtonReceiver != nil) {
-		(*plS.ilc_func)(keyButtonReceiver, 
-				@symbol(pointerLeave:view:)
-				COMMA_CON, nil, &plS,
-				_MKSMALLINT(lwe->state), 
-				theView);
-		break;
-	    }
-	    (*pl.ilc_func)(userEventReceiver, 
-			   @symbol(pointerLeave:)
-			   COMMA_CON, nil, &pl,
-			   _MKSMALLINT(lwe->state));
+	    (*plS.ilc_func)(self, 
+			    @symbol(pointerLeave:view:)
+			    COMMA_CON, nil, &plS,
+			    _MKSMALLINT(lwe->state), 
+			    theView);
 	    break;
 
 	case GraphicsExpose:
-	    if (exposeReceiver != nil) {
-		(*gexpS.ilc_func)(exposeReceiver, 
-				  @symbol(graphicExposeX:y:width:height:view:)
-				  COMMA_CON, nil, &gexpS,
-				  _MKSMALLINT(ee->x),
-				  _MKSMALLINT(ee->y),
-				  _MKSMALLINT(ee->width),
-				  _MKSMALLINT(ee->height),
-				  theView);
-		if (ee->count == 0) {
-		    (*nexpS.ilc_func)(exposeReceiver, 
-				      @symbol(noExposeView:)
-				      COMMA_CON, nil, &nexpS, 
-				      theView);
-		}
+	    (*gexpS.ilc_func)(self, 
+			      @symbol(graphicExposeX:y:width:height:view:)
+			      COMMA_CON, nil, &gexpS,
+			      _MKSMALLINT(ee->x),
+			      _MKSMALLINT(ee->y),
+			      _MKSMALLINT(ee->width),
+			      _MKSMALLINT(ee->height),
+			      theView);
+
+	    if (ee->count != 0) {
 		break;
 	    }
-	    (*gexp.ilc_func)(theView, 
-			     @symbol(graphicExposeX:y:width:height:)
-			     COMMA_CON, nil, &gexp,
+	    /* fall into */
+
+	case NoExpose:
+	    (*nexpS.ilc_func)(self, 
+			      @symbol(noExposeView:)
+			      COMMA_CON, nil, &nexpS, 
+			      theView);
+	    break;
+
+	case Expose:
+	    (*expS.ilc_func)(self, 
+			     @symbol(exposeX:y:width:height:view:)
+			     COMMA_CON, nil, &expS,
 			     _MKSMALLINT(ee->x),
 			     _MKSMALLINT(ee->y),
 			     _MKSMALLINT(ee->width),
-			     _MKSMALLINT(ee->height));
-	    if (ee->count == 0) {
-		(*nexp.ilc_func)(theView, 
-				 @symbol(noExpose)
-				 COMMA_CON, nil, &nexp);
-	    }
-	    break;
-
-	case Expose:
-	    if (exposeReceiver != nil) {
-		(*expS.ilc_func)(exposeReceiver, 
-				 @symbol(exposeX:y:width:height:view:)
-				 COMMA_CON, nil, &expS,
-				 _MKSMALLINT(ee->x),
-				 _MKSMALLINT(ee->y),
-				 _MKSMALLINT(ee->width),
-				 _MKSMALLINT(ee->height),
-				 theView);
-		break;
-	    }
-	    (*exp.ilc_func)(theView, 
-			    @symbol(exposeX:y:width:height:)
-			    COMMA_CON, nil, &exp,
-			    _MKSMALLINT(ee->x),
-			    _MKSMALLINT(ee->y),
-			    _MKSMALLINT(ee->width),
-			    _MKSMALLINT(ee->height));
-	    break;
-
-	case NoExpose:
-	    if (exposeReceiver != nil) {
-		(*nexpS.ilc_func)(exposeReceiver, 
-				  @symbol(noExposeView:)
-				  COMMA_CON, nil, &nexpS, 
-				  theView);
-		break;
-	    }
-	    (*nexp.ilc_func)(theView, 
-			     @symbol(noExpose) 
-			     COMMA_CON, nil, &nexp);
+			     _MKSMALLINT(ee->height),
+			     theView);
 	    break;
 
 	case ConfigureNotify:
@@ -5752,36 +5604,20 @@
 					  MKOBJ(ce->above));
 	    }
 
-	    if (sensor != nil) {
-		(*confS.ilc_func)(sensor, 
-				 @symbol(configureX:y:width:height:view:)
-				 COMMA_CON, nil, &confS,
-				 _MKSMALLINT(ce->x),
-				 _MKSMALLINT(ce->y),
-				 _MKSMALLINT(ce->width),
-				 _MKSMALLINT(ce->height),
-				 theView);
-		if (sibling != nil) {
-		    (*coveredS.ilc_func)(sensor,
-					@symbol(coveredBy:view:)
-					COMMA_CON, nil, &coveredS,
-					theView,
-					sibling);
-		}
-		break;
-	    }
-	    (*conf.ilc_func)(theView, 
-			     @symbol(configureX:y:width:height:)
-			     COMMA_CON, nil, &conf,
+	    (*confS.ilc_func)(self, 
+			     @symbol(configureX:y:width:height:view:)
+			     COMMA_CON, nil, &confS,
 			     _MKSMALLINT(ce->x),
 			     _MKSMALLINT(ce->y),
 			     _MKSMALLINT(ce->width),
-			     _MKSMALLINT(ce->height));
+			     _MKSMALLINT(ce->height),
+			     theView);
 	    if (sibling != nil) {
-		(*covered.ilc_func)(sibling,
-				    @symbol(coveredBy:)
-				    COMMA_CON, nil, &covered,
-				    theView);
+		(*coveredS.ilc_func)(self,
+				    @symbol(coveredBy:view:)
+				    COMMA_CON, nil, &coveredS,
+				    theView,
+				    sibling);
 	    }
 	    break;
 
@@ -5789,63 +5625,40 @@
 	    if (__ev__.xclient.message_type == (int) _AtomVal(_INST(protocolsAtom))) {
 		if ((__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(quitAppAtom)))
 		 || (__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(deleteWindowAtom)))) {
-		    if (sensor != nil) {
-			(*termS.ilc_func)(sensor, 
-					 @symbol(terminateView:)
-					 COMMA_CON, nil, &termS, theView);
-			break;
-		    }
-		    (*term.ilc_func)(theView, 
-				     @symbol(terminate)
-				     COMMA_CON, nil, &term);
+		    (*termS.ilc_func)(self, 
+				      @symbol(terminateView:)
+				      COMMA_CON, nil, &termS, theView);
 		    break;
 		}
 		if (__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(saveYourselfAtom))) {
-		    if (sensor != nil) {
-			(*savtermS.ilc_func)(sensor, 
-					    @symbol(saveAndTerminateView:)
-					    COMMA_CON, nil, &savtermS, theView);
-			break;
-		    }
-		    (*savterm.ilc_func)(theView, 
-					@symbol(saveAndTerminate)
-					COMMA_CON, nil, &savterm);
+		    (*savtermS.ilc_func)(self, 
+					 @symbol(saveAndTerminateView:)
+					 COMMA_CON, nil, &savtermS, theView);
 		    break;
 		}
 	    }
 	    break;
 
 	case DestroyNotify:
-	    if (sensor != nil) {
-		(*destrS.ilc_func)(sensor, @symbol(destroyedView:)
-				   COMMA_CON, nil, &destrS, theView);
-		break;
-	    }
-	    (*destr.ilc_func)(theView, @symbol(destroyed) 
-			      COMMA_CON, nil, &destr);
+	    (*destrS.ilc_func)(self, @symbol(destroyedView:)
+			       COMMA_CON, nil, &destrS, theView);
 	    break;
 
 	case UnmapNotify:
-	    if (sensor != nil) {
-		(*unmapS.ilc_func)(sensor, @symbol(unmappedView:) 
-				   COMMA_CON, nil, &unmapS, theView);
-		break;
-	    }
-	    (*unmap.ilc_func)(theView, @symbol(unmapped) 
-			      COMMA_CON, nil, &unmap);
+	    (*unmapS.ilc_func)(self, @symbol(unmappedView:) 
+			       COMMA_CON, nil, &unmapS, theView);
 	    break;
 
 	case MapNotify:
-	    if (sensor != nil) {
-		(*mapS.ilc_func)(sensor, @symbol(mappedView:) 
-				 COMMA_CON, nil, &mapS, theView);
-		break;
-	    }
-	    (*map.ilc_func)(theView, @symbol(mapped) COMMA_CON, nil, &map);
+	    (*mapS.ilc_func)(self, 
+			     @symbol(mappedView:) 
+			     COMMA_CON, nil, &mapS, theView);
 	    break;
 
 	case KeymapNotify:
-	    (*keymap.ilc_func)(theView, @symbol(keyMapChange) COMMA_CON, nil, &keymap);
+	    (*keymap.ilc_func)(theView, 
+			       @symbol(keyMapChange) 
+			       COMMA_CON, nil, &keymap);
 	    break;
 
 	case VisibilityNotify:
@@ -5889,11 +5702,15 @@
 	    break;
 
 	case PropertyNotify:
-	    (*prop.ilc_func)(theView, @symbol(propertyChange) COMMA_CON, nil, &prop);
+	    (*prop.ilc_func)(theView, 
+			     @symbol(propertyChange) 
+			     COMMA_CON, nil, &prop);
 	    break;
 
 	case SelectionClear:
-	    (*selClear.ilc_func)(theView, @symbol(selectionClear) COMMA_CON, nil, &selClear);
+	    (*selClear.ilc_func)(theView, 
+				 @symbol(selectionClear) 
+				 COMMA_CON, nil, &selClear);
 	    break;
 
 	case SelectionNotify:
@@ -5904,7 +5721,9 @@
 	    printf("SelectionNotify prop=%x requestor=%x\n", __ev__.xselection.property,
 							      __ev__.xselection.requestor);
 */
-	    (*selNotify.ilc_func)(theView, @symbol(selectionNotify:target:selection:from:) COMMA_CON, nil, &selNotify,
+	    (*selNotify.ilc_func)(theView, 
+				  @symbol(selectionNotify:target:selection:from:) 
+				  COMMA_CON, nil, &selNotify,
 				  MKOBJ(__ev__.xselection.property),
 				  MKOBJ(__ev__.xselection.target),
 				  MKOBJ(__ev__.xselection.selection),
@@ -5919,7 +5738,9 @@
 							      __ev__.xselectionrequest.target,
 							      __ev__.xselectionrequest.selection);
 */
-	    (*selReq.ilc_func)(theView, @symbol(selectionRequest:target:selection:from:) COMMA_CON, nil, &selReq,
+	    (*selReq.ilc_func)(theView, 
+			       @symbol(selectionRequest:target:selection:from:) 
+			       COMMA_CON, nil, &selReq,
 			       MKOBJ(__ev__.xselectionrequest.property),
 			       MKOBJ(__ev__.xselectionrequest.target),
 			       MKOBJ(__ev__.xselectionrequest.selection),
@@ -5927,7 +5748,9 @@
 	    break;
 
 	case ColormapNotify:
-	    (*colormap.ilc_func)(theView, @symbol(colorMapChange) COMMA_CON, nil, &colormap);
+	    (*colormap.ilc_func)(theView, 
+				 @symbol(colorMapChange) 
+				 COMMA_CON, nil, &colormap);
 	    break;
 
 	case MappingNotify:
@@ -5935,7 +5758,9 @@
 printf("mapping\n");
 */
 /*
-	    (*mapping.ilc_func)(theView, @symbol(mapping) COMMA_CON, nil, &mapping);
+	    (*mapping.ilc_func)(theView, 
+				@symbol(mapping) 
+				COMMA_CON, nil, &mapping);
 */
 	    break;
     }
--- a/XWorkstation.st	Mon Mar 06 22:02:16 1995 +0100
+++ b/XWorkstation.st	Tue Mar 07 22:57:31 1995 +0100
@@ -30,7 +30,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.34 1995-02-27 10:20:20 claus Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.35 1995-03-07 21:57:31 claus Exp $
 '!
 
 !XWorkstation class methodsFor:'documentation'!
@@ -51,7 +51,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.34 1995-02-27 10:20:20 claus Exp $
+$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.35 1995-03-07 21:57:31 claus Exp $
 "
 !
 
@@ -876,8 +876,8 @@
 
 %{  /* NOCONTEXT */
     RETURN (_MKSMALLINT( ExposureMask | StructureNotifyMask |
-		         KeyPressMask |
-		         ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
+			 KeyPressMask |
+			 ButtonPressMask | ButtonMotionMask | ButtonReleaseMask ));
 %}
 !
 
@@ -5303,9 +5303,7 @@
 !
 
 dispatchLastEvent
-    |theView controller sensor delegate 
-     keyButtonReceiver exposeReceiver
-     sym symS symC arg butt sibling|
+    |theView symS arg butt sibling|
 
 %{  /* STACK: 8000 */
 #   define ANYBUTTON   (Button1MotionMask | Button2MotionMask | Button3MotionMask)
@@ -5329,29 +5327,9 @@
     char keySymStringBuffer[32];
     static unsigned multiClickTime = 0;
     unsigned nextMultiClickTime;
-    OBJ userEventReceiver;
-
-    struct inlineCache *ip, *ipS;
+
+    struct inlineCache *ipS;
     static struct inlineCache vid = _ILC1;
-    static struct inlineCache exp = _ILC4;
-    static struct inlineCache gexp = _ILC4;
-    static struct inlineCache nexp = _ILC0;
-    static struct inlineCache conf = _ILC4;
-    static struct inlineCache covered = _ILC1;
-    static struct inlineCache unmap = _ILC0;
-    static struct inlineCache map = _ILC0;
-    static struct inlineCache mot = _ILC3;
-    static struct inlineCache bp = _ILC3;
-    static struct inlineCache bmp = _ILC3;
-    static struct inlineCache bsp = _ILC3;
-    static struct inlineCache br = _ILC3;
-    static struct inlineCache focIn = _ILC0;
-    static struct inlineCache focOut = _ILC0;
-    static struct inlineCache pe = _ILC3;
-    static struct inlineCache pl = _ILC1;
-    static struct inlineCache term = _ILC0;
-    static struct inlineCache savterm = _ILC0;
-    static struct inlineCache destr = _ILC0;
 
     static struct inlineCache expS = _ILC5;
     static struct inlineCache gexpS = _ILC5;
@@ -5386,12 +5364,7 @@
     static struct inlineCache colormap = _ILC0;
     static struct inlineCache vis = _ILC1;
 
-    static struct inlineCache contr = _ILC0;
-    static struct inlineCache sens = _ILC0;
-    static struct inlineCache deleg = _ILC0;
-    static struct inlineCache skp = _ILC4;
     static struct inlineCache skpS = _ILC4;
-    static struct inlineCache skr = _ILC4;
     static struct inlineCache skrS = _ILC4;
 
     theView = (*vid.ilc_func)(self, @symbol(viewFromId:) COMMA_CON, nil, &vid, 
@@ -5410,42 +5383,19 @@
      * or (if there is none) to the view
      *
      * sensor and delegate get view as additional argument
+     * all of this has been taken out of here to corresponding methods
+     * in DeviceWorkstation.
      */
 
-    sensor = (*sens.ilc_func)(theView, @symbol(sensor) COMMA_CON, nil, &sens);
-
-    userEventReceiver = theView;
-    if (sensor != nil) {
-	keyButtonReceiver = sensor;
-	exposeReceiver = sensor;
-    } else {
-	delegate = (*deleg.ilc_func)(theView, @symbol(delegate) COMMA_CON, nil, &deleg);
-	if (delegate != nil) {
-	    keyButtonReceiver = delegate;
-	} else {
-	    controller = (*contr.ilc_func)(theView, @symbol(controller) COMMA_CON, nil, &contr);
-	    if (controller != nil)
-		userEventReceiver = controller;
-	}
-    }
-
-    /*
-     * now, receiver is in variables keyButtonReceiver, exposeReceiver (to send with view)
-     * or theView if not.
-     */
     switch (__ev__.type) {
 	case KeyRelease:
-	    sym = @symbol(keyRelease:x:y:view:);
-	    symS = @symbol(sendKeyRelease:x:y:to:);
-	    ip = &skr;
+	    symS = @symbol(keyRelease:x:y:view:);
 	    ipS = &skrS;
 	    goto keyPressAndRelease;
 	    break;
 
 	case KeyPress:
-	    sym = @symbol(keyPress:x:y:view:);
-	    symS = @symbol(sendKeyPress:x:y:to:);
-	    ip = &skp;
+	    symS = @symbol(keyPress:x:y:view:);
 	    ipS = &skpS;
 
 	keyPressAndRelease:
@@ -5497,20 +5447,11 @@
 		break;
 	    }
 
-	    if (keyButtonReceiver != nil) {
-		(*(*ipS).ilc_func)(keyButtonReceiver, sym COMMA_CON, nil, ipS,
-				 arg, 
-				 _MKSMALLINT(ke->x), 
-				 _MKSMALLINT(ke->y),
-				 theView);
-		break;
-	    }
-
-	    (*(*ip).ilc_func)(self, symS COMMA_CON, nil, ip,
-			    arg, 
-			    _MKSMALLINT(ke->x), 
-			    _MKSMALLINT(ke->y),
-			    theView);
+	    (*(*ipS).ilc_func)(self, symS COMMA_CON, nil, ipS,
+			       arg, 
+			       _MKSMALLINT(ke->x), 
+			       _MKSMALLINT(ke->y),
+			       theView);
 	    break;
 
 	case ButtonPress:
@@ -5526,9 +5467,7 @@
 	    if (multiClickTime) {
 		if (be->time < multiClickTime) {
 		    multiClickTime = nextMultiClickTime;
-		    ip = &bmp;
 		    ipS = &bmpS;
-		    sym = @symbol(buttonMultiPress:x:y:);
 		    symS = @symbol(buttonMultiPress:x:y:view:);
 		    goto sendButtonEvent;
 		    break;
@@ -5536,15 +5475,11 @@
 	    }
 	    multiClickTime = nextMultiClickTime;
 	    if (be->state & ShiftMask) {
-		ip = &bsp;
 		ipS = &bspS;
-		sym = @symbol(buttonShiftPress:x:y:);
 		symS = @symbol(buttonShiftPress:x:y:view:);
 		goto sendButtonEvent;
 	    }
-	    ip = &bp;
 	    ipS = &bpS;
-	    sym = @symbol(buttonPress:x:y:);
 	    symS = @symbol(buttonPress:x:y:view:);
 	    goto sendButtonEvent;
             
@@ -5554,9 +5489,7 @@
 	    _INST(buttonsPressed) = _MKSMALLINT(_intVal(_INST(buttonsPressed)) & ~(1 << be->button));
 	    _INST(eventRootX) = _MKSMALLINT(be->x_root);
 	    _INST(eventRootY) = _MKSMALLINT(be->y_root);
-	    ip = &br;
 	    ipS = &brS;
-	    sym = @symbol(buttonRelease:x:y:);
 	    symS = @symbol(buttonRelease:x:y:view:);
 	    /* fall into */
 
@@ -5573,23 +5506,13 @@
 		butt = _AT_(_INST(buttonTranslation), butt);
             
 
-	    if (keyButtonReceiver != nil) {
-		(*(*ipS).ilc_func)(keyButtonReceiver, 
-				   symS
-				   COMMA_CON, nil, ipS,
-				   butt, 
-				   _MKSMALLINT(ke->x), 
-				   _MKSMALLINT(ke->y),
-				   theView);
-		break;
-	    }
-
-	    (*(*ip).ilc_func)(userEventReceiver, 
-			      sym 
-			      COMMA_CON, nil, ip,
-			      butt,
-			      _MKSMALLINT(be->x), 
-			      _MKSMALLINT(be->y));
+	    (*(*ipS).ilc_func)(self, 
+			       symS
+			       COMMA_CON, nil, ipS,
+			       butt, 
+			       _MKSMALLINT(ke->x), 
+			       _MKSMALLINT(ke->y),
+			       theView);
 	    break;
 
 	case MotionNotify:
@@ -5600,149 +5523,78 @@
 	    _INST(eventRootX) = _MKSMALLINT(me->x_root);
 	    _INST(eventRootY) = _MKSMALLINT(me->y_root);
 
-	    if (keyButtonReceiver != nil) {
-		(*motS.ilc_func)(keyButtonReceiver, 
-				 @symbol(buttonMotion:x:y:view:)
-				 COMMA_CON, nil, &motS,
-				 _MKSMALLINT(me->state),
-				 _MKSMALLINT(me->x),
-				 _MKSMALLINT(me->y),
-				 theView);
-		break;
-	    }
-	    (*mot.ilc_func)(userEventReceiver, 
-			    @symbol(buttonMotion:x:y:)
-			    COMMA_CON, nil, &mot,
-			    _MKSMALLINT(me->state),
-			    _MKSMALLINT(me->x),
-			    _MKSMALLINT(me->y));
+	    (*motS.ilc_func)(self, 
+			     @symbol(buttonMotion:x:y:view:)
+			     COMMA_CON, nil, &motS,
+			     _MKSMALLINT(me->state),
+			     _MKSMALLINT(me->x),
+			     _MKSMALLINT(me->y),
+			     theView);
 	    break;
 
 	case FocusIn:
-	    if (keyButtonReceiver != nil) {
-		(*focInS.ilc_func)(keyButtonReceiver, 
-				   @symbol(focusInView:)
-				   COMMA_CON, nil, &focInS, 
-				   theView);
-		break;
-                        
-	    }
-	    (*focIn.ilc_func)(userEventReceiver, 
-			      @symbol(focusIn)
-			      COMMA_CON, nil, &focIn);
+	    (*focInS.ilc_func)(self, 
+			       @symbol(focusInView:)
+			       COMMA_CON, nil, &focInS, 
+			       theView);
 	    break;
 
 	case FocusOut:
-	    if (keyButtonReceiver != nil) {
-		(*focOutS.ilc_func)(keyButtonReceiver, 
-				    @symbol(focusOutView:)
-				    COMMA_CON, nil, &focOutS, 
-				    theView);
-		break;
-	    }
-	    (*focOut.ilc_func)(userEventReceiver, 
-			       @symbol(focusOut)
-			       COMMA_CON, nil, &focOut);
+	    (*focOutS.ilc_func)(self, 
+				@symbol(focusOutView:)
+				COMMA_CON, nil, &focOutS, 
+				theView);
 	    break;
 
 	case EnterNotify:
-	    if (keyButtonReceiver != nil) {
-		(*peS.ilc_func)(keyButtonReceiver, 
-				@symbol(pointerEnter:x:y:view:)
-				COMMA_CON, nil, &peS,
-				_MKSMALLINT(ewe->state),
-				_MKSMALLINT(ewe->x), 
-				_MKSMALLINT(ewe->y),
-				theView);
-		break;
-	    }
-	    (*pe.ilc_func)(userEventReceiver, 
-			   @symbol(pointerEnter:x:y:)
-			   COMMA_CON, nil, &pe,
-			   _MKSMALLINT(ewe->state),
-			   _MKSMALLINT(ewe->x), 
-			   _MKSMALLINT(ewe->y));
+	    (*peS.ilc_func)(self, 
+			    @symbol(pointerEnter:x:y:view:)
+			    COMMA_CON, nil, &peS,
+			    _MKSMALLINT(ewe->state),
+			    _MKSMALLINT(ewe->x), 
+			    _MKSMALLINT(ewe->y),
+			    theView);
 	    break;
 
 	case LeaveNotify:
-	    if (keyButtonReceiver != nil) {
-		(*plS.ilc_func)(keyButtonReceiver, 
-				@symbol(pointerLeave:view:)
-				COMMA_CON, nil, &plS,
-				_MKSMALLINT(lwe->state), 
-				theView);
-		break;
-	    }
-	    (*pl.ilc_func)(userEventReceiver, 
-			   @symbol(pointerLeave:)
-			   COMMA_CON, nil, &pl,
-			   _MKSMALLINT(lwe->state));
+	    (*plS.ilc_func)(self, 
+			    @symbol(pointerLeave:view:)
+			    COMMA_CON, nil, &plS,
+			    _MKSMALLINT(lwe->state), 
+			    theView);
 	    break;
 
 	case GraphicsExpose:
-	    if (exposeReceiver != nil) {
-		(*gexpS.ilc_func)(exposeReceiver, 
-				  @symbol(graphicExposeX:y:width:height:view:)
-				  COMMA_CON, nil, &gexpS,
-				  _MKSMALLINT(ee->x),
-				  _MKSMALLINT(ee->y),
-				  _MKSMALLINT(ee->width),
-				  _MKSMALLINT(ee->height),
-				  theView);
-		if (ee->count == 0) {
-		    (*nexpS.ilc_func)(exposeReceiver, 
-				      @symbol(noExposeView:)
-				      COMMA_CON, nil, &nexpS, 
-				      theView);
-		}
+	    (*gexpS.ilc_func)(self, 
+			      @symbol(graphicExposeX:y:width:height:view:)
+			      COMMA_CON, nil, &gexpS,
+			      _MKSMALLINT(ee->x),
+			      _MKSMALLINT(ee->y),
+			      _MKSMALLINT(ee->width),
+			      _MKSMALLINT(ee->height),
+			      theView);
+
+	    if (ee->count != 0) {
 		break;
 	    }
-	    (*gexp.ilc_func)(theView, 
-			     @symbol(graphicExposeX:y:width:height:)
-			     COMMA_CON, nil, &gexp,
+	    /* fall into */
+
+	case NoExpose:
+	    (*nexpS.ilc_func)(self, 
+			      @symbol(noExposeView:)
+			      COMMA_CON, nil, &nexpS, 
+			      theView);
+	    break;
+
+	case Expose:
+	    (*expS.ilc_func)(self, 
+			     @symbol(exposeX:y:width:height:view:)
+			     COMMA_CON, nil, &expS,
 			     _MKSMALLINT(ee->x),
 			     _MKSMALLINT(ee->y),
 			     _MKSMALLINT(ee->width),
-			     _MKSMALLINT(ee->height));
-	    if (ee->count == 0) {
-		(*nexp.ilc_func)(theView, 
-				 @symbol(noExpose)
-				 COMMA_CON, nil, &nexp);
-	    }
-	    break;
-
-	case Expose:
-	    if (exposeReceiver != nil) {
-		(*expS.ilc_func)(exposeReceiver, 
-				 @symbol(exposeX:y:width:height:view:)
-				 COMMA_CON, nil, &expS,
-				 _MKSMALLINT(ee->x),
-				 _MKSMALLINT(ee->y),
-				 _MKSMALLINT(ee->width),
-				 _MKSMALLINT(ee->height),
-				 theView);
-		break;
-	    }
-	    (*exp.ilc_func)(theView, 
-			    @symbol(exposeX:y:width:height:)
-			    COMMA_CON, nil, &exp,
-			    _MKSMALLINT(ee->x),
-			    _MKSMALLINT(ee->y),
-			    _MKSMALLINT(ee->width),
-			    _MKSMALLINT(ee->height));
-	    break;
-
-	case NoExpose:
-	    if (exposeReceiver != nil) {
-		(*nexpS.ilc_func)(exposeReceiver, 
-				  @symbol(noExposeView:)
-				  COMMA_CON, nil, &nexpS, 
-				  theView);
-		break;
-	    }
-	    (*nexp.ilc_func)(theView, 
-			     @symbol(noExpose) 
-			     COMMA_CON, nil, &nexp);
+			     _MKSMALLINT(ee->height),
+			     theView);
 	    break;
 
 	case ConfigureNotify:
@@ -5752,36 +5604,20 @@
 					  MKOBJ(ce->above));
 	    }
 
-	    if (sensor != nil) {
-		(*confS.ilc_func)(sensor, 
-				 @symbol(configureX:y:width:height:view:)
-				 COMMA_CON, nil, &confS,
-				 _MKSMALLINT(ce->x),
-				 _MKSMALLINT(ce->y),
-				 _MKSMALLINT(ce->width),
-				 _MKSMALLINT(ce->height),
-				 theView);
-		if (sibling != nil) {
-		    (*coveredS.ilc_func)(sensor,
-					@symbol(coveredBy:view:)
-					COMMA_CON, nil, &coveredS,
-					theView,
-					sibling);
-		}
-		break;
-	    }
-	    (*conf.ilc_func)(theView, 
-			     @symbol(configureX:y:width:height:)
-			     COMMA_CON, nil, &conf,
+	    (*confS.ilc_func)(self, 
+			     @symbol(configureX:y:width:height:view:)
+			     COMMA_CON, nil, &confS,
 			     _MKSMALLINT(ce->x),
 			     _MKSMALLINT(ce->y),
 			     _MKSMALLINT(ce->width),
-			     _MKSMALLINT(ce->height));
+			     _MKSMALLINT(ce->height),
+			     theView);
 	    if (sibling != nil) {
-		(*covered.ilc_func)(sibling,
-				    @symbol(coveredBy:)
-				    COMMA_CON, nil, &covered,
-				    theView);
+		(*coveredS.ilc_func)(self,
+				    @symbol(coveredBy:view:)
+				    COMMA_CON, nil, &coveredS,
+				    theView,
+				    sibling);
 	    }
 	    break;
 
@@ -5789,63 +5625,40 @@
 	    if (__ev__.xclient.message_type == (int) _AtomVal(_INST(protocolsAtom))) {
 		if ((__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(quitAppAtom)))
 		 || (__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(deleteWindowAtom)))) {
-		    if (sensor != nil) {
-			(*termS.ilc_func)(sensor, 
-					 @symbol(terminateView:)
-					 COMMA_CON, nil, &termS, theView);
-			break;
-		    }
-		    (*term.ilc_func)(theView, 
-				     @symbol(terminate)
-				     COMMA_CON, nil, &term);
+		    (*termS.ilc_func)(self, 
+				      @symbol(terminateView:)
+				      COMMA_CON, nil, &termS, theView);
 		    break;
 		}
 		if (__ev__.xclient.data.l[0] == (int) _AtomVal(_INST(saveYourselfAtom))) {
-		    if (sensor != nil) {
-			(*savtermS.ilc_func)(sensor, 
-					    @symbol(saveAndTerminateView:)
-					    COMMA_CON, nil, &savtermS, theView);
-			break;
-		    }
-		    (*savterm.ilc_func)(theView, 
-					@symbol(saveAndTerminate)
-					COMMA_CON, nil, &savterm);
+		    (*savtermS.ilc_func)(self, 
+					 @symbol(saveAndTerminateView:)
+					 COMMA_CON, nil, &savtermS, theView);
 		    break;
 		}
 	    }
 	    break;
 
 	case DestroyNotify:
-	    if (sensor != nil) {
-		(*destrS.ilc_func)(sensor, @symbol(destroyedView:)
-				   COMMA_CON, nil, &destrS, theView);
-		break;
-	    }
-	    (*destr.ilc_func)(theView, @symbol(destroyed) 
-			      COMMA_CON, nil, &destr);
+	    (*destrS.ilc_func)(self, @symbol(destroyedView:)
+			       COMMA_CON, nil, &destrS, theView);
 	    break;
 
 	case UnmapNotify:
-	    if (sensor != nil) {
-		(*unmapS.ilc_func)(sensor, @symbol(unmappedView:) 
-				   COMMA_CON, nil, &unmapS, theView);
-		break;
-	    }
-	    (*unmap.ilc_func)(theView, @symbol(unmapped) 
-			      COMMA_CON, nil, &unmap);
+	    (*unmapS.ilc_func)(self, @symbol(unmappedView:) 
+			       COMMA_CON, nil, &unmapS, theView);
 	    break;
 
 	case MapNotify:
-	    if (sensor != nil) {
-		(*mapS.ilc_func)(sensor, @symbol(mappedView:) 
-				 COMMA_CON, nil, &mapS, theView);
-		break;
-	    }
-	    (*map.ilc_func)(theView, @symbol(mapped) COMMA_CON, nil, &map);
+	    (*mapS.ilc_func)(self, 
+			     @symbol(mappedView:) 
+			     COMMA_CON, nil, &mapS, theView);
 	    break;
 
 	case KeymapNotify:
-	    (*keymap.ilc_func)(theView, @symbol(keyMapChange) COMMA_CON, nil, &keymap);
+	    (*keymap.ilc_func)(theView, 
+			       @symbol(keyMapChange) 
+			       COMMA_CON, nil, &keymap);
 	    break;
 
 	case VisibilityNotify:
@@ -5889,11 +5702,15 @@
 	    break;
 
 	case PropertyNotify:
-	    (*prop.ilc_func)(theView, @symbol(propertyChange) COMMA_CON, nil, &prop);
+	    (*prop.ilc_func)(theView, 
+			     @symbol(propertyChange) 
+			     COMMA_CON, nil, &prop);
 	    break;
 
 	case SelectionClear:
-	    (*selClear.ilc_func)(theView, @symbol(selectionClear) COMMA_CON, nil, &selClear);
+	    (*selClear.ilc_func)(theView, 
+				 @symbol(selectionClear) 
+				 COMMA_CON, nil, &selClear);
 	    break;
 
 	case SelectionNotify:
@@ -5904,7 +5721,9 @@
 	    printf("SelectionNotify prop=%x requestor=%x\n", __ev__.xselection.property,
 							      __ev__.xselection.requestor);
 */
-	    (*selNotify.ilc_func)(theView, @symbol(selectionNotify:target:selection:from:) COMMA_CON, nil, &selNotify,
+	    (*selNotify.ilc_func)(theView, 
+				  @symbol(selectionNotify:target:selection:from:) 
+				  COMMA_CON, nil, &selNotify,
 				  MKOBJ(__ev__.xselection.property),
 				  MKOBJ(__ev__.xselection.target),
 				  MKOBJ(__ev__.xselection.selection),
@@ -5919,7 +5738,9 @@
 							      __ev__.xselectionrequest.target,
 							      __ev__.xselectionrequest.selection);
 */
-	    (*selReq.ilc_func)(theView, @symbol(selectionRequest:target:selection:from:) COMMA_CON, nil, &selReq,
+	    (*selReq.ilc_func)(theView, 
+			       @symbol(selectionRequest:target:selection:from:) 
+			       COMMA_CON, nil, &selReq,
 			       MKOBJ(__ev__.xselectionrequest.property),
 			       MKOBJ(__ev__.xselectionrequest.target),
 			       MKOBJ(__ev__.xselectionrequest.selection),
@@ -5927,7 +5748,9 @@
 	    break;
 
 	case ColormapNotify:
-	    (*colormap.ilc_func)(theView, @symbol(colorMapChange) COMMA_CON, nil, &colormap);
+	    (*colormap.ilc_func)(theView, 
+				 @symbol(colorMapChange) 
+				 COMMA_CON, nil, &colormap);
 	    break;
 
 	case MappingNotify:
@@ -5935,7 +5758,9 @@
 printf("mapping\n");
 */
 /*
-	    (*mapping.ilc_func)(theView, @symbol(mapping) COMMA_CON, nil, &mapping);
+	    (*mapping.ilc_func)(theView, 
+				@symbol(mapping) 
+				COMMA_CON, nil, &mapping);
 */
 	    break;
     }