WindowGroup.st
changeset 2440 a0002dc34d0a
parent 2438 618503d1c7f6
child 2444 6b4c26e1949c
--- a/WindowGroup.st	Fri Feb 05 21:25:47 1999 +0100
+++ b/WindowGroup.st	Mon Feb 08 15:24:11 1999 +0100
@@ -918,172 +918,176 @@
      and aBlock evaluates to true.
 
      Some signals are caught & handled: 
-	LeaveSignal forces an exit from the eventLoop;
-	AbortSignal brings us back into the loop, processing the next event;
-	ActivityNotifications send a #showActivity: if nonModal, 
-	otherwise they are ignored."
+        LeaveSignal forces an exit from the eventLoop;
+        AbortSignal brings us back into the loop, processing the next event;
+        ActivityNotifications send a #showActivity: if nonModal, 
+        otherwise they are ignored."
 
     |thisProcess sigs mainSema prevSema|
 
     thisProcess := Processor activeProcess.
 
     sigs := SignalSet 
-		with:AbortSignal 
-		with:LeaveSignal 
-		with:(self class activityNotificationSignal).
+                with:AbortSignal 
+                with:LeaveSignal 
+                with:(self class activityNotificationSignal).
 
     [
-	|p g s mainGroup mySema waitSema groupForSema|
+        |p g s mainGroup mySema waitSema groupForSema|
 
-	waitSema := mySema := mySensor eventSemaphore.
+        waitSema := mySema := mySensor eventSemaphore.
 
-	isModal ifTrue:[
-	    mainGroup := self mainGroup.
-	    mainGroup == self ifTrue:[
-		mainGroup := nil
-	    ].
-	] ifFalse:[
-	    mainGroup := previousGroup
-	].
+        isModal ifTrue:[
+            mainGroup := self mainGroup.
+            mainGroup == self ifTrue:[
+                mainGroup := nil
+            ].
+        ] ifFalse:[
+            mainGroup := previousGroup
+        ].
         
-	mainGroup notNil ifTrue:[
-	    mainSema := mainGroup sensor eventSemaphore.
-	    waitSema := SemaphoreSet with:mySema with:mainSema.
+        mainGroup notNil ifTrue:[
+            mainSema := mainGroup sensor eventSemaphore.
+            waitSema := SemaphoreSet with:mySema with:mainSema.
 
-	    "/ must also care for all other groups in between
-	    "/ (in case its a modal dialog opened from a modal dialog)
+            "/ must also care for all other groups in between
+            "/ (in case its a modal dialog opened from a modal dialog)
         
-	    g := previousGroup.
-	    g ~~ mainGroup ifTrue:[
-		groupForSema := IdentityDictionary new.
-		[g ~~ mainGroup] whileTrue:[
-		    s := g sensor eventSemaphore.
-		    waitSema add:s.
-		    groupForSema at:s put:g.
-		    g := g previousGroup.
-		]
-	    ].
-	].
+            g := previousGroup.
+            g ~~ mainGroup ifTrue:[
+                groupForSema := IdentityDictionary new.
+                [g ~~ mainGroup] whileTrue:[
+                    s := g sensor eventSemaphore.
+                    waitSema add:s.
+                    groupForSema at:s put:g.
+                    g := g previousGroup.
+                ]
+            ].
+        ].
 
-	[aBlock value] whileTrue:[ 
-	    LastActiveGroup := self.
-	    LastActiveProcess := thisProcess.
+        [aBlock value] whileTrue:[ 
+            LastActiveGroup := self.
+            LastActiveProcess := thisProcess.
 
-	    (views isNil and:[topViews isNil]) ifTrue:[
-		myProcess notNil ifTrue:[
-		    p := myProcess.
-		    myProcess := nil.
-		    p terminate.
-		    "not reached - there is no life after death"
-		].
-		"
-		 this is the end of a modal loop
-		 (not having a private process ...)
-		"
-		^ self
-	    ].
+            (views isNil and:[topViews isNil]) ifTrue:[
+                myProcess notNil ifTrue:[
+                    p := myProcess.
+                    myProcess := nil.
+                    p terminate.
+                    "not reached - there is no life after death"
+                ].
+                "
+                 this is the end of a modal loop
+                 (not having a private process ...)
+                "
+                ^ self
+            ].
 
-	    sigs handle:[:ex |
-		|theSig|
+            sigs handle:[:ex |
+                |theSig|
 
-		(theSig := ex signal) == AbortSignal ifTrue:[
-		    "/
-		    "/ on abort, stay in loop
-		    "/
-		    ex return
-		].
-		theSig == LeaveSignal ifTrue:[
-		    "/
-		    "/ on leave, exit the event loop
-		    "/
-		    ^ self
-		].
+                (theSig := ex signal) == AbortSignal ifTrue:[
+                    "/
+                    "/ on abort, stay in loop
+                    "/
+                    ex return
+                ].
+                theSig == LeaveSignal ifTrue:[
+                    "/
+                    "/ on leave, exit the event loop
+                    "/
+                    ^ self
+                ].
 
-		"/ ActivityNotification
-		"/
-		"/ if I am a modal-group, let it be handled
-		"/ by the outer main-groups handler
-		"/ otherwise show the activityMessage and continue.
-		"/
-		isModal ifTrue:[
-		    ex reject
-		    "never reached"
-		].
-		self showActivity:(ex errorString).
-		ex proceed.
-	    ] do:[
-		|dev gotSema mainView|
+                "/ ActivityNotification
+                "/
+                "/ if I am a modal-group, let it be handled
+                "/ by the outer main-groups handler
+                "/ otherwise show the activityMessage and continue.
+                "/
+                isModal ifTrue:[
+                    ex reject
+                    "never reached"
+                ].
+                self showActivity:(ex errorString).
+                ex proceed.
+            ] do:[
+                |dev gotSema mainView|
 
-		"/ Flush device output before going to sleep. 
-		"/ This may produce more events to arrive.
-		"/ Q: is this still needed (see suspendAction) ?
+                "/ Flush device output before going to sleep. 
+                "/ This may produce more events to arrive.
+                "/ Q: is this still needed (see suspendAction) ?
 
 "/                dev := self graphicsDevice.
 "/                dev notNil ifTrue:[dev flush].
 
-		"/ now, wait for an event to arrive
-		thisProcess setStateTo:#eventWait if:#active.
-		waitSema isNil ifTrue:[
-		    "/ oops - how can this happen ....
-		    ^ self.
-		].
-		gotSema := waitSema wait.
-		LastActiveGroup := self.
-		LastActiveProcess := thisProcess.
-
-		"/ some bad guy ;-) could have closed all down
-		"/ in the meanwhile ...
+                (mainGroup notNil or:[mySensor hasEvents not]) ifTrue:[
+                    "/ now, wait for an event to arrive
+                    thisProcess setStateTo:#eventWait if:#active.
+                    waitSema isNil ifTrue:[
+                        "/ oops - how can this happen ....
+                        ^ self.
+                    ].
+                    gotSema := waitSema wait.
+                ] ifFalse:[
+                    gotSema := mySema
+                ].
+                LastActiveGroup := self.
+                LastActiveProcess := thisProcess.
 
-		mySensor notNil ifTrue:[
-		    gotSema == mySema ifTrue:[
-			"/
-			"/ an event for me 
-			"/
-			self processEventsWithModalGroup:nil
-		    ] ifFalse:[
-			groupForSema notNil ifTrue:[
-			    g := groupForSema at:gotSema ifAbsent:nil.
-			    g := g ? mainGroup.
-			] ifFalse:[
-			    g := mainGroup
-			].
+                "/ some bad guy ;-) could have closed all down
+                "/ in the meanwhile ...
+
+                mySensor notNil ifTrue:[
+                    gotSema == mySema ifTrue:[
+                        "/
+                        "/ an event for me 
+                        "/
+                        self processEventsWithModalGroup:nil
+                    ] ifFalse:[
+                        groupForSema notNil ifTrue:[
+                            g := groupForSema at:gotSema ifAbsent:nil.
+                            g := g ? mainGroup.
+                        ] ifFalse:[
+                            g := mainGroup
+                        ].
 
-			"/
-			"/ an event for my mainGroup 
-			"/
-			g topViews notNil ifTrue:[
-			    mainView := g topViews first
-			].
-			mainView notNil ifTrue:[
-			    "/
-			    "/ if anything happened to the mainGroup
-			    "/ bring my own topView back to the front
-			    "/ This keeps modalBoxes visible
-			    "/
-			    (g sensor hasConfigureEventFor:mainView) ifTrue:[
-				topViews size > 0 ifTrue:[
-				    topViews first raiseDeiconified
-				]
-			    ]
-			].
-			"
-			 if modal, also check for redraw events in my maingroup
-			 (we arrive here after we woke up on maingroup sensor eventSemaphore)
-			"
-			g processEventsWithModalGroup:self.
-		    ]
-		]
-	    ].
-	].
+                        "/
+                        "/ an event for my mainGroup 
+                        "/
+                        g topViews notNil ifTrue:[
+                            mainView := g topViews first
+                        ].
+                        mainView notNil ifTrue:[
+                            "/
+                            "/ if anything happened to the mainGroup
+                            "/ bring my own topView back to the front
+                            "/ This keeps modalBoxes visible
+                            "/
+                            (g sensor hasConfigureEventFor:mainView) ifTrue:[
+                                topViews size > 0 ifTrue:[
+                                    topViews first raiseDeiconified
+                                ]
+                            ]
+                        ].
+                        "
+                         if modal, also check for redraw events in my maingroup
+                         (we arrive here after we woke up on maingroup sensor eventSemaphore)
+                        "
+                        g processEventsWithModalGroup:self.
+                    ]
+                ]
+            ].
+        ].
     ] valueNowOrOnUnwindDo:[
-	"/
-	"/ perform any cleanupActions
-	"/
-	cleanupActions notNil ifTrue:[cleanupActions value]
+        "/
+        "/ perform any cleanupActions
+        "/
+        cleanupActions notNil ifTrue:[cleanupActions value]
     ]
 
     "Modified: / 14.12.1995 / 11:12:24 / stefan"
-    "Modified: / 4.8.1998 / 18:17:59 / cg"
+    "Modified: / 5.2.1999 / 22:32:07 / cg"
 !
 
 leaveEventLoop
@@ -1282,37 +1286,22 @@
                     ] do:[
                         (preEventHook notNil 
                         and:[preEventHook processEvent:event]) ifFalse:[
-                            event isDamage ifTrue:[
-                                "/
-                                "/ if the view is no longer shown (iconified or closed),
-                                "/ this is a leftover event and ignored.
-                                "/
-                                view shown ifTrue:[
-                                    LastActiveGroup := self.
-                                    LastActiveProcess := thisProcess.
-
-                                    view
-                                        dispatchEvent:(event type) 
-                                        arguments:(event arguments) 
-                                        withFocusOn:nil 
-                                        delegate:true
-
-    "/                            ] ifFalse:[
-    "/                                ('WGROUP: damage for ' , view displayString , ' ignored') infoPrintCR.
-                                ]
-                            ] ifFalse:[
-                                "
-                                 mhmh - could we possibly arrive here ?
-                                "
+                            "/
+                            "/ if the view is no longer shown (iconified or closed),
+                            "/ this is a leftover event and ignored.
+                            "/
+                            "/ could this ever be a non-damage ?
+                            "/
+                            (view shown or:[event isDamage not]) ifTrue:[
                                 LastActiveGroup := self.
                                 LastActiveProcess := thisProcess.
-                                "/ event sendEventWithFocusOn:nil.
+
                                 view
                                     dispatchEvent:(event type) 
                                     arguments:(event arguments) 
                                     withFocusOn:nil 
                                     delegate:true
-                            ]
+                            ].
                         ]
                     ].
                     postEventHook notNil ifTrue:[
@@ -1324,7 +1313,7 @@
     ]
 
     "Created: / 3.12.1998 / 14:01:39 / cg"
-    "Modified: / 3.12.1998 / 13:42:10 / cg"
+    "Modified: / 5.2.1999 / 22:26:44 / cg"
 !
 
 processRealExposeEvents
@@ -1862,6 +1851,6 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.148 1999-02-04 23:14:52 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.149 1999-02-08 14:24:11 cg Exp $'
 ! !
 WindowGroup initialize!