WindowGroup.st
changeset 956 32a642b5dcd3
parent 949 3894d442e895
child 1110 3ffcd22497fd
--- a/WindowGroup.st	Thu Jul 18 13:35:07 1996 +0200
+++ b/WindowGroup.st	Thu Jul 18 13:39:11 1996 +0200
@@ -14,7 +14,8 @@
 	instanceVariableNames:'views topViews myProcess mySensor isModal previousGroup focusView
 		focusSequence preEventHook postEventHook pointerView
 		isForModalSubview'
-	classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal'
+	classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal
+		WindowGroupQuerySignal'
 	poolDictionaries:''
 	category:'Interface-Support'
 !
@@ -171,12 +172,16 @@
 
 initialize
     LeaveSignal isNil ifTrue:[
-	LeaveSignal := (Signal new) mayProceed:true.
-	LeaveSignal nameClass:self message:#leaveSignal.
-	LeaveSignal notifierString:'unhandled leave signal'.
+        LeaveSignal := (Signal new) mayProceed:true.
+        LeaveSignal nameClass:self message:#leaveSignal.
+        LeaveSignal notifierString:'unhandled leave signal'.
+
+        WindowGroupQuerySignal := QuerySignal new.
     ].
 
     "WindowGroup initialize"
+
+    "Modified: 17.7.1996 / 15:38:00 / cg"
 ! !
 
 !WindowGroup  class methodsFor:'instance creation'!
@@ -196,6 +201,14 @@
      method."
 
     ^ LeaveSignal
+!
+
+windowGroupQuerySignal
+    "return the signal which is used to query for the windowGroup"
+
+    ^ WindowGroupQuerySignal
+
+    "Created: 17.7.1996 / 20:36:04 / cg"
 ! !
 
 !WindowGroup  class methodsFor:'accessing'!
@@ -223,23 +236,33 @@
     activeProcess := Processor activeProcess.
     " caching the last value ..."
     activeProcess == LastActiveProcess ifTrue:[
-	LastActiveGroup process == LastActiveProcess ifTrue:[
-	    ^ LastActiveGroup
-	]
+        LastActiveGroup process == LastActiveProcess ifTrue:[
+            ^ LastActiveGroup
+        ]
     ].
     groups := self scheduledWindowGroups 
-		select:[:wg | wg process == activeProcess].
+                select:[:wg | wg process == activeProcess].
     groups size == 1 ifTrue:[
-	wg := groups anElement
+        wg := groups anElement
     ] ifFalse:[
-	wg := groups detect:[:wg | wg isModal] ifNone:nil.
-	wg isNil ifTrue:[
-	    wg := groups anElement
-	]
+        wg := groups detect:[:wg | wg isModal] ifNone:nil.
+        wg isNil ifTrue:[
+            wg := groups anElement
+        ]
     ].
+
+    wg isNil ifTrue:[
+        "/ mhmh - no windowGroup found;
+        "/ (possibly in a forked subProcess)
+        "/ try querySignal
+        WindowGroupQuerySignal isHandled ifTrue:[
+            wg := WindowGroupQuerySignal raise
+        ]
+    ].
+
     wg notNil ifTrue:[
-	LastActiveProcess := activeProcess.
-	LastActiveGroup := wg.
+        LastActiveProcess := activeProcess.
+        LastActiveGroup := wg.
     ].
     ^ wg
 
@@ -248,6 +271,7 @@
     "
 
     "Modified: 3.9.1995 / 14:49:53 / claus"
+    "Modified: 17.7.1996 / 15:39:19 / cg"
 !
 
 scheduledWindowGroups
@@ -616,37 +640,43 @@
 
     previousGroup := mainGroup.
     isModal := true.
-    self realizeTopViews:false.
-    self 
-	eventLoopWhile:checkBlock 
-	onLeave:[
-	    "
-	     cleanup, in case of a terminate
-	    "
-	    previousGroup := nil.
-	    topViews := nil.
-	    views := nil.
-	    "
-	     the following is rubbish;
-	     the views could be reused ..
-	    "
-"
-	    topViews notNil ifTrue:[
-		topViews do:[:aView |
-		    aView destroy
-		].
-		topViews := nil.
-	    ].
-	    views notNil ifTrue:[
-		views do:[:aView |
-		    aView destroy
-		].
-		views := nil.
-	    ].
-"
-	]
+
+    WindowGroupQuerySignal handle:[:ex |
+        ex proceedWith:self
+    ] do:[
+        self realizeTopViews:false.
+        self 
+            eventLoopWhile:checkBlock 
+            onLeave:[
+                "
+                 cleanup, in case of a terminate
+                "
+                previousGroup := nil.
+                topViews := nil.
+                views := nil.
+                "
+                 the following is rubbish;
+                 the views could be reused ..
+                "
+    "
+                topViews notNil ifTrue:[
+                    topViews do:[:aView |
+                        aView destroy
+                    ].
+                    topViews := nil.
+                ].
+                views notNil ifTrue:[
+                    views do:[:aView |
+                        aView destroy
+                    ].
+                    views := nil.
+                ].
+    "
+            ]
+        ]
 
     "Created: 10.12.1995 / 14:14:26 / cg"
+    "Modified: 17.7.1996 / 15:40:37 / cg"
 ! !
 
 !WindowGroup methodsFor:'enumerating'!
@@ -1350,6 +1380,6 @@
 !WindowGroup  class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.87 1996-07-17 10:43:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.88 1996-07-18 11:39:11 cg Exp $'
 ! !
 WindowGroup initialize!