anchor.diff:  ;;; Library General Public License for more details.
   ;;;
   ;;; You should have received a copy of the GNU Library General Public
  -;;; License along with this library; if not, write to the 
  -;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 
  +;;; License along with this library; if not, write to the
  +;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   ;;; Boston, MA  02111-1307  USA.
   
   ;;;; The Repaint Protocol.
  
positive.code: (defclass standard-repainting-mixin () ())
  
  (defmethod dispatch-event
      ((sheet standard-repainting-mixin) (event window-repaint-event)) 
    (queue-repaint sheet event))
  
  (defmethod dispatch-repaint ((sheet standard-repainting-mixin) region)
  
negative.code: (defmethod queue-repaint ((sheet basic-sheet) (event window-repaint-event))
    (queue-event sheet event))
  
  (defmethod handle-repaint ((sheet basic-sheet) region)
    (declare (ignore region))
    nil)
  
  (defmethod repaint-sheet :around ((sheet basic-sheet) region)
    (declare (ignore region))
    (when (and (sheet-mirror sheet)
               (sheet-viewable-p sheet))
      (call-next-method)))
  
  (defmethod handle-repaint :around ((sheet sheet-with-medium-mixin) region)
    (typecase region
      (nowhere-region)
      (everywhere-region
       (call-next-method))
      (otherwise
       (let ((medium (sheet-medium sheet)))
         (with-drawing-options (medium :clipping-region region)
           (call-next-method))))))
  
  (defmethod repaint-sheet ((sheet basic-sheet) region)
    (labels ((effective-native-region (msheet child region)
               (let ((intersection (region-intersection (sheet-region child) region)))
                 (if (eq msheet child)
                     (transform-region (%%sheet-native-transformation msheet) intersection)
                     (effective-native-region msheet
                                              (sheet-parent child)
                                              (transform-region (sheet-transformation child)
                                                                intersection))))))
      ;; This causes applications which want to do a double-buffered repaint,
      ;; such as the logic cube, to flicker. On the other hand, it also stops
      ;; things such as the listener wholine from overexposing their text.
      (let ((msheet (sheet-mirrored-ancestor sheet)))
        ;; Do not call bounding-rectangle on region here. For +nowhere+ it gives
        ;; 0:0 0:0 (disregarding the nativer region). -- jd 2019-03-23
        (if (eql msheet sheet)
            (handle-repaint sheet (region-intersection (sheet-region sheet) region))
            (handle-repaint sheet (untransform-region
                                   (sheet-native-transformation sheet)
                                   (effective-native-region msheet sheet region)))))))
  
  (defmethod repaint-sheet :after ((sheet sheet-parent-mixin) region)
    ;; propagate repaint to unmirrored sheets
  