WindowGroup.st
changeset 7676 4b802958bc37
parent 7672 ef23e698c67e
child 7678 46ad5aafe09e
--- a/WindowGroup.st	Fri Nov 11 23:46:05 2016 +0100
+++ b/WindowGroup.st	Mon Nov 14 10:27:33 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -19,7 +21,8 @@
 		pointerView isForModalSubview focusByTab groupHasFocus busyHook
 		busyHookTimeout inModalLoop isDebugged preEventHooks
 		postEventHooks creatingProcess traceEvents processPriority
-		inWithCursorDoBlock doNotCloseOnAbortSignal previousFocusView'
+		inWithCursorDoBlock doNotCloseOnAbortSignal previousFocusView
+		modalGroup'
 	classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal
 		WindowGroupQuerySignal LastEventQuerySignal BusyHookTime'
 	poolDictionaries:''
@@ -159,16 +162,20 @@
 
         isModal                 true if this is for a modal box; i.e. running a separate
                                 modal event loop on top of another window group.
-                                Those execute in the same process as the underlying group
+                                Those modal groups execute in the same process as the underlying group
 
         inModalLoop             true if this group's event processing is currently suspended
                                 because I have opened a modal window (with its own 'isModal'
                                 group) which handles events for a while.
 
+        modalGroup              non-nil windowGroup which is my modal windowGroup, if I am
+                                in a modal loop. I.e. the group which has been started by me and
+                                which has taken control.
+
+        previousGroup           if modal, the group that started this one (might be another modal one)
+
         isDebugged              true if a debugger sits on top of me
 
-        previousGroup           if modal, the group that started this one
-
         focusView               the one that has the keyboard focus (or nil)
 
         focusByTab              if focus came via tabbing 
@@ -586,7 +593,10 @@
     "return true, if the receiver has given up control to some other modal windowGroup
      (i.e. if it has popped up a modal dialog or a popUpMenu)"
 
+    "/ ^ modalGroup notNil.
     ^ inModalLoop ? false
+
+    "Modified: / 13-11-2016 / 22:59:29 / cg"
 !
 
 isModal
@@ -962,13 +972,20 @@
     "invoked, when a modal dialog is closed"
 
     inModalLoop := false.
+    modalGroup := nil.
+
+    "Modified: / 13-11-2016 / 22:59:11 / cg"
 !
 
-modalDialogStarts
+modalDialogStarts:aModalGroup
     "invoked, when a modal dialog is opened"
 
     self processEvents. "/ process any bufferd message send events
     inModalLoop := true.
+    modalGroup := aModalGroup.
+
+    "Created: / 13-11-2016 / 17:18:31 / cg"
+    "Modified: / 13-11-2016 / 22:58:57 / cg"
 !
 
 realizeTopViews
@@ -1094,13 +1111,11 @@
 
     mainGroup notNil ifTrue:[
         "/ tell the other group, that some modal dialog has started.
-        mainGroup modalDialogStarts
+        mainGroup modalDialogStarts:self.
     ].
     [
         self realizeTopViews.
-        self 
-            eventLoopWhile:checkBlock 
-            onLeave:[]
+        self eventLoopWhile:checkBlock onLeave:[]
     ] ensure:[
         mainGroup notNil ifTrue:[
             "/ tell the other group, that some modal dialog has closed down.
@@ -1137,8 +1152,9 @@
     prevActivePointerGrab notNil ifTrue:[ device grabPointerInView:prevActivePointerGrab ].
     prevActiveKeyboardGrab notNil ifTrue:[ device grabKeyboardInView:prevActiveKeyboardGrab ].
 
-    "Created: 10.12.1995 / 14:14:26 / cg"
-    "Modified: 20.8.1997 / 18:12:20 / cg"
+    "Created: / 10-12-1995 / 14:14:26 / cg"
+    "Modified: / 13-11-2016 / 17:19:16 / cg"
+    "Modified (format): / 14-11-2016 / 10:24:03 / cg"
 !
 
 startupWith:startupAction
@@ -2659,21 +2675,25 @@
 !WindowGroup methodsFor:'special-accessing'!
 
 isForModalSubview 
-    "special for windowgroups for modal subviews.
+    "special for windowgroup with modal subviews.
      These must be flagged specially to avoid the views being reassigned
      to the maingroup.
      This is a private interface to the SimpleView class"
 
     ^ isForModalSubview
+
+    "Modified (comment): / 13-11-2016 / 17:09:18 / cg"
 !
 
 isForModalSubview:aBoolean
-    "special for windowgroups for modal subviews.
+    "special for windowgroups with modal subviews.
      These must be flagged specially to avoid the views being reassigned
      to the maingroup.
      This is a private interface to the SimpleView class"
 
     isForModalSubview := aBoolean
+
+    "Modified (comment): / 13-11-2016 / 17:09:22 / cg"
 !
 
 setModal:aBoolean