WindowSensor.st
changeset 2820 a3db9137637b
parent 2810 f2a85b827478
child 2877 f5a9a55ca76f
--- a/WindowSensor.st	Thu Aug 12 13:44:11 1999 +0200
+++ b/WindowSensor.st	Thu Aug 12 13:45:44 1999 +0200
@@ -1039,17 +1039,16 @@
     "/ this is also a possible response to a scroll operation
     "/ (if an expose is pending)
 
+    self addDamage:(left @ top extent:width @ height) view:aView wakeup:false.
     final ifTrue:[
-	(catchExpose includes:aView) ifTrue:[
-	    gotExpose add:aView.
-	    exposeEventSemaphore signalForAll
-	] ifFalse:[
-	    'WSensor [warning]: got exposeEvent for non-catching view:' infoPrint. aView infoPrintCR
-	]
+        (catchExpose includes:aView) ifTrue:[
+            gotExpose add:aView.
+            exposeEventSemaphore signalForAll
+        ] ifFalse:[
+            'WSensor [warning]: got exposeEvent for non-catching view:' infoPrint. aView infoPrintCR
+        ]
     ].
 
-    self addDamage:(left @ top extent:width @ height) view:aView wakeup:false.
-
     "Modified: 23.1.1997 / 22:15:53 / cg"
 !
 
@@ -2588,85 +2587,83 @@
     device := aView graphicsDevice.
 
     device scrollsAsynchronous ifFalse:[
-	gotExpose remove:aView ifAbsent:nil.
-	catchExpose remove:aView ifAbsent:nil.
-	^ self
+        gotExpose remove:aView ifAbsent:nil.
+        catchExpose remove:aView ifAbsent:nil.
+        ^ self
     ].
 
     blocked := true.
     [
-	aView flush.
-
-	device platformName = 'WIN32' ifTrue:[
-	    "/ since this is definitely a local display,
-	    "/ there is no need for a long timeOut
-	    "/ (it should arrive fast)
-	    pollDelay := 0.2.
-	    pollDelay2 := 0.1.
-	] ifFalse:[
-	    pollDelay := 3.
-	    pollDelay2 := 1.
-	].
-
-	Processor activeProcessIsSystemProcess ifTrue:[
-	    endPollTime := AbsoluteTime now addSeconds:pollDelay.
-	    stopPoll := false.
-
-	    "/
-	    "/ cannot really suspend, if its a systemProcess
-	    "/ must poll for the event
-	    "/
-	    [(gotExpose includes:aView) or:[stopPoll]] whileFalse:[
-		(device exposeEventPendingFor:aView id withSync:true) ifTrue:[
-		    device dispatchExposeEventFor:aView id.
-		].
-		stopPoll := (AbsoluteTime now > endPollTime).
-		Processor yield.
-	    ]
-	] ifFalse:[
-	    lostExpose := 1.
-	    "
-	      block interrupt here, to resolve race between
-	      testing gotExpose and the semaphore, which is woken up
-	      with #signalForAll.
-	    "
-	    blocked := OperatingSystem blockInterrupts.
-	    [ (gotExpose includes:aView) or:[lostExpose > 2] ] whileFalse:[
-		"
-		 just in case we have a (network or software) problem ...
-		 explanation: it may happen, that an expose event is totally
-		 lost - for example, if the network breaks down.
-		 To not block forever, we wait with a timeout, to get out of here
-		 if the event does not arrive after a few seconds.
-		"
-		(exposeEventSemaphore waitWithTimeout:(pollDelay2 * lostExpose)) isNil ifTrue:[
-		    device flush.         "/ we are paranoid
-		    lostExpose := lostExpose + 1.
-		].
-	    ].
-	    (gotExpose includes:aView) ifFalse:[
-		('WindowSensor [warning]: lost expose event (' , aView printString , ')') errorPrintCR.
-	    ] ifTrue:[
-		lostExpose > 1 ifTrue:[
-		    ('WindowSensor [info]: late expose event (' , aView printString , ')') infoPrintCR.
-		]
-	    ]
-	].
+        aView flush.
+
+        device platformName = 'WIN32' ifTrue:[
+            "/ since this is definitely a local display,
+            "/ there is no need for a long timeOut
+            "/ (it should arrive fast)
+            pollDelay := 0.2.
+            pollDelay2 := 0.1.
+        ] ifFalse:[
+            pollDelay := 3.
+            pollDelay2 := 1.
+        ].
+
+        Processor activeProcessIsSystemProcess ifTrue:[
+            endPollTime := AbsoluteTime now addSeconds:pollDelay.
+            stopPoll := false.
+
+            "/
+            "/ cannot really suspend, if its a systemProcess
+            "/ must poll for the event
+            "/
+            [(gotExpose includes:aView) or:[stopPoll]] whileFalse:[
+                (device exposeEventPendingFor:aView id withSync:true) ifTrue:[
+                    device dispatchExposeEventFor:aView id.
+                ].
+                stopPoll := (AbsoluteTime now > endPollTime).
+                Processor yield.
+            ]
+        ] ifFalse:[
+            lostExpose := 1.
+            "
+              block interrupt here, to resolve race between
+              testing gotExpose and the semaphore, which is woken up
+              with #signalForAll.
+            "
+            blocked := OperatingSystem blockInterrupts.
+            [ (gotExpose includes:aView) or:[lostExpose > 2] ] whileFalse:[
+                "
+                 just in case we have a (network or software) problem ...
+                 explanation: it may happen, that an expose event is totally
+                 lost - for example, if the network breaks down.
+                 To not block forever, we wait with a timeout, to get out of here
+                 if the event does not arrive after a few seconds.
+                "
+                (exposeEventSemaphore waitWithTimeout:(pollDelay2 * lostExpose)) isNil ifTrue:[
+                    device flush.         "/ we are paranoid
+                    lostExpose := lostExpose + 1.
+                ].
+            ].
+            (gotExpose includes:aView) ifFalse:[
+                ('WindowSensor [warning]: lost expose event (' , aView printString , ')') errorPrintCR.
+            ] ifTrue:[
+                lostExpose > 1 ifTrue:[
+                    ('WindowSensor [info]: late expose event (' , aView printString , ')') infoPrintCR.
+                ]
+            ]
+        ].
     ] valueNowOrOnUnwindDo:[
-	gotExpose remove:aView ifAbsent:nil.
-	catchExpose remove:aView ifAbsent:nil.
-	blocked ifFalse:[
-	    OperatingSystem unblockInterrupts.
-	].
-
-	"/
-	"/ other incoming events have been ignored during the wait.
-	"/ Now handle those ...
-	"/
-	(gotOtherEvent includes:aView) ifTrue:[
-	    gotOtherEvent remove:aView ifAbsent:nil.
-	].
-	eventSemaphore signalOnce
+        gotExpose remove:aView ifAbsent:nil.
+        catchExpose remove:aView ifAbsent:nil.
+        gotOtherEvent remove:aView ifAbsent:nil.
+        blocked ifFalse:[
+            OperatingSystem unblockInterrupts.
+        ].
+
+        "/
+        "/ other incoming events have been ignored during the wait.
+        "/ Now handle those ...
+        "/
+        eventSemaphore signalOnce
     ].
 
     "Modified: / 20.2.1997 / 09:24:31 / stefan"
@@ -2688,6 +2685,6 @@
 !WindowSensor class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.162 1999-07-26 07:32:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.163 1999-08-12 11:45:44 cg Exp $'
 ! !
 WindowSensor initialize!