CLIM mail archive


Drawing Order

    Date: Wed, 9 Dec 1992 18:37 EST
    From: Ed Gamble <>

    I'm not Eilerts but as best I can tell here is the same problem...

Congratulations!  You found a previously unknown bug in incremental
redisplay.  The fix is included below.

    For this test, I attempting to draw two sets of concentric circles.   One
    set if fixed; a large red circle with a small black one.  The other
    set moves about randomly; it is blue with a yellow dot.

    If you hit the "move" menu item the blue/yellow circle moves obscuring the
    red/black.  Problem is the black dot disappears.  It can be seen again
    if the window is iconified, then reopened.

Here is the fix for CLIM 1.1.  This fix will be part of CLIM 2.0 as well.

(in-package :clim)
(defmethod augment-draw-set ((record output-record-element-mixin)
			     erases moves draws erase-overlapping move-overlapping
			     &optional (x-offset 0) (y-offset 0)
				       (old-x-offset 0) (old-y-offset 0))
  (declare (fixnum x-offset y-offset old-x-offset old-y-offset))
  (declare (values erases moves draws erase-overlapping move-overlapping))
  (let ((new-draws nil))
    (labels ((augment-draws (record x-offset y-offset old-x-offset old-y-offset)
	       (when (and (displayed-output-record-element-p record)
			  (not (elements-never-overlap-p (output-record-parent record)))
			  (not (member record draws :key #'first))
			  (not (member record erases :key #'first))
			  (dolist (erase erases nil)
			    (when (region-intersects-region-p record (first erase))
			      (return t))))
		 (push (list record
			       record x-offset y-offset))
	       (when (output-record-p record)
		 (multiple-value-bind (start-x start-y)
		     (output-record-start-position* record)
		   (declare (fixnum start-x start-y))
		   (multiple-value-bind (o-start-x o-start-y)
		       (output-record-old-start-position* record)
		     (declare (fixnum o-start-x o-start-y))
		     (let ((x-offset (the fixnum (+ x-offset start-x)))
			   (y-offset (the fixnum (+ y-offset start-y)))
			   (old-x-offset (the fixnum (+ old-x-offset o-start-x)))
			   (old-y-offset (the fixnum (+ old-y-offset o-start-y))))
		       (map-over-output-record-elements record
			 #'augment-draws 0 0
			 x-offset y-offset old-x-offset old-y-offset)))))))
      (declare (dynamic-extent #'augment-draws))
      (augment-draws record x-offset y-offset old-x-offset old-y-offset))
    (values erases moves (nconc (nreverse new-draws) draws)
	    erase-overlapping move-overlapping)))


Main Index | Thread Index