--- a/DeviceWorkstation.st Fri Mar 01 14:41:45 2019 +0100
+++ b/DeviceWorkstation.st Fri Mar 01 15:29:11 2019 +0100
@@ -345,39 +345,41 @@
"create local error signals; enable errorPrinting"
DeviceErrorSignal isNil ifTrue:[
- DeviceErrorSignal := (Signal new) mayProceed:true.
- DeviceErrorSignal notifierString:'device error'.
- DeviceErrorSignal nameClass:self message:#deviceErrorSignal.
-
- DeviceOpenErrorSignal := DeviceErrorSignal newSignalMayProceed:true.
- DeviceOpenErrorSignal nameClass:self message:#deviceOpenErrorSignal.
- DeviceOpenErrorSignal notifierString:'cannot open device'.
-
- DeviceIOErrorSignal := (Signal new) mayProceed:false.
- DeviceIOErrorSignal notifierString:'device IO error'.
- DeviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal.
-
- DeviceIOTimeoutErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false.
- DeviceIOTimeoutErrorSignal notifierString:'device IO timeout error'.
- DeviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
-
- CurrentScreenQuerySignal := QuerySignal new.
- CurrentScreenQuerySignal nameClass:self message:#currentScreenQuerySignal.
- CurrentScreenQuerySignal notifierString:'asking for current screen'.
-
- DrawingOnClosedDeviceSignal := DeviceErrorSignal newSignalMayProceed:true.
- DrawingOnClosedDeviceSignal nameClass:self message:#drawingOnClosedDeviceSignal.
- DrawingOnClosedDeviceSignal notifierString:'drawing attempt on closed graphics device'.
+ DeviceErrorSignal := (Signal new) mayProceed:true.
+ DeviceErrorSignal notifierString:'device error'.
+ DeviceErrorSignal nameClass:self message:#deviceErrorSignal.
+
+ DeviceOpenErrorSignal := DeviceErrorSignal newSignalMayProceed:true.
+ DeviceOpenErrorSignal nameClass:self message:#deviceOpenErrorSignal.
+ DeviceOpenErrorSignal notifierString:'cannot open device'.
+
+ DeviceIOErrorSignal := (Signal new) mayProceed:false.
+ DeviceIOErrorSignal notifierString:'device IO error'.
+ DeviceIOErrorSignal nameClass:self message:#deviceIOErrorSignal.
+
+ DeviceIOTimeoutErrorSignal := DeviceIOErrorSignal newSignalMayProceed:false.
+ DeviceIOTimeoutErrorSignal notifierString:'device IO timeout error'.
+ DeviceIOTimeoutErrorSignal nameClass:self message:#deviceIOTimeoutErrorSignal.
+
+ CurrentScreenQuerySignal := QuerySignal new.
+ CurrentScreenQuerySignal nameClass:self message:#currentScreenQuerySignal.
+ CurrentScreenQuerySignal notifierString:'asking for current screen'.
+
+ DrawingOnClosedDeviceSignal := DeviceErrorSignal newSignalMayProceed:true.
+ DrawingOnClosedDeviceSignal nameClass:self message:#drawingOnClosedDeviceSignal.
+ DrawingOnClosedDeviceSignal notifierString:'drawing attempt on closed graphics device'.
].
ErrorPrinting := true.
+ ExitOnLastClose := false.
self initializeConstants.
"/ for ST80 compatibility ...
Screen := self.
- "Modified: 3.8.1997 / 18:14:58 / cg"
+ "Modified: / 03-08-1997 / 18:14:58 / cg"
+ "Modified: / 01-03-2019 / 11:48:55 / Stefan Vogel"
!
initializeConstants
@@ -4498,11 +4500,11 @@
allViewsDo:aBlock
"evaluate the argument, aBlock for all of my known views.
- Warning do not use this to remove view
+ Warning: do not use this to remove a view
(never remove elements from an enumerated collection)"
knownViews notNil ifTrue:[
- knownViews do:aBlock
+ knownViews do:aBlock
].
"
@@ -4518,7 +4520,8 @@
Display allViewsDo:[:v | v initStyle. v redraw]
"
- "Modified: / 19.1.2000 / 10:13:32 / cg"
+ "Modified: / 19-01-2000 / 10:13:32 / cg"
+ "Modified (comment): / 01-03-2019 / 14:42:38 / Stefan Vogel"
! !
!DeviceWorkstation methodsFor:'error handling'!
@@ -4926,29 +4929,32 @@
dispatching ifFalse:[^ self].
- self == Display ifTrue:[
- ExitOnLastClose == true ifFalse:[^ self].
- ].
- exitOnLastClose == true ifFalse:[^ self].
-
- knownViews notNil ifTrue:[
- "/ if there is no non-popup topview, stop dispatching
- (knownViews contains:[:slot |
- slot notNil
- and:[(self viewIsRelevantInCheckForEndOfDispatch:slot)
- and:[true "slot isModal not"
- "and:[slot realized]"]]]
- ) ifFalse:[
- "/ my last view was closed
- dispatching := false.
- Logger info:'finished dispatch (last view closed): %1' with:self.
- self releaseDeviceResources.
- eventSema notNil ifTrue:[eventSema signal]. "/ get dispatchLoop out of its wait...
- ]
- ].
-
- "Modified: 19.9.1995 / 11:31:54 / claus"
- "Modified: 18.3.1997 / 10:42:11 / cg"
+ (self == Display and:[ExitOnLastClose ~~ true]) ifTrue:[
+ ^ self.
+ ].
+ exitOnLastClose ~~ true ifTrue:[^ self].
+
+ knownViews isNil ifTrue:[
+ "if knownViews is nil, no view has ever been opened, so simply return"
+ ^ self.
+ ].
+
+ "if knownViews is empty, there has been an open view which is gone.
+ If there is no non-popup topview, stop dispatching"
+ (knownViews contains:[:eachKnownView |
+ eachKnownView notNil
+ and:[self viewIsRelevantInCheckForEndOfDispatch:eachKnownView]
+ ]) ifFalse:[
+ "/ my last view was closed
+ dispatching := false.
+ Logger info:'finished dispatch (last view closed): %1' with:self.
+ self releaseDeviceResources.
+ eventSema notNil ifTrue:[eventSema signal]. "/ get dispatchLoop out of its wait...
+ ]
+
+ "Modified: / 19-09-1995 / 11:31:54 / claus"
+ "Modified: / 18-03-1997 / 10:42:11 / cg"
+ "Modified (format): / 01-03-2019 / 12:05:58 / Stefan Vogel"
!
cleanupAfterDispatch
@@ -5289,8 +5295,10 @@
exitOnLastClose flag is set."
^ aView isRootView not
- and:[ aView isTopView
- and:[ aView isPopUpView not ]]
+ and:[ aView isTopView
+ and:[ aView isPopUpView not ]]
+
+ "Modified (format): / 01-03-2019 / 11:46:12 / Stefan Vogel"
! !
!DeviceWorkstation methodsFor:'event sending'!
@@ -6183,7 +6191,9 @@
sav := exitOnLastClose.
exitOnLastClose := false.
- aBlock ensure:[ exitOnLastClose := sav ].
+ ^ aBlock ensure:[ exitOnLastClose := sav ].
+
+ "Modified: / 01-03-2019 / 15:05:36 / Stefan Vogel"
! !
!DeviceWorkstation methodsFor:'initialization & release'!
@@ -7995,15 +8005,12 @@
the view's id (which is passed along with the devices event) quickly."
knownViews isNil ifTrue:[
- knownViews := WeakValueDictionary new:500.
+ knownViews := WeakValueDictionary new:1500.
].
knownViews at:aWindowID put:aView.
-"/ dispatching ifFalse:[
-"/ self startDispatch
-"/ ].
-
- "Modified: 2.4.1997 / 19:15:46 / cg"
+ "Modified: / 02-04-1997 / 19:15:46 / cg"
+ "Modified: / 01-03-2019 / 15:16:39 / Stefan Vogel"
!
initializeTopViewHookFor:aView
@@ -8022,26 +8029,32 @@
|removedView|
- lastId := nil.
- lastView := nil.
-
- knownViews notNil ifTrue:[
- aViewId notNil ifTrue:[
- removedView := knownViews removeKey:aViewId ifAbsent:[].
- focusView == removedView ifTrue:[
- focusView := nil
- ].
- ] ifFalse:[
- focusView == aView ifTrue:[
- focusView := nil
- ].
- knownViews removeIdentityValue:aView ifAbsent:[].
- ].
- self checkForEndOfDispatch.
- ].
-
- "Created: 22.3.1997 / 14:56:20 / cg"
- "Modified: 27.3.1997 / 17:13:28 / cg"
+ knownViews isNil ifTrue:[
+ ^ self.
+ ].
+
+ aViewId notNil ifTrue:[
+ lastId = aViewId ifTrue:[
+ lastId := nil.
+ lastView := nil.
+ ].
+ removedView := knownViews removeKey:aViewId ifAbsent:[].
+ ] ifFalse:[
+ lastView == aView ifTrue:[
+ lastId := nil.
+ lastView := nil.
+ ].
+ removedView := aView.
+ knownViews removeIdentityValue:aView ifAbsent:[].
+ ].
+ focusView == removedView ifTrue:[
+ focusView := nil.
+ ].
+ self checkForEndOfDispatch.
+
+ "Created: / 22-03-1997 / 14:56:20 / cg"
+ "Modified: / 27-03-1997 / 17:13:28 / cg"
+ "Modified: / 01-03-2019 / 15:19:24 / Stefan Vogel"
!
viewFromId:aWindowID