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

Re: WDEF in Lisp!

>Thanx Bill!
>> Another probable problem with your DEFPASCAL WDEF code is that
>> a WDEF is called for hit testing when you click on a window and
>> the Finder is the active application. This can callback to MCL
>I guess that's a secret I could never have found out on my own,
>however adding a few extra instructions the jmp.l abs.l instruction
>isn't a big deal.  How would I find out if the garbage collector
>is running from the assembly code?  preferebly, MCL should set
>some gestalt selector and result for this... does ccl::MAKE-WINDOID-WDEF
>modify the def-pascal code in some way?
>> (defvar *windoid-wdef-handle*)
>> (def-load-pointers windoid-wdef-handle ()
>>   (setq *windoid-wdef-handle* (ccl::make-wdef-handle ccl::windoid-wdef)))
>you could do things this way, but resource id's are commonly useed
>in resource templates, and as parameters to control manager and
>window manager routines pick which WDEF/CDEF/MDEF/LDEF is to be used
>automatically. And, since the different managers expect the code
>to be contained in a resource,  there is no guarantee that some of
>the resource manager calls don't get called on it...

The way MCL's windoid code works is that it calls the window manager
to make the window with :window-show nil, then changes the
windowrecord.windowdefproc slot of the wptr record. This approach has
worked fine since MCL 1.3.2, and it doesn't require any resource file

I don't advise putting knowledge about whether MCL is garbage collecting
into your resource stub. Instead, if you really want to continue using
a resource for your WDEF, use MAKE-WDEF-HANDLE to wrap the
garbage collector detector around your DEFPASCAL code (it doesn't modify
the DEFPASCAL code, it just wraps some code around it), then
lock the returned handle, and make your WDEF resource jump to the
dereferenced handle.

e.g. in place of your code:

(tweek-it "WDEF" kMyWDEFid lisp-window-definition)


(defvar *lisp-window-def-handle*)

(def-load-pointers *lisp-window-def-handle* ()
  (let ((handle (ccl::make-wdef-handle lisp-window-definition)))
    (setq *lisp-window-def-handle* handle)
    (#_MoveHHI handle)
    (#_HLock handle)
    (tweek-it "WDEF" kMyWDEFid (%get-ptr handle))))