Fix previous change: Return in LicenceBox on startup crashed the system.
authorStefan Vogel <sv@exept.de>
Thu, 08 Aug 2002 15:07:10 +0200
changeset 3691 9427485e2507
parent 3690 54b3888560fe
child 3692 ee9adf79e07e
Fix previous change: Return in LicenceBox on startup crashed the system. Was soll eigentlich dieses Hardcopy-Zeug?
DeviceWorkstation.st
--- a/DeviceWorkstation.st	Thu Aug 08 13:07:14 2002 +0200
+++ b/DeviceWorkstation.st	Thu Aug 08 15:07:10 2002 +0200
@@ -3989,46 +3989,48 @@
     "/
     "/ ctrl-Esc gives up focus
     "/
-    untranslatedKey = #'Escape' ifTrue:[
-        (ctrlDown or:[metaDown]) ifTrue:[
-            self ungrabPointer.  
-            self ungrabKeyboard. 
-            self setInputFocusTo:nil 
-        ]
-    ].
-    (self translateKey:untranslatedKey forView:aView) = #'Hardcopy' ifTrue:[
-        [
-            Transcript topView application
-                saveScreenImage:(Image fromView:(aView topView) inset:0 grab:true) defaultName:'hardcopy'.
-        ] forkAt:Processor userSchedulingPriority + 1.
-        ^ self.
+    untranslatedKey == #Escape ifTrue:[
+	(ctrlDown or:[metaDown]) ifTrue:[
+	    self ungrabPointer.  
+	    self ungrabKeyboard. 
+	    self setInputFocusTo:nil 
+	]
     ].
 
     self modifierKeyProcessing:untranslatedKey down:true.
 
     aView isNil ifTrue:[
-        "/ event arrived, after I destroyed it myself
-        ^ self
-    ].
+	"/ event arrived, after I destroyed it myself
+	^ self
+    ].
+
+    xlatedKey := self translateKey:untranslatedKey forView:aView.
+    xlatedKey == #Hardcopy ifTrue:[
+	[
+	    Transcript topView application
+		saveScreenImage:(Image fromView:(aView topView) inset:0 grab:true) defaultName:'hardcopy'.
+	] forkAt:Processor userSchedulingPriority + 1.
+	^ self.
+    ].
+
     (sensor := aView sensor) notNil ifTrue:[
-        sensor keyPress:untranslatedKey x:x y:y view:aView
+	sensor keyPress:untranslatedKey x:x y:y view:aView
     ] ifFalse:[
-        aView shown ifTrue:[ "/ could be a late event arrival
-            "
-             if there is no sensor ...
-            "
-            xlatedKey := self translateKey:untranslatedKey forView:aView.
-            xlatedKey notNil ifTrue:[
-                aView
-                    dispatchEvent:#keyPress:x:y:
-                    arguments:(Array with:xlatedKey with:x with:y)
+	aView shown ifTrue:[ "/ could be a late event arrival
+	    "
+	     if there is no sensor ...
+	    "
+	    xlatedKey notNil ifTrue:[
+		aView
+		    dispatchEvent:#keyPress:x:y:
+		    arguments:(Array with:xlatedKey with:x with:y)
 
 "/                WindowEvent
 "/                  sendEvent:#keyPress:x:y:
 "/                  arguments:(Array with:xlatedKey with:x with:y)
 "/                  view:aView
-            ]
-        ]
+	    ]
+	]
     ]
 
     "Modified: / 20.5.1998 / 22:52:36 / cg"
@@ -4039,33 +4041,34 @@
 
     |xlatedKey sensor|
 
-    (self translateKey:untranslatedKey forView:aView) = #'Hardcopy' ifTrue:[^ self].
-
     self modifierKeyProcessing:untranslatedKey down:false.
 
     aView isNil ifTrue:[
-        "/ event arrived, after I destroyed it myself
-        ^ self
-    ].
+	"/ event arrived, after I destroyed it myself
+	^ self
+    ].
+
+    xlatedKey := self translateKey:untranslatedKey forView:aView.
+    xlatedKey == #Hardcopy ifTrue:[^ self].
+
     (sensor := aView sensor) notNil ifTrue:[
-        sensor keyRelease:untranslatedKey x:x y:y view:aView
+	sensor keyRelease:untranslatedKey x:x y:y view:aView
     ] ifFalse:[
-        aView shown ifTrue:[ "/ could be a late event arrival
-            "
-             if there is no sensor ...
-            "
-            xlatedKey := self translateKey:untranslatedKey forView:aView.
-            xlatedKey notNil ifTrue:[
-                aView
-                    dispatchEvent:#keyRelease:x:y:
-                    arguments:(Array with:xlatedKey with:x with:y)
+	aView shown ifTrue:[ "/ could be a late event arrival
+	    "
+	     if there is no sensor ...
+	    "
+	    xlatedKey notNil ifTrue:[
+		aView
+		    dispatchEvent:#keyRelease:x:y:
+		    arguments:(Array with:xlatedKey with:x with:y)
 
 "/                WindowEvent
 "/                    sendEvent:#keyRelease:x:y:
 "/                    arguments:(Array with:xlatedKey with:x with:y)
 "/                    view:aView
-            ]
-        ]
+	    ]
+	]
     ]
 
     "Modified: / 20.5.1998 / 22:52:52 / cg"
@@ -4259,28 +4262,28 @@
     dispatching ifFalse:[^ self].
 
     self == Display ifTrue:[
-        ExitOnLastClose == true ifFalse:[^ self].
+	ExitOnLastClose == true ifFalse:[^ self].
     ].
     exitOnLastClose == true ifFalse:[^ self].
 
     knownViews notNil ifTrue:[
-        (knownViews findFirst:[:slot | 
-                slot notNil 
-                and:[slot ~~ 0             "/ if there is no non-popup
-                and:[slot isRootView not   "/ non-dialog ...
-                and:[slot isTopView        "/ stop dispatching.
-                and:[slot isPopUpView not
-                and:[slot isModal not
-                "and:[slot realized]"]]]]]]) == 0 ifTrue:[
-            "/ my last view was closed
-            dispatching := false.
-            'DeviceWorkstation [info]: finished dispatch (last view closed)' infoPrintCR.
-            LastActiveScreen == self ifTrue:[
-                LastActiveScreen := nil.
-                LastActiveProcess := nil.
-            ].
-            eventSema signal.  "/ get dispatchLoop out of its wait...
-        ]
+	(knownViews findFirst:[:slot | 
+		slot notNil 
+		and:[slot ~~ 0             "/ if there is no non-popup
+		and:[slot isRootView not   "/ non-dialog ...
+		and:[slot isTopView        "/ stop dispatching.
+		and:[slot isPopUpView not
+		and:[slot isModal not
+		"and:[slot realized]"]]]]]]) == 0 ifTrue:[
+	    "/ my last view was closed
+	    dispatching := false.
+	    'DeviceWorkstation [info]: finished dispatch (last view closed)' infoPrintCR.
+	    LastActiveScreen == self ifTrue:[
+		LastActiveScreen := nil.
+		LastActiveProcess := nil.
+	    ].
+	    eventSema signal.  "/ get dispatchLoop out of its wait...
+	]
     ].
 
     "Modified: 19.9.1995 / 11:31:54 / claus"
@@ -4289,8 +4292,8 @@
 
 cleanupAfterDispatch
     eventSema notNil ifTrue:[
-        Processor disableSemaphore:eventSema.
-        eventSema := nil.
+	Processor disableSemaphore:eventSema.
+	eventSema := nil.
     ].
     dispatchProcess := nil.
 !
@@ -4318,17 +4321,17 @@
     "the actual event dispatching loop."
 
     [dispatching] whileTrue:[
-        AbortSignal handle:[:ex |
-            ex return
-        ] do:[
-            self eventPending ifFalse:[
-                Processor activeProcess setStateTo:#ioWait if:#active.
-                eventSema wait.
-            ].
-            dispatching ifTrue:[
-                self dispatchPendingEvents.
-            ].
-        ]
+	AbortSignal handle:[:ex |
+	    ex return
+	] do:[
+	    self eventPending ifFalse:[
+		Processor activeProcess setStateTo:#ioWait if:#active.
+		eventSema wait.
+	    ].
+	    dispatching ifTrue:[
+		self dispatchPendingEvents.
+	    ].
+	]
     ]
 !
 
@@ -4476,11 +4479,11 @@
     "/ is available or #eventPending returns true
 
     fd isNil ifTrue:[
-        "no fd -- so have to check for input also"
-        checkBlock := [self eventPending].
+	"no fd -- so have to check for input also"
+	checkBlock := [self eventPending].
     ] ifFalse:[
-        "there is a fd, so checkblock has to check only the internal queue"
-        checkBlock := [self eventQueued].
+	"there is a fd, so checkblock has to check only the internal queue"
+	checkBlock := [self eventQueued].
     ].
 
     "/ handle all incoming events from the device, sitting on a semaphore.
@@ -4494,24 +4497,24 @@
 
 
     DeviceIOErrorSignal handle:[:ex |
-        "/ test for handlerBlock until the signal is changed to be classed based.
-        ex signal handlerBlock notNil ifTrue:[
-            ex defaultAction.
-        ] ifFalse:[
-            'DeviceWorkstation [warning]: stop dispatch due to I/O error' errorPrintCR.
-            self brokenConnection.
-        ].
-        ex return.
+	"/ test for handlerBlock until the signal is changed to be classed based.
+	ex signal handlerBlock notNil ifTrue:[
+	    ex defaultAction.
+	] ifFalse:[
+	    'DeviceWorkstation [warning]: stop dispatch due to I/O error' errorPrintCR.
+	    self brokenConnection.
+	].
+	ex return.
     ] do:[
-        self initializeDeviceResources.
-        [
-            self dispatchLoop
-        ] ifCurtailed:[
-            self cleanupAfterDispatch.
-            self emergencyCloseConnection.
-        ].
-        self cleanupAfterDispatch.
-        self close.
+	self initializeDeviceResources.
+	[
+	    self dispatchLoop
+	] ifCurtailed:[
+	    self cleanupAfterDispatch.
+	    self emergencyCloseConnection.
+	].
+	self cleanupAfterDispatch.
+	self close.
     ].
 !
 
@@ -4527,7 +4530,7 @@
     dispatching := true.
 
     AllScreens isNil ifTrue:[
-        AllScreens := IdentitySet new:1
+	AllScreens := IdentitySet new:1
     ].
     AllScreens add:self.
 
@@ -4537,9 +4540,9 @@
     "/ give the process a nice name (for the processMonitor)
     "/
     (nm := self displayName) notNil ifTrue:[
-        nm := 'event dispatcher (' ,  nm , ')'.
+	nm := 'event dispatcher (' ,  nm , ')'.
     ] ifFalse:[
-        nm := 'event dispatcher'.
+	nm := 'event dispatcher'.
     ].
     p name:nm.
     p priority:(Processor userInterruptPriority).
@@ -6870,14 +6873,14 @@
     self setCopyBuffer:something.
     s := something.
     s isString ifFalse:[
-        s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false
+	s := s asStringWithCRsFrom:1 to:(s size) compressTabs:false withCR:false
     ].
 
     "/ for now - should add support to pass emphasis information too
     s := s string.
 
     (self setTextSelection:s owner:aView id) ifFalse:[
-        'DeviceWorkstation [warning]: could not copy selection to clipBoard' errorPrintCR.
+	'DeviceWorkstation [warning]: could not copy selection to clipBoard' errorPrintCR.
     ]
 ! !
 
@@ -7592,6 +7595,6 @@
 !DeviceWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.422 2002-08-08 11:07:14 tm Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.423 2002-08-08 13:07:10 stefan Exp $'
 ! !
 DeviceWorkstation initialize!