changed: #startupModal:forGroup:
authorClaus Gittinger <cg@exept.de>
Mon, 02 Nov 2009 11:35:32 +0100
changeset 5445 eb5e6920f2da
parent 5444 191f0a6f82e3
child 5446 bbc0ce2a8520
changed: #startupModal:forGroup: ensure isModal is cleared after a modal loop.
WindowGroup.st
--- a/WindowGroup.st	Fri Oct 30 19:33:03 2009 +0100
+++ b/WindowGroup.st	Mon Nov 02 11:35:32 2009 +0100
@@ -986,8 +986,9 @@
     |prevActiveKeyboardGrab prevActivePointerGrab prevFocus device tops prevGroup
      oldFocusScheme returnFocus|
 
-returnFocus := false.
-oldFocusScheme := false.
+    "/ experimental (but seem to work fine...)
+    returnFocus := false.
+    oldFocusScheme := false.
 
     "set previousGroup to the main (non-modal) group"
 
@@ -1006,47 +1007,53 @@
         creatingProcess := Processor activeProcess
     ].
 
+    oldFocusScheme ifTrue:[
+        previousGroup notNil ifTrue:[
+            prevFocus := previousGroup focusView.
+        ].
+    ].
+
     mainGroup notNil ifTrue:[
         "/ tell the other group, that some modal dialog has started.
         mainGroup modalDialogStarts
     ].
-
-oldFocusScheme ifTrue:[
-    previousGroup notNil ifTrue:[
-        prevFocus := previousGroup focusView.
+    [
+        WindowGroupQuerySignal answer:self do:[
+            LastActiveGroup := nil.
+
+            self realizeTopViews.
+            self 
+                eventLoopWhile:checkBlock 
+                onLeave:[]
+        ].
+    ] ensure:[
+        mainGroup notNil ifTrue:[
+            "/ tell the other group, that some modal dialog has closed down.
+            mainGroup modalDialogFinished
+        ]
     ].
-].
-
-    WindowGroupQuerySignal answer:self do:[
-        LastActiveGroup := nil.
-
-        self realizeTopViews.
-        self 
-            eventLoopWhile:checkBlock 
-            onLeave:[]
-    ].
-
-returnFocus ifTrue:[
-    "/ restore current grab, in case was opened by
-    "/ a popup (such as an extendedComboBox) ...
-    mainGroup notNil ifTrue:[
-        (prevGroup isModal or:[prevGroup isPopUp]) ifTrue:[
-            "
-             return the input focus to the previously active group's top.
-            "
-            tops := prevGroup topViews.
-            tops notEmptyOrNil ifTrue:[
-                tops first getKeyboardFocus.
+
+    returnFocus ifTrue:[
+        "/ restore current grab, in case was opened by
+        "/ a popup (such as an extendedComboBox) ...
+        mainGroup notNil ifTrue:[
+            (prevGroup isModal or:[prevGroup isPopUp]) ifTrue:[
+                "
+                 return the input focus to the previously active group's top.
+                "
+                tops := prevGroup topViews.
+                tops notEmptyOrNil ifTrue:[
+                    tops first getKeyboardFocus.
+                ].
             ].
         ].
     ].
-].
-
-oldFocusScheme ifFalse:[
-    previousGroup notNil ifTrue:[ 
-        prevFocus := previousGroup focusView.
+
+    oldFocusScheme ifFalse:[
+        previousGroup notNil ifTrue:[ 
+            prevFocus := previousGroup focusView.
+        ].
     ].
-].
 
     prevFocus notNil ifTrue:[ 
         previousGroup focusView requestFocus 
@@ -1055,11 +1062,6 @@
     prevActivePointerGrab notNil ifTrue:[ device grabPointerInView:prevActivePointerGrab ].
     prevActiveKeyboardGrab notNil ifTrue:[ device grabKeyboardInView:prevActiveKeyboardGrab ].
 
-    mainGroup notNil ifTrue:[
-        "/ tell the other group, that some modal dialog has closed down.
-        mainGroup modalDialogFinished
-    ]
-
     "Created: 10.12.1995 / 14:14:26 / cg"
     "Modified: 20.8.1997 / 18:12:20 / cg"
 !
@@ -2722,11 +2724,11 @@
 !WindowGroup class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.304 2009-10-12 12:48:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.305 2009-11-02 10:35:32 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.304 2009-10-12 12:48:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.305 2009-11-02 10:35:32 cg Exp $'
 ! !
 
 WindowGroup initialize!