WindowGroup.st
changeset 7827 1e4843632745
parent 7825 07ea44507793
child 7841 e65319f4ac8d
child 8595 7f9b84978a2e
--- a/WindowGroup.st	Tue Jan 31 17:07:21 2017 +0100
+++ b/WindowGroup.st	Tue Jan 31 21:54:51 2017 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -1071,10 +1073,11 @@
      checkBlock is evaluated and the modal loop is left, 
      whenever false is returned."
 
-    ^ self startupModal:checkBlock forGroup:(WindowGroup activeGroup).
-
-    "Created: 10.12.1995 / 14:15:11 / cg"
-    "Modified: 20.8.1997 / 17:54:33 / cg"
+    ^ self startupModal:checkBlock forGroup:(self class activeGroup).
+
+    "Created: / 10-12-1995 / 14:15:11 / cg"
+    "Modified: / 20-08-1997 / 17:54:33 / cg"
+    "Modified: / 31-01-2017 / 20:43:37 / stefan"
 !
 
 startupModal:checkBlock forGroup:mainGroup
@@ -1175,7 +1178,7 @@
       the caller - which may make a difference in case of errors and/or
       blocking operations ...]"
 
-    |top nm dev devNm invokingApp|
+    |dev invokingApp|
 
     previousGroup := nil.
 
@@ -1188,30 +1191,28 @@
         "/ (well, not really forever ... ;-)
 
         myProcess := [
-            [
-                startupAction value.
-                self showWaitCursorWhenBusyForMillis:400.
-                self eventLoopWhile:[true] onLeave:[]
-            ] ensure:[
-                |dev w app|
-
-                (w := self mainView) notNil ifTrue:[
-                    (app := w application) notNil ifTrue:[
-                        app release
-                    ]
-                ].
-                (dev := self graphicsDevice) notNil ifTrue:[
-                    dev deviceIOErrorSignal handle:[:ex |
-                    ] do:[
-                        "/ just in case the view did not yet have a chance to 
-                        "/ shutDown properly (process killed in processMonitor)
-                        views notNil ifTrue:[
+                [
+                    startupAction value.
+                    self showWaitCursorWhenBusyForMillis:400.
+                    self eventLoopWhile:[true] onLeave:[]
+                ] ensure:[
+                    |dev w app|
+
+                    (w := self mainView) notNil ifTrue:[
+                        (app := w application) notNil ifTrue:[
+                            app release
+                        ]
+                    ].
+                    dev := self graphicsDevice.
+                    (dev notNil and:[views notNil]) ifTrue:[
+                        dev deviceIOErrorSignal catch:[
+                            "/ just in case the view did not yet have a chance to 
+                            "/ shutDown properly (process killed in processMonitor)
                             self closeDownViews
                         ]
                     ]
                 ]
-            ]
-        ] newProcess.
+            ] newProcess.
 
         self setProcessNameWithRedirectIndicator:''.
         myProcess priority:processPriority;
@@ -1236,17 +1237,17 @@
 
         "/ allow for the currently active application,
         "/ to hook on new-application process creation.
-        (invokingApp := WindowGroup activeMainApplication) notNil ifTrue:[
+        (invokingApp := self class activeMainApplication) notNil ifTrue:[
             invokingApp postApplicationProcessCreate:myProcess windowGroup:self.
         ].
-        top := nm := dev := devNm := invokingApp:= nil.  "/ to avoid dangling references via blocks home context.
+        dev := invokingApp:= nil.  "/ to avoid dangling references via blocks home context.
 
         myProcess resume.
     ]
 
-    "Modified: / 13-12-1995 / 14:04:53 / stefan"
     "Created: / 24-07-1997 / 12:52:04 / cg"
     "Modified: / 17-09-2007 / 10:59:34 / cg"
+    "Modified: / 31-01-2017 / 21:45:42 / stefan"
 !
 
 unhideTopViews
@@ -1373,9 +1374,7 @@
         ActivityNotifications send a #showActivity: if nonModal, 
         otherwise they are ignored."
 
-    |thisProcess signalsToHandle|
-
-    thisProcess := Processor activeProcess.
+    |signalsToHandle|
 
     signalsToHandle := SignalSet
                 with:LeaveSignal 
@@ -1390,7 +1389,7 @@
 
     WindowGroupQuerySignal answer:self do:[
         [
-            |p g s mainGroup mySema waitSema mainSema groupForSema|
+            |g s mainGroup mySema waitSema mainSema groupForSema|
 
             waitSema := mySema := mySensor eventSemaphore.
 
@@ -1477,7 +1476,7 @@
                     ].
                     ex proceedWith:nil.
                 ] do:[
-                    |dev gotSema mainView|
+                    |gotSema mainView|
 
                     (mainGroup notNil or:[mySensor hasEvents not]) ifTrue:[
                         waitSema isNil ifTrue:[
@@ -1500,11 +1499,7 @@
                                 self graphicsDevice flush.
                             ].
 
-                        self isModal ifTrue:[
-                            thisProcess setStateTo:#modalEventWait if:#active.
-                        ] ifFalse:[
-                            thisProcess setStateTo:#eventWait if:#active.
-                        ].
+                        Processor activeProcess setStateTo:(self isModal ifTrue:[#modalEventWait] ifFalse:[#eventWait]) if:#active.
 
                         "/ now, wait for an event to arrive
                         gotSema := waitSema wait.
@@ -1554,8 +1549,8 @@
         ] ensure:cleanupActions
     ]
 
-    "Modified: / 14-12-1995 / 11:12:24 / stefan"
     "Modified: / 06-07-2010 / 11:47:27 / cg"
+    "Modified (format): / 31-01-2017 / 20:43:00 / stefan"
 !
 
 executePostEventHooksFor:anEvent
@@ -1949,15 +1944,15 @@
      This is required after a scroll operation,
      to wait for either a noExpose or a real expose."
 
-    |event view sensor thisProcess|
+    |sensor|
 
     (sensor := mySensor) isNil ifTrue:[^ self].
     sensor damageCount == 0 ifTrue:[^ self].
 
-    thisProcess := Processor activeProcess.
-
     WindowGroupQuerySignal answer:self do:[
-        [true] whileTrue:[
+        |event view|
+
+        [
             "/ event := aView nextDamage.
             event := sensor nextExposeEventFor:someViewOrNil.
             event isNil ifTrue:[^ self].
@@ -1979,11 +1974,12 @@
                     self executePostEventHooksFor:event.
                 ]
             ]
-        ]
-    ]
-
-    "Created: / 2.7.1997 / 14:32:19 / cg"
-    "Modified: / 5.4.1998 / 11:35:43 / cg"
+        ] loop.
+    ].
+
+    "Created: / 02-07-1997 / 14:32:19 / cg"
+    "Modified: / 05-04-1998 / 11:35:43 / cg"
+    "Modified (format): / 31-01-2017 / 21:53:29 / stefan"
 !
 
 repairDamage
@@ -2900,15 +2896,14 @@
 !WindowGroup::WindowGroupQuery class methodsFor:'redefined answering'!
 
 answer:something do:action
-    |retVal|
-
-    [
+    ^ [
         WindowGroup flushCachedActiveGroup.
-        retVal := super answer:something do:action
+        super answer:something do:action
     ] ensure:[
         WindowGroup flushCachedActiveGroup
     ].
-    ^ retVal
+
+    "Modified: / 31-01-2017 / 20:28:14 / stefan"
 ! !
 
 !WindowGroup class methodsFor:'documentation'!