WindowSensor.st
changeset 2704 1698640c9da6
parent 2699 01594e76fc92
child 2708 855835147902
--- a/WindowSensor.st	Fri May 21 16:03:09 1999 +0200
+++ b/WindowSensor.st	Fri May 21 16:33:46 1999 +0200
@@ -2557,11 +2557,10 @@
      in future versions. (or the new device may simulate the arrival of
      such an event)"
 
-    |blocked lostExpose device stopPoll endPollTime pollDelay|
+    |blocked lostExpose device stopPoll endPollTime pollDelay pollDelay2|
 
     device := aView graphicsDevice.
 
-    "/ this is only needed for X ...
     device scrollsAsynchronous ifFalse:[
         gotExpose remove:aView ifAbsent:nil.
         catchExpose remove:aView ifAbsent:nil.
@@ -2571,12 +2570,19 @@
     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:[
-            device platformName = 'WIN32' ifTrue:[
-                pollDelay := 1.
-            ] ifFalse:[
-                pollDelay := 3.
-            ].
             endPollTime := AbsoluteTime now addSeconds:pollDelay.
             stopPoll := false.
 
@@ -2605,22 +2611,20 @@
                  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 15 seconds.
+                 if the event does not arrive after a few seconds.
                 "
-                (exposeEventSemaphore waitWithTimeout:(1 * lostExpose)) isNil ifTrue:[
+                (exposeEventSemaphore waitWithTimeout:(pollDelay2 * lostExpose)) isNil ifTrue:[
                     device flush.         "/ we are paranoid
-                    lostExpose == 1 ifTrue:[
-                        "
-                         you can put a comment around the following line, 
-                         if you don't like the message ...
-                        "
-                        ('WindowSensor [info]: late expose event (' , aView printString , ')') infoPrintCR.
-                    ] ifFalse:[
-                        'WindowSensor [warning]: lost expose event' errorPrintCR.
-                    ].
                     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.
@@ -2640,7 +2644,7 @@
     ].
 
     "Modified: / 20.2.1997 / 09:24:31 / stefan"
-    "Modified: / 9.1.1999 / 01:58:56 / cg"
+    "Modified: / 21.5.1999 / 16:27:10 / cg"
 !
 
 waitNoButton
@@ -2658,6 +2662,6 @@
 !WindowSensor class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.153 1999-05-21 11:22:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.154 1999-05-21 14:33:46 cg Exp $'
 ! !
 WindowSensor initialize!