WindowEvent.st
changeset 141 caf4432fae8f
parent 140 0db355079dc4
child 143 b237b9013f51
--- a/WindowEvent.st	Tue May 09 02:23:52 1995 +0200
+++ b/WindowEvent.st	Wed May 10 04:26:41 1995 +0200
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.15 1995-05-09 00:23:08 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.16 1995-05-10 02:26:23 claus Exp $
 '!
 
 !WindowEvent class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.15 1995-05-09 00:23:08 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.16 1995-05-10 02:26:23 claus Exp $
 "
 !
 
@@ -181,7 +181,7 @@
     "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).
+     view (even if there is a delegate).
 
      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
@@ -230,6 +230,11 @@
 	deviceMessage := #'deviceKeyRelease:x:y:'.
 	delegateMessage := #'keyRelease:x:y:view:'.
 	delegateQuery := #'handlesKeyRelease:inView:'.
+    ] ifFalse:[ (type == #'buttonMotion:x:y:') ifTrue:[
+	isButtonEvent := true.
+	deviceMessage := #'deviceButtonMotion:x:y:'.
+	delegateMessage := #'buttonMotion:x:y:view:'.
+	delegateQuery := #'handlesButtonMotion:inView:'.
     ] ifFalse:[ (type == #'buttonPress:x:y:') ifTrue:[
 	isButtonEvent := true.
 	deviceMessage := #'deviceButtonPress:x:y:'.
@@ -250,11 +255,6 @@
 	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:'.
@@ -270,6 +270,24 @@
 	deviceMessage := #'deviceGraphicExposeX:y:width:height:'.
     ]]]]]]]]]]].
 
+    "
+     if there is a focusView, and its a keyboard event, pass it
+     to that view (or its controller, or its delegate). 
+     In this case, a coordinate which is outside of
+     the focusView (-1 @ -1) is passed as x/y coordinates.
+    "
+    (focusView notNil 
+    and:[isKeyEvent]) ifTrue:[
+	self sendEvent:type 
+	     arguments:(Array with:(argArray at:1)
+				     with:-1
+				     with:-1)
+	     view:focusView 
+	     withFocusOn:nil
+	     delegate:doDelegate.
+	^ self
+    ].
+
     doDelegate ifTrue:[
 	"
 	 handle delegated messages
@@ -327,26 +345,6 @@
     ].
 
     "
-     if there is a focusView, and its a keyboard event, pass it
-     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 
-    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
-    ].
-
-    "
      finally, another one:
      if the view has a transformation, edit the selector
      from #foo to #deviceFoo...
@@ -382,8 +380,8 @@
 
 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."
+     the controller or the view. If focusView is nonNil, and it is a keyboard
+     event, the event is forwarded to the focusView instead of the target view."
 
     self class 
 	sendEvent:type