[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Q: Understanding rlet and print-record.



The following two pieces of code have me confused.   They are both
basically trying to do the same thing, but with slightly different calls.
In both cases, even though xxx and p are eql (which I thought meant that
they pointed to the same record), print-record produces different
descriptions for each one.  Form the looks of things, xxx's output is
correct, and p's is bogus.  Can someone explain to me why this is so?  Am I
using the low level functions correctly?

(setf www (make-instance 'window))
(with-port (wptr www)
  (rlet ((p :GrafPtr))
    (#_GetPort p)
    (let ((xxx (%get-ptr p 0)))
      (print (eql xxx (wptr www)))
      (print-record (wptr www) :GrafPort)
      (print-record (pref xxx :GrafPort) :GrafPort)))
  (values))

(setf www (make-instance 'window))
(with-port (wptr www)
  (rlet ((p :GrafPtr))
    (#_GetPort p)
    (let ((xxx (pref p :ptr)))
      (print (eql xxx (wptr www)))
      (print-record (wptr www) :GrafPort)
      (print-record (pref xxx :GrafPort) :GrafPort)))
  (values))

On another note, is there any way to get the true update region for a
window/view?  I was under the impression that normally after a call to
#_BeginUpdate (which I assume MCL does internally somewhere) the visRgn of
the window is set to the intersection of the visible and update regions.
However, this does not seem to be the case when you are inside a
view-draw-contents method.  I called #_PaintRgn on the visRgn of the
current port and always got a completely black view.  This was also true if
I tried it with the visrgn parameter of view-focus-and-draw-contents.

--Thanks