moved LastEventQuery handler out of the inner loop.
authorClaus Gittinger <cg@exept.de>
Sat, 06 Mar 1999 12:53:47 +0100
changeset 2487 097d52d671a0
parent 2486 a310c1c75516
child 2488 cb393b7431f0
moved LastEventQuery handler out of the inner loop.
WGroup.st
WindowGroup.st
--- a/WGroup.st	Sat Mar 06 03:19:02 1999 +0100
+++ b/WGroup.st	Sat Mar 06 12:53:47 1999 +0100
@@ -1128,41 +1128,45 @@
 
     self processExposeEvents.
 
-    [mySensor notNil
-     and:[(event := mySensor nextEvent) notNil]] whileTrue:[
-	ignore := false.
-	focus := focusView.
-	modalDelegate := false.
+    LastEventQuerySignal handle:[:ex |
+        ex proceedWith:event
+    ] do:[
+        [mySensor notNil
+         and:[(event := mySensor nextEvent) notNil]] whileTrue:[
+            ignore := false.
+            focus := focusView.
+            modalDelegate := false.
 
-	modalGroup notNil ifTrue:[
-	    "/ an incoming event for a masterView, 
-	    "/ while being blocked by some other modalView.
+            modalGroup notNil ifTrue:[
+                "/ an incoming event for a masterView, 
+                "/ while being blocked by some other modalView.
 
-	    modalTops := modalGroup topViews.
-	    modalTops size > 0 ifTrue:[
-		modalTop := modalTops first.
-	    ].
+                modalTops := modalGroup topViews.
+                modalTops size > 0 ifTrue:[
+                    modalTop := modalTops first.
+                ].
 
-	    event isKeyEvent ifTrue:[
-		"/ forward keyboard events to my modal
-		"/ groups first topView ...
-		modalTop notNil ifTrue:[
-		    focus := modalTop.
-		    modalDelegate := true.
-		]
-	    ] ifFalse:[
-		event isFocusEvent ifTrue:[
-		    event isFocusInEvent ifTrue:[
-			"/ focusIn is forwarded to the modalGroup
-			"/ (since keyboard is forwarded)
-			event view:modalTop.
-			focus := modalTop.
-		    ] ifFalse:[
-			"/ focusOut goes to both the modal and
-			"/ the blocked main-group
-			"/ (actually, only the very first focusOut
-			"/  is needed in the mainGroup (to turn off the cursor)
-			"/  all others are only needed in the modalGroup)
+                event isKeyEvent ifTrue:[
+                    "/ forward keyboard events to my modal
+                    "/ groups first topView ...
+                    modalTop notNil ifTrue:[
+                        focus := modalTop.
+                        modalDelegate := true.
+                    ]
+                ] ifFalse:[
+                    event isFocusEvent ifTrue:[
+                        event isFocusInEvent ifTrue:[
+                            "/ focusIn is forwarded to the modalGroup
+                            "/ (since keyboard is forwarded)
+                            event view:modalTop.
+                            focus := modalTop.
+                        ] ifFalse:[
+                            "/ focusOut goes to both the modal and
+                            "/ the blocked main-group
+                            "/ (actually, only the very first focusOut
+                            "/  is needed in the mainGroup (to turn off the cursor)
+                            "/  all others are only needed in the modalGroup)
+
 "/                            syntheticEvent := event copy.
 "/                            syntheticEvent view:modalTop.
 "/                            LastEventQuerySignal handle:[:ex |
@@ -1170,97 +1174,102 @@
 "/                            ] do:[
 "/                                syntheticEvent sendEventWithFocusOn:nil.
 "/                            ].
-			event view:modalTop.
-		    ].
-		    modalDelegate := true.
-		] ifFalse:[
-		    event isPointerLeaveEvent ifTrue:[
-		    ] ifFalse:[
-			event isUserEvent ifTrue:[
-			    ignore := true
-			]
-		    ]
-		]
-	    ]
-	].
+
+                            event view:modalTop.
+                        ].
+                        modalDelegate := true.
+                    ] ifFalse:[
+                        event isPointerLeaveEvent ifTrue:[
+                        ] ifFalse:[
+                            event isUserEvent ifTrue:[
+                                ignore := true
+                            ]
+                        ]
+                    ]
+                ]
+            ].
 
-	ignore ifFalse:[
-	    (views notNil or:[topViews notNil]) ifTrue:[
-		LastEventQuerySignal handle:[:ex |
-		    ex proceedWith:event
-		] do:[
-		    (preEventHook  notNil 
-		    and:[preEventHook processEvent:event]) ifTrue:[
-			ignore := true.
-		    ].
+            ignore ifFalse:[
+                (views notNil or:[topViews notNil]) ifTrue:[
+
+                    "/ give eventRecorders, catchers etc. 
+                    "/ a chance to eat or modify that event
 
-		    ignore ifFalse:[
-			evView := event view.
+                    (preEventHook  notNil 
+                    and:[preEventHook processEvent:event]) ifTrue:[
+                        ignore := true.
+                    ].
 
-			event isKeyPressEvent ifTrue:[
-			    key := event key.
+                    ignore ifFalse:[
+                        evView := event view.
+
+                        event isKeyPressEvent ifTrue:[
+                            key := event key.
 
-			    key == #Escape ifTrue:[
-				modalDelegate ifTrue:[
-				    modalTop hideRequest
-				] ifFalse:[
-				    isModal ifTrue:[
-					topViews first hideRequest
-				    ]
-				]
-			    ]
-			] ifFalse:[
-			    "/
-			    "/ keep track of which view has the pointer
-			    "/
-			    event isPointerEnterEvent ifTrue:[
-				pointerView := evView
-			    ] ifFalse:[
-				event isPointerLeaveEvent ifTrue:[
-				    pointerView := nil
-				]
-			    ]
-			].
+                            key == #Escape ifTrue:[
+                                modalDelegate ifTrue:[
+                                    modalTop hideRequest
+                                ] ifFalse:[
+                                    isModal ifTrue:[
+                                        topViews first hideRequest
+                                    ]
+                                ]
+                            ]
+                        ] ifFalse:[
+                            "/
+                            "/ keep track of which view has the pointer
+                            "/
+                            event isPointerEnterEvent ifTrue:[
+                                pointerView := evView
+                            ] ifFalse:[
+                                event isPointerLeaveEvent ifTrue:[
+                                    pointerView := nil
+                                ]
+                            ]
+                        ].
 
-			"/
-			"/  buttonPress events turn off explicit focus, and revert
-			"/  to implicit focus control
-			"/
-			(focusView notNil
-			and:[event isButtonPressEvent]) ifTrue:[
-			    self focusView:nil
-			].
+                        "/
+                        "/  buttonPress events turn off explicit focus, and revert
+                        "/  to implicit focus control
+                        "/
+                        (focusView notNil
+                        and:[event isButtonPressEvent]) ifTrue:[
+                            self focusView:nil
+                        ].
 
-			LastActiveGroup := self.
-			LastActiveProcess := Processor activeProcess.
+                        LastActiveGroup := self.
+                        LastActiveProcess := Processor activeProcess.
 
-			"
-			 if there is no view information in the event,
-			 it must have been sent directly to the sensor.
-			 Send it to the first topView.
-			"
-			evType := event type.
-			evArgs := event arguments.
+                        "
+                         if there is no view information in the event,
+                         it must have been sent directly to the sensor.
+                         Send it to the first topView.
+                        "
+                        evType := event type.
+                        evArgs := event arguments.
 
-			evView isNil ifTrue:[
-			    (firstTop := topViews first) notNil ifTrue:[
-				firstTop perform:evType withArguments:evArgs
-			    ]
-			] ifFalse:[
-			    evView
-				dispatchEvent:evType 
-				arguments:evArgs 
-				withFocusOn:focus 
-				delegate:true
-			]
-		    ].
+                        evView isNil ifTrue:[
+                            (firstTop := topViews first) notNil ifTrue:[
+                                firstTop perform:evType withArguments:evArgs
+                            ]
+                        ] ifFalse:[
+                            evView
+                                dispatchEvent:evType 
+                                arguments:evArgs 
+                                withFocusOn:focus 
+                                delegate:true
+                        ]
+                    ].
 
-		    postEventHook notNil ifTrue:[
-			postEventHook processEvent:event
-		    ].
-		]
-	    ]
-	].
+                    "/ give eventRecorders, postProcessors 
+                    "/ a chance to see that event
+
+                    postEventHook notNil ifTrue:[
+                        postEventHook processEvent:event
+                    ].
+                ]
+            ].
+        ]
     ]
 
     "Created: / 5.3.1997 / 11:33:11 / cg"
@@ -1934,6 +1943,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/WGroup.st,v 1.153 1999-03-06 01:30:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/WGroup.st,v 1.154 1999-03-06 11:53:47 cg Exp $'
 ! !
 WindowGroup initialize!
--- a/WindowGroup.st	Sat Mar 06 03:19:02 1999 +0100
+++ b/WindowGroup.st	Sat Mar 06 12:53:47 1999 +0100
@@ -1128,41 +1128,45 @@
 
     self processExposeEvents.
 
-    [mySensor notNil
-     and:[(event := mySensor nextEvent) notNil]] whileTrue:[
-	ignore := false.
-	focus := focusView.
-	modalDelegate := false.
+    LastEventQuerySignal handle:[:ex |
+        ex proceedWith:event
+    ] do:[
+        [mySensor notNil
+         and:[(event := mySensor nextEvent) notNil]] whileTrue:[
+            ignore := false.
+            focus := focusView.
+            modalDelegate := false.
 
-	modalGroup notNil ifTrue:[
-	    "/ an incoming event for a masterView, 
-	    "/ while being blocked by some other modalView.
+            modalGroup notNil ifTrue:[
+                "/ an incoming event for a masterView, 
+                "/ while being blocked by some other modalView.
 
-	    modalTops := modalGroup topViews.
-	    modalTops size > 0 ifTrue:[
-		modalTop := modalTops first.
-	    ].
+                modalTops := modalGroup topViews.
+                modalTops size > 0 ifTrue:[
+                    modalTop := modalTops first.
+                ].
 
-	    event isKeyEvent ifTrue:[
-		"/ forward keyboard events to my modal
-		"/ groups first topView ...
-		modalTop notNil ifTrue:[
-		    focus := modalTop.
-		    modalDelegate := true.
-		]
-	    ] ifFalse:[
-		event isFocusEvent ifTrue:[
-		    event isFocusInEvent ifTrue:[
-			"/ focusIn is forwarded to the modalGroup
-			"/ (since keyboard is forwarded)
-			event view:modalTop.
-			focus := modalTop.
-		    ] ifFalse:[
-			"/ focusOut goes to both the modal and
-			"/ the blocked main-group
-			"/ (actually, only the very first focusOut
-			"/  is needed in the mainGroup (to turn off the cursor)
-			"/  all others are only needed in the modalGroup)
+                event isKeyEvent ifTrue:[
+                    "/ forward keyboard events to my modal
+                    "/ groups first topView ...
+                    modalTop notNil ifTrue:[
+                        focus := modalTop.
+                        modalDelegate := true.
+                    ]
+                ] ifFalse:[
+                    event isFocusEvent ifTrue:[
+                        event isFocusInEvent ifTrue:[
+                            "/ focusIn is forwarded to the modalGroup
+                            "/ (since keyboard is forwarded)
+                            event view:modalTop.
+                            focus := modalTop.
+                        ] ifFalse:[
+                            "/ focusOut goes to both the modal and
+                            "/ the blocked main-group
+                            "/ (actually, only the very first focusOut
+                            "/  is needed in the mainGroup (to turn off the cursor)
+                            "/  all others are only needed in the modalGroup)
+
 "/                            syntheticEvent := event copy.
 "/                            syntheticEvent view:modalTop.
 "/                            LastEventQuerySignal handle:[:ex |
@@ -1170,97 +1174,102 @@
 "/                            ] do:[
 "/                                syntheticEvent sendEventWithFocusOn:nil.
 "/                            ].
-			event view:modalTop.
-		    ].
-		    modalDelegate := true.
-		] ifFalse:[
-		    event isPointerLeaveEvent ifTrue:[
-		    ] ifFalse:[
-			event isUserEvent ifTrue:[
-			    ignore := true
-			]
-		    ]
-		]
-	    ]
-	].
+
+                            event view:modalTop.
+                        ].
+                        modalDelegate := true.
+                    ] ifFalse:[
+                        event isPointerLeaveEvent ifTrue:[
+                        ] ifFalse:[
+                            event isUserEvent ifTrue:[
+                                ignore := true
+                            ]
+                        ]
+                    ]
+                ]
+            ].
 
-	ignore ifFalse:[
-	    (views notNil or:[topViews notNil]) ifTrue:[
-		LastEventQuerySignal handle:[:ex |
-		    ex proceedWith:event
-		] do:[
-		    (preEventHook  notNil 
-		    and:[preEventHook processEvent:event]) ifTrue:[
-			ignore := true.
-		    ].
+            ignore ifFalse:[
+                (views notNil or:[topViews notNil]) ifTrue:[
+
+                    "/ give eventRecorders, catchers etc. 
+                    "/ a chance to eat or modify that event
 
-		    ignore ifFalse:[
-			evView := event view.
+                    (preEventHook  notNil 
+                    and:[preEventHook processEvent:event]) ifTrue:[
+                        ignore := true.
+                    ].
 
-			event isKeyPressEvent ifTrue:[
-			    key := event key.
+                    ignore ifFalse:[
+                        evView := event view.
+
+                        event isKeyPressEvent ifTrue:[
+                            key := event key.
 
-			    key == #Escape ifTrue:[
-				modalDelegate ifTrue:[
-				    modalTop hideRequest
-				] ifFalse:[
-				    isModal ifTrue:[
-					topViews first hideRequest
-				    ]
-				]
-			    ]
-			] ifFalse:[
-			    "/
-			    "/ keep track of which view has the pointer
-			    "/
-			    event isPointerEnterEvent ifTrue:[
-				pointerView := evView
-			    ] ifFalse:[
-				event isPointerLeaveEvent ifTrue:[
-				    pointerView := nil
-				]
-			    ]
-			].
+                            key == #Escape ifTrue:[
+                                modalDelegate ifTrue:[
+                                    modalTop hideRequest
+                                ] ifFalse:[
+                                    isModal ifTrue:[
+                                        topViews first hideRequest
+                                    ]
+                                ]
+                            ]
+                        ] ifFalse:[
+                            "/
+                            "/ keep track of which view has the pointer
+                            "/
+                            event isPointerEnterEvent ifTrue:[
+                                pointerView := evView
+                            ] ifFalse:[
+                                event isPointerLeaveEvent ifTrue:[
+                                    pointerView := nil
+                                ]
+                            ]
+                        ].
 
-			"/
-			"/  buttonPress events turn off explicit focus, and revert
-			"/  to implicit focus control
-			"/
-			(focusView notNil
-			and:[event isButtonPressEvent]) ifTrue:[
-			    self focusView:nil
-			].
+                        "/
+                        "/  buttonPress events turn off explicit focus, and revert
+                        "/  to implicit focus control
+                        "/
+                        (focusView notNil
+                        and:[event isButtonPressEvent]) ifTrue:[
+                            self focusView:nil
+                        ].
 
-			LastActiveGroup := self.
-			LastActiveProcess := Processor activeProcess.
+                        LastActiveGroup := self.
+                        LastActiveProcess := Processor activeProcess.
 
-			"
-			 if there is no view information in the event,
-			 it must have been sent directly to the sensor.
-			 Send it to the first topView.
-			"
-			evType := event type.
-			evArgs := event arguments.
+                        "
+                         if there is no view information in the event,
+                         it must have been sent directly to the sensor.
+                         Send it to the first topView.
+                        "
+                        evType := event type.
+                        evArgs := event arguments.
 
-			evView isNil ifTrue:[
-			    (firstTop := topViews first) notNil ifTrue:[
-				firstTop perform:evType withArguments:evArgs
-			    ]
-			] ifFalse:[
-			    evView
-				dispatchEvent:evType 
-				arguments:evArgs 
-				withFocusOn:focus 
-				delegate:true
-			]
-		    ].
+                        evView isNil ifTrue:[
+                            (firstTop := topViews first) notNil ifTrue:[
+                                firstTop perform:evType withArguments:evArgs
+                            ]
+                        ] ifFalse:[
+                            evView
+                                dispatchEvent:evType 
+                                arguments:evArgs 
+                                withFocusOn:focus 
+                                delegate:true
+                        ]
+                    ].
 
-		    postEventHook notNil ifTrue:[
-			postEventHook processEvent:event
-		    ].
-		]
-	    ]
-	].
+                    "/ give eventRecorders, postProcessors 
+                    "/ a chance to see that event
+
+                    postEventHook notNil ifTrue:[
+                        postEventHook processEvent:event
+                    ].
+                ]
+            ].
+        ]
     ]
 
     "Created: / 5.3.1997 / 11:33:11 / cg"
@@ -1934,6 +1943,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.153 1999-03-06 01:30:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.154 1999-03-06 11:53:47 cg Exp $'
 ! !
 WindowGroup initialize!