WindowSensor.st
changeset 90 b1f1d7fc96eb
parent 85 32687feafcc1
child 103 6156d12a414d
--- a/WindowSensor.st	Mon Feb 06 01:38:04 1995 +0100
+++ b/WindowSensor.st	Mon Feb 06 01:40:27 1995 +0100
@@ -25,7 +25,7 @@
 COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.15 1994-11-22 23:09:14 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.16 1995-02-06 00:39:45 claus Exp $
 '!
 
 !WindowSensor class methodsFor:'documentation'!
@@ -46,7 +46,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.15 1994-11-22 23:09:14 claus Exp $
+$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.16 1995-02-06 00:39:45 claus Exp $
 "
 !
 
@@ -244,9 +244,17 @@
 waitForExposeFor:aView
     "wait until a noExpose arrives (after a bitblt)"
 
-"/    aView device synchronizeOutput.
+    |active|
 
-    Processor activePriority < Processor userInterruptPriority  ifTrue:[
+    Processor activeProcessIsSystemProcess ifTrue:[
+	"
+	 cannot really suspend, if its a systemProcess
+	"
+	[gotExpose] whileFalse:[
+	    aView device dispatchExposeEventFor:aView id.
+	    Processor yield.
+	]
+    ] ifFalse:[
 	[gotExpose] whileFalse:[
 	    "
 	     just in case we have a (network or software) problem ...
@@ -257,6 +265,7 @@
 	    "
 	    (exposeEventSemaphore waitWithTimeout:5) ifFalse:[
 		aView device synchronizeOutput.
+		'WSENSOR: late expose event' errorPrintNL.
 		(exposeEventSemaphore waitWithTimeout:10) ifFalse:[
 		    'WSENSOR: lost expose event again - ignore' errorPrintNL.
 		].
@@ -264,7 +273,6 @@
 		 you can put a comment around the following line, if you dont
 		 like the message ...
 		"
-		'WSENSOR: late expose event' errorPrintNL.
 		gotExpose := true.
 		^ self
 	    ]
@@ -277,11 +285,6 @@
 	gotOtherEvent ifTrue:[
 	    eventSemaphore signal
 	].
-    ] ifFalse:[    
-	[gotExpose] whileFalse:[
-	    aView device dispatchExposeEventFor:aView id.
-	    Processor yield.
-	]
     ].
     catchExpose := false
 !
@@ -399,6 +402,40 @@
     ].
 ! !
 
+!WindowSensor methodsFor:'queries '!
+
+hasDamageFor:aView 
+    "return true, if any exposure events are pending for aView"
+
+    damage size ~~ 0 ifTrue:[
+	damage do:[:aDamage |
+	    aDamage notNil ifTrue:[
+		aDamage view == aView ifTrue:[^ true].
+	    ].
+	]
+    ].
+    ^ false
+!
+
+hasDamage 
+    "return true, if any exposure events are pending"
+
+    ^ damage size ~~ 0
+!
+
+hasEvents 
+    "return true, if any mouse/keyboard events are pending"
+
+    ^ mouseAndKeyboard size ~~ 0
+!
+
+eventPending
+    "return true, if either damage or events are pending"
+
+    mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
+    ^ damage size ~~ 0
+! !
+
 !WindowSensor methodsFor:'event processing'!
 
 notifyEventArrival
@@ -418,25 +455,6 @@
     ]
 !
 
-hasDamage 
-    "return true, if any exposure events are pending"
-
-    ^ damage size ~~ 0
-!
-
-hasEvents 
-    "return true, if any mouse/keyboard events are pending"
-
-    ^ mouseAndKeyboard size ~~ 0
-!
-
-eventPending
-    "return true, if either damage or events are pending"
-
-    mouseAndKeyboard size ~~ 0 ifTrue:[^ true].
-    ^ damage size ~~ 0
-!
-
 exposeX:left y:top width:width height:height view:aView
     "an expose event arrived - this is sent from the device (Display)"
 
@@ -448,8 +466,6 @@
     "an noexpose event arrived - this is sent from the device (Display)"
 
     gotExpose := true.
-"/    catchExpose := false.
-
     exposeEventSemaphore notNil ifTrue:[
 	exposeEventSemaphore signal
     ]
@@ -569,7 +585,7 @@
 
     ((xlatedKey == #UserInterrupt) and:[ControlCEnabled]) ifTrue:[
 	"
-	 Special handling for Cntl-C: interrupt the underlying process.
+	 Special handling for Ctrl-C: interrupt the underlying process.
 
 	 cannot halt here (this would stop the event-dispatcher),
 	 but instead interrupt the underlying process and have it