WindowGroup.st
changeset 3279 9d7a9a94bec0
parent 3278 ecdd26a9d003
child 3280 fc8a810432c3
--- a/WindowGroup.st	Fri Sep 01 14:38:43 2000 +0200
+++ b/WindowGroup.st	Fri Sep 01 14:41:15 2000 +0200
@@ -1280,178 +1280,180 @@
 
     self processExposeEvents.
 
-    LastEventQuerySignal handle:[:ex |
-        ex proceedWith:event
-    ] do:[
-        [mySensor notNil
-         and:[(event := mySensor nextEvent) notNil]] whileTrue:[
-            ignore := false.
-            focus := focusView.
-            modalDelegate := false.
-            modalTop := nil.
-
-            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.
-                ].
-
-                event isKeyEvent ifTrue:[
-                    "/ forward keyboard events to my modal
-                    "/ groups first topView ...
-                    modalTop notNil ifTrue:[
-                        focus := modalTop.
-                        modalDelegate := true.
+    [
+        LastEventQuerySignal handle:[:ex |
+            ex proceedWith:event
+        ] do:[
+            [mySensor notNil
+             and:[(event := mySensor nextEvent) notNil]] whileTrue:[
+                ignore := false.
+                focus := focusView.
+                modalDelegate := false.
+                modalTop := nil.
+
+                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.
                     ].
-                    modalGroup focusView notNil ifTrue:[
-                        focus := modalGroup focusView
-                    ]
-                ] ifFalse:[
-                    event isFocusEvent ifTrue:[
-                        event isFocusInEvent ifTrue:[
-                            "/ move focus over to modalBox
-                            modalTop notNil ifTrue:[
-                                modalTop getKeyboardFocus.
-                                "/ focusIn is forwarded to the modalGroup
-                                "/ (since keyboard is forwarded)
-                                event view:modalTop.
-                                focus := modalTop.
-                            ]
+
+                    event isKeyEvent ifTrue:[
+                        "/ forward keyboard events to my modal
+                        "/ groups first topView ...
+                        modalTop notNil ifTrue:[
+                            focus := modalTop.
+                            modalDelegate := true.
+                        ].
+                        modalGroup focusView notNil ifTrue:[
+                            focus := modalGroup focusView
+                        ]
+                    ] ifFalse:[
+                        event isFocusEvent ifTrue:[
+                            event isFocusInEvent ifTrue:[
+                                "/ move focus over to modalBox
+                                modalTop notNil ifTrue:[
+                                    modalTop getKeyboardFocus.
+                                    "/ 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 |
+    "/                                ex proceedWith:syntheticEvent
+    "/                            ] do:[
+    "/                                syntheticEvent sendEventWithFocusOn:nil.
+    "/                            ].
+
+                                "/ event view:modalTop.
+                            ].
+                            modalDelegate := true.
                         ] 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 |
-"/                                ex proceedWith:syntheticEvent
-"/                            ] do:[
-"/                                syntheticEvent sendEventWithFocusOn:nil.
-"/                            ].
-
-                            "/ event view:modalTop.
-                        ].
-                        modalDelegate := true.
-                    ] ifFalse:[
-                        event isPointerLeaveEvent ifTrue:[
-                        ] ifFalse:[
-                            event isUserEvent ifTrue:[
-                                ignore := true
+                            event isPointerLeaveEvent ifTrue:[
+                            ] ifFalse:[
+                                event isUserEvent ifTrue:[
+                                    ignore := true
+                                ]
                             ]
                         ]
                     ]
-                ]
-            ].
-
-            ignore ifFalse:[
-                (views notNil or:[topViews notNil]) ifTrue:[
-
-                    "/ give eventRecorders, catchers etc. 
-                    "/ a chance to eat or modify that event
-
-                    (preEventHook  notNil 
-                    and:[preEventHook processEvent:event]) ifTrue:[
-                        ignore := true.
-                    ].
-
-                    ignore ifFalse:[
-                        evView := event view.
-
-                        (event isKeyEvent 
-                        and:[(keyboardProcessor := (modalTop ? evView topView) keyboardProcessor) notNil]) ifTrue:[
-                            ignore := keyboardProcessor processEvent:event forModalView:modalTop
+                ].
+
+                ignore ifFalse:[
+                    (views notNil or:[topViews notNil]) ifTrue:[
+
+                        "/ give eventRecorders, catchers etc. 
+                        "/ a chance to eat or modify that event
+
+                        (preEventHook  notNil 
+                        and:[preEventHook processEvent:event]) ifTrue:[
+                            ignore := true.
                         ].
-                    ].
-
-                    ignore ifFalse:[
-                        "/ event handling below will vanish ...
-                        "/ (keyboardProcessor will do it)
-
-                        event isKeyPressEvent ifTrue:[
-                            event key == #Escape ifTrue:[
-                                modalDelegate ifTrue:[
-                                    modalTop hideRequest
-                                ] ifFalse:[
-                                    isModal ifTrue:[
-                                        topViews size > 0 ifTrue:[
-                                            topViews first hideRequest
+
+                        ignore ifFalse:[
+                            evView := event view.
+
+                            (event isKeyEvent 
+                            and:[(keyboardProcessor := (modalTop ? evView topView) keyboardProcessor) notNil]) ifTrue:[
+                                ignore := keyboardProcessor processEvent:event forModalView:modalTop
+                            ].
+                        ].
+
+                        ignore ifFalse:[
+                            "/ event handling below will vanish ...
+                            "/ (keyboardProcessor will do it)
+
+                            event isKeyPressEvent ifTrue:[
+                                event key == #Escape ifTrue:[
+                                    modalDelegate ifTrue:[
+                                        modalTop hideRequest
+                                    ] ifFalse:[
+                                        isModal ifTrue:[
+                                            topViews size > 0 ifTrue:[
+                                                topViews first hideRequest
+                                            ]
                                         ]
                                     ]
                                 ]
-                            ]
-                        ] ifFalse:[
-                            "/
-                            "/ keep track of which view has the pointer
-                            "/
-                            event isPointerEnterEvent ifTrue:[
-                                pointerView := evView
                             ] ifFalse:[
-                                event isPointerLeaveEvent ifTrue:[
-                                    pointerView := nil
+                                "/
+                                "/ 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 reverts
-                        "/ to implicit focus control
-                        "/ This used to be done for every click -
-                        "/ but behaved ugly if clicking in a scrollbar ...
-
-                        "/ XXX: move to dispatchEvent
-                        event isButtonPressEvent ifTrue:[
-                            (evView wantsFocusWithButtonPress) ifTrue:[
-                                "/ cannot use 'evView requestFocus' here,
-                                "/ since we want to enforce it without giving the
-                                "/ view a chance to circumvent this.
-
-                                "/ evView requestFocus.
-                                self focusView:evView.
+                            ].
+
+                            "/
+                            "/ buttonPress events turn off explicit focus, and reverts
+                            "/ to implicit focus control
+                            "/ This used to be done for every click -
+                            "/ but behaved ugly if clicking in a scrollbar ...
+
+                            "/ XXX: move to dispatchEvent
+                            event isButtonPressEvent ifTrue:[
+                                (evView wantsFocusWithButtonPress) ifTrue:[
+                                    "/ cannot use 'evView requestFocus' here,
+                                    "/ since we want to enforce it without giving the
+                                    "/ view a chance to circumvent this.
+
+                                    "/ evView requestFocus.
+                                    self focusView:evView.
+                                ].
+                            ].
+
+                            LastActiveGroup := self.
+                            LastActiveProcess := Processor activeProcess.
+
+                            (busyHook notNil and:[busyHookBlock isNil]) ifTrue:[
+                                (event isKeyEvent or:[event isButtonPressEvent]) ifTrue:[
+                                    "/ start a timeout action - to invoke the busyHook after some time
+                                    busyHookBlock := [ busyHook value:true. busyHookCalled := true ].
+                                    busyHookCalled := false.
+                                    Processor addTimedBlock:busyHookBlock afterMilliseconds:(busyHookTimeout ? BusyHookTime ? 150).
+                                ].
+                            ].
+                            "
+                             if there is no view information in the event,
+                             it must have been sent directly to the sensor.
+                             Send it to the first topView.
+                            "
+                            evView isNil ifTrue:[
+                                (firstTop := topViews first) notNil ifTrue:[
+                                    "/ XXX: fix to dispatchEvent
+                                    firstTop perform:event type withArguments:event arguments
+                                ]
+                            ] ifFalse:[
+                                evView dispatchEvent:event withFocusOn:focus delegate:true
                             ].
                         ].
 
-                        LastActiveGroup := self.
-                        LastActiveProcess := Processor activeProcess.
-
-                        (busyHook notNil and:[busyHookBlock isNil]) ifTrue:[
-                            (event isKeyEvent or:[event isButtonPressEvent]) ifTrue:[
-                                "/ start a timeout action - to invoke the busyHook after some time
-                                busyHookBlock := [ busyHook value:true. busyHookCalled := true ].
-                                busyHookCalled := false.
-                                Processor addTimedBlock:busyHookBlock afterMilliseconds:(busyHookTimeout ? BusyHookTime ? 150).
-                            ].
+                        "/ give eventRecorders, postProcessors 
+                        "/ a chance to see that event
+
+                        postEventHook notNil ifTrue:[
+                            postEventHook processEvent:event
                         ].
-                        "
-                         if there is no view information in the event,
-                         it must have been sent directly to the sensor.
-                         Send it to the first topView.
-                        "
-                        evView isNil ifTrue:[
-                            (firstTop := topViews first) notNil ifTrue:[
-                                "/ XXX: fix to dispatchEvent
-                                firstTop perform:event type withArguments:event arguments
-                            ]
-                        ] ifFalse:[
-                            evView dispatchEvent:event withFocusOn:focus delegate:true
-                        ].
-                    ].
-
-                    "/ give eventRecorders, postProcessors 
-                    "/ a chance to see that event
-
-                    postEventHook notNil ifTrue:[
-                        postEventHook processEvent:event
-                    ].
-                ]
+                    ]
+                ].
             ].
-        ].
-
+        ]
+    ] valueNowOrOnUnwindDo:[
         busyHookBlock notNil ifTrue:[
             Processor removeTimedBlock:busyHookBlock.
             busyHookBlock := nil.
@@ -1459,7 +1461,7 @@
                 busyHook value:false.    
             ]
         ].
-    ]
+    ].
 
     "Created: / 5.3.1997 / 11:33:11 / cg"
     "Modified: / 4.8.1998 / 18:18:55 / cg"
@@ -2271,6 +2273,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.203 2000-09-01 12:38:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.204 2000-09-01 12:41:15 cg Exp $'
 ! !
 WindowGroup initialize!