WindowSensor.st
changeset 4052 5cd7eef42703
parent 4051 be45b140e486
child 4053 fa961bb998de
--- a/WindowSensor.st	Fri Feb 27 11:48:02 2004 +0100
+++ b/WindowSensor.st	Fri Feb 27 12:14:11 2004 +0100
@@ -1943,23 +1943,19 @@
 basicAddDamage:newRectangle view:aView
     "{ Pragma: +optSpeed }"
 
-    "Add newRectangle to the damage list.
-     Try to merge incoming rectangles with the existing damage rectangles.
-     Incoming rectangles which are completely contained in any existing damage rect are ignored,
-     any existing damage rectangle which is completely contained in the incoming rectangle
-     is replaced.
-     Returns true, if a new event has been added to the queue, false if it
-     was optimized away."
-
-    |newEvent r fullRedraw aDamageEvent 
-     nDamagesForView bounds areaOfIndividualRects thisRectangle
-     mergedLeft mergedRight mergedTop mergedBottom
-     sz                "{ Class: SmallInteger }"
-     updateRegion oldDamageEvent oldDamageEventIndex anyOtherEventPending|
+    "Add newRectangle to the views update region.
+     Must be careful, if the damage queue contains an event pattern such as:
+        damage  map     
+     in this case, a new damage event is required to be added AFTER the map event,
+     otherwise, the newRectangle will be processed in a state where the map has not yet been
+     processed and the view thinks it can be ignored.
+     In this case, the damage event is re-added at the end of the queue."
+
+    |sz  "{ Class: SmallInteger }" 
+     aDamageEvent oldDamageEvent oldDamageEventIndex anyOtherEventPending|
 
     "/ NEWDAMAGE handling - experimental;
     "/ comment these lines if you encounter trouble.
-    (aView addUpdateRectangle:newRectangle) ifFalse:[^ false].
     sz := damage size.
 
     oldDamageEventIndex := nil.
@@ -1986,16 +1982,30 @@
         "/ Therefore, we clear the old damage event and add a new one at the end,
         "/ so that the damages will be processed AFTER the mapEvent has been processed.
         anyOtherEventPending ifFalse:[
-            ^ true
+            ^ aView addUpdateRectangle:newRectangle.
         ].
         damage at:oldDamageEventIndex put:nil.
         damage add:oldDamageEvent.
+        aView addUpdateRectangle:newRectangle.
         ^ true
     ].
 
     damage add:(WindowEvent newDamageFor:aView).
+    aView addUpdateRectangle:newRectangle.
     ^ true.
 
+"/    |newEvent r fullRedraw aDamageEvent 
+"/     nDamagesForView bounds areaOfIndividualRects thisRectangle
+"/     mergedLeft mergedRight mergedTop mergedBottom
+"/     sz                "{ Class: SmallInteger }"
+"/     updateRegion oldDamageEvent oldDamageEventIndex anyOtherEventPending|
+"/
+"/    "Add newRectangle to the damage list.
+"/     Try to merge incoming rectangles with the existing damage rectangles.
+"/     Incoming rectangles which are completely contained in any existing damage rect are ignored,
+"/     any existing damage rectangle which is completely contained in the incoming rectangle is replaced.
+"/     Returns true, if a new event has been added to the queue, false if it was optimized away."
+"/
 "/    "/ OLDDAMAGE handling
 "/    r := newRectangle.
 "/    ((fullRedraw := aView redrawsFull) 
@@ -3121,7 +3131,7 @@
 !WindowSensor class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.219 2004-02-27 10:48:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowSensor.st,v 1.220 2004-02-27 11:13:47 cg Exp $'
 ! !
 
 WindowSensor initialize!