remember process which created a modal group,
authorClaus Gittinger <cg@exept.de>
Tue, 07 Jan 2003 13:55:27 +0100
changeset 3780 69a0a7142c48
parent 3779 84c9c261f510
child 3781 9404bb21b63f
remember process which created a modal group, to allow for CTRL-C to interrupt (sub-)processes which have opened a modal window.
WindowGroup.st
WindowSensor.st
--- a/WindowGroup.st	Wed Dec 18 10:22:39 2002 +0100
+++ b/WindowGroup.st	Tue Jan 07 13:55:27 2003 +0100
@@ -16,7 +16,8 @@
 	instanceVariableNames:'graphicsDevice views topViews myProcess mySensor isModal
 		previousGroup focusView focusSequence preEventHook postEventHook
 		pointerView isForModalSubview focusByTab groupHasFocus busyHook
-		busyHookTimeout inModalLoop preEventHooks postEventHooks'
+		busyHookTimeout inModalLoop preEventHooks postEventHooks
+		creatingProcess'
 	classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal
 		WindowGroupQuerySignal LastEventQuerySignal BusyHookTime'
 	poolDictionaries:''
@@ -445,6 +446,15 @@
 
 !WindowGroup methodsFor:'accessing'!
 
+creatingProcess
+    "return the process which created this group or nil.
+     Only returns non-nil for modal groups."
+
+    ^ creatingProcess
+
+    "Modified: / 17.8.1998 / 10:21:29 / cg"
+!
+
 device
     "return the device, we receive our events from"
 
@@ -932,9 +942,8 @@
 
 startupModal:checkBlock forGroup:mainGroup
     "startup the window-group in a modal loop 
-     (i.e. under the currently running process);
-     checkBlock is evaluated and loop is left, when false is
-     returned.
+     (i.e. under the currently running process - NOT creating a new process);
+     checkBlock is evaluated and loop is left, when false is returned.
      The mainGroup info is required to allow peeking into its
      event queue in order for its expose/redraws to be handled."
 
@@ -954,6 +963,10 @@
     ].
     isModal := true.
 
+    myProcess isNil ifTrue:[
+        creatingProcess := Processor activeProcess
+    ].
+
     mainGroup notNil ifTrue:[
         "/ tell the other group, that some modal dialog has started.
         mainGroup modalDialogStarts
@@ -2715,7 +2728,7 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.250 2002-12-10 15:59:34 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.251 2003-01-07 12:55:24 cg Exp $'
 ! !
 
 WindowGroup initialize!
--- a/WindowSensor.st	Wed Dec 18 10:22:39 2002 +0100
+++ b/WindowSensor.st	Tue Jan 07 13:55:27 2003 +0100
@@ -1478,6 +1478,9 @@
         group := aView windowGroup.
         group notNil ifTrue:[
             process := group process.
+            process isNil ifTrue:[
+                process := group creatingProcess
+            ].
             process notNil ifTrue:[
                 (xlatedKey == #UserAbort) ifTrue:[
                     process interruptWith:[:where | AbortSignal raise]
@@ -3095,7 +3098,7 @@
 !WindowSensor class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.207 2002-11-26 09:13:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.208 2003-01-07 12:55:27 cg Exp $'
 ! !
 
 WindowSensor initialize!