avoid a send in #processEventsWithModalGroup:
authorClaus Gittinger <cg@exept.de>
Wed, 15 Jul 1998 12:58:15 +0200
changeset 2172 6dccf11733fd
parent 2171 df6af7cc7a62
child 2173 0686e9f35817
avoid a send in #processEventsWithModalGroup:
WGroup.st
WindowGroup.st
--- a/WGroup.st	Fri Jul 10 15:41:13 1998 +0200
+++ b/WGroup.st	Wed Jul 15 12:58:15 1998 +0200
@@ -1102,42 +1102,40 @@
 
     self processExposeEvents.
 
-    [mySensor hasEvents] whileTrue:[
-        event := mySensor nextEvent.
-        event notNil ifTrue:[
-            ignore := false.
-            focus := focusView.
-            modalDelegate := false.
+    [(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:[
+            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.
-                        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)
+                    ] 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 |
@@ -1145,103 +1143,101 @@
 "/                            ] do:[
 "/                                syntheticEvent sendEventWithFocusOn:nil.
 "/                            ].
-                            event view:modalTop.
-                        ].
-                        modalDelegate := true.
+                        event view:modalTop.
+                    ].
+                    modalDelegate := true.
+                ] ifFalse:[
+                    event isPointerLeaveEvent ifTrue:[
                     ] ifFalse:[
-                        event isPointerLeaveEvent ifTrue:[
-                        ] ifFalse:[
-                            event isUserEvent ifTrue:[
-                                ignore := true
-                            ]
+                        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:[
+                LastEventQuerySignal handle:[:ex |
+                    ex proceedWith:event
+                ] do:[
+                    (preEventHook  notNil 
+                    and:[preEventHook processEvent:event]) ifTrue:[
+                        ignore := true.
+                    ].
 
-                        ignore ifFalse:[
-                            evView := event view.
+                    ignore ifFalse:[
+                        evView := event view.
 
-                            event isKeyPressEvent ifTrue:[
-                                key := event key.
+                        event isKeyPressEvent ifTrue:[
+                            key := event key.
 
-                                key == #Escape ifTrue:[
-                                    modalDelegate ifTrue:[
-                                        modalTop hideRequest
-                                    ] ifFalse:[
-                                        isModal ifTrue:[
-                                            topViews first hideRequest
-                                        ]
+                            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
-                                    ]
-                                ]
-                            ].
-
+                            ]
+                        ] ifFalse:[
                             "/
-                            "/  buttonPress events turn off explicit focus, and revert
-                            "/  to implicit focus control
+                            "/ keep track of which view has the pointer
                             "/
-                            (focusView notNil
-                            and:[event isButtonPressEvent]) ifTrue:[
-                                self focusView:nil
-                            ].
-
-                            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.
-
-                            evView isNil ifTrue:[
-                                (firstTop := topViews first) notNil ifTrue:[
-                                    firstTop perform:evType withArguments:evArgs
+                            event isPointerEnterEvent ifTrue:[
+                                pointerView := evView
+                            ] ifFalse:[
+                                event isPointerLeaveEvent ifTrue:[
+                                    pointerView := nil
                                 ]
-                            ] ifFalse:[
-                                evView
-                                    dispatchEvent:evType 
-                                    arguments:evArgs 
-                                    withFocusOn:focus 
-                                    delegate:true
                             ]
                         ].
 
-                        postEventHook notNil ifTrue:[
-                            postEventHook processEvent:event
+                        "/
+                        "/  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.
+
+                        "
+                         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
+                        ]
+                    ].
+
+                    postEventHook notNil ifTrue:[
+                        postEventHook processEvent:event
+                    ].
                 ]
-            ].
-            event := nil.
+            ]
         ].
     ]
 
     "Created: / 5.3.1997 / 11:33:11 / cg"
-    "Modified: / 21.5.1998 / 00:14:59 / cg"
+    "Modified: / 14.7.1998 / 20:59:40 / cg"
 !
 
 processExposeEvents
@@ -1788,6 +1784,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/Attic/WGroup.st,v 1.138 1998-07-09 16:19:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/Attic/WGroup.st,v 1.139 1998-07-15 10:58:15 cg Exp $'
 ! !
 WindowGroup initialize!
--- a/WindowGroup.st	Fri Jul 10 15:41:13 1998 +0200
+++ b/WindowGroup.st	Wed Jul 15 12:58:15 1998 +0200
@@ -1102,42 +1102,40 @@
 
     self processExposeEvents.
 
-    [mySensor hasEvents] whileTrue:[
-        event := mySensor nextEvent.
-        event notNil ifTrue:[
-            ignore := false.
-            focus := focusView.
-            modalDelegate := false.
+    [(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:[
+            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.
-                        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)
+                    ] 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 |
@@ -1145,103 +1143,101 @@
 "/                            ] do:[
 "/                                syntheticEvent sendEventWithFocusOn:nil.
 "/                            ].
-                            event view:modalTop.
-                        ].
-                        modalDelegate := true.
+                        event view:modalTop.
+                    ].
+                    modalDelegate := true.
+                ] ifFalse:[
+                    event isPointerLeaveEvent ifTrue:[
                     ] ifFalse:[
-                        event isPointerLeaveEvent ifTrue:[
-                        ] ifFalse:[
-                            event isUserEvent ifTrue:[
-                                ignore := true
-                            ]
+                        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:[
+                LastEventQuerySignal handle:[:ex |
+                    ex proceedWith:event
+                ] do:[
+                    (preEventHook  notNil 
+                    and:[preEventHook processEvent:event]) ifTrue:[
+                        ignore := true.
+                    ].
 
-                        ignore ifFalse:[
-                            evView := event view.
+                    ignore ifFalse:[
+                        evView := event view.
 
-                            event isKeyPressEvent ifTrue:[
-                                key := event key.
+                        event isKeyPressEvent ifTrue:[
+                            key := event key.
 
-                                key == #Escape ifTrue:[
-                                    modalDelegate ifTrue:[
-                                        modalTop hideRequest
-                                    ] ifFalse:[
-                                        isModal ifTrue:[
-                                            topViews first hideRequest
-                                        ]
+                            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
-                                    ]
-                                ]
-                            ].
-
+                            ]
+                        ] ifFalse:[
                             "/
-                            "/  buttonPress events turn off explicit focus, and revert
-                            "/  to implicit focus control
+                            "/ keep track of which view has the pointer
                             "/
-                            (focusView notNil
-                            and:[event isButtonPressEvent]) ifTrue:[
-                                self focusView:nil
-                            ].
-
-                            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.
-
-                            evView isNil ifTrue:[
-                                (firstTop := topViews first) notNil ifTrue:[
-                                    firstTop perform:evType withArguments:evArgs
+                            event isPointerEnterEvent ifTrue:[
+                                pointerView := evView
+                            ] ifFalse:[
+                                event isPointerLeaveEvent ifTrue:[
+                                    pointerView := nil
                                 ]
-                            ] ifFalse:[
-                                evView
-                                    dispatchEvent:evType 
-                                    arguments:evArgs 
-                                    withFocusOn:focus 
-                                    delegate:true
                             ]
                         ].
 
-                        postEventHook notNil ifTrue:[
-                            postEventHook processEvent:event
+                        "/
+                        "/  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.
+
+                        "
+                         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
+                        ]
+                    ].
+
+                    postEventHook notNil ifTrue:[
+                        postEventHook processEvent:event
+                    ].
                 ]
-            ].
-            event := nil.
+            ]
         ].
     ]
 
     "Created: / 5.3.1997 / 11:33:11 / cg"
-    "Modified: / 21.5.1998 / 00:14:59 / cg"
+    "Modified: / 14.7.1998 / 20:59:40 / cg"
 !
 
 processExposeEvents
@@ -1788,6 +1784,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.138 1998-07-09 16:19:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.139 1998-07-15 10:58:15 cg Exp $'
 ! !
 WindowGroup initialize!