git.fiddlerwoaroof.com
README.org
4abbc169
 * Intro
   
 CCL and LispWorks and other implementations have their own bridges to
 the objective-c runtime.  This project is an attempt to create a
 bridge that only uses CFFI so that arbitrary lisp implementations can
 produce native mac GUIs.  In the long run, I hope to use this as the
 basis for a new mac-native backend for McClim: but we'll see if that
 ever happens.
 
4b639d94
 For the time being, though, this only works on CCL and (sort-of) on
 LispWorks: it works like 95% on SBCL, but there's some weird issue
 that's preventing the window from showing. I hae not tested the code
 on any other implementations, but doing so will require changing a
 couple places in objc-runtime.lisp to inform the code about the new
 lisp's ffi types.
 
4abbc169
 * Installing
 
 1. clone fwoar.lisputils from
    https://github.com/fiddlerwoaroof/fwoar.lisputils and put it
    somewhere quicklisp can find it (e.g. ~/quicklisp/local-projects)
294c8e2c
 
 2. Install rsvg-convert:
abd994b1
     #+BEGIN_SRC sh
294c8e2c
 brew install librsvg
abd994b1
     #+END_SRC
294c8e2c
    
 3. build + run the demo:
4abbc169
    #+BEGIN_SRC sh
b2b418fe
 make mkapp CCL=/path/to/ccl
 open demo.app
4abbc169
    #+END_SRC
00bf024e
 
 * Show me the code!
   
 From demo-app.lisp:
 
 #+BEGIN_SRC lisp
   (defun main ()
     (trivial-main-thread:with-body-in-main-thread (:blocking t)
       [#@NSAutoReleasePool @(new)]
       [#@NSApplication @(sharedApplication)]
       [objc-runtime::ns-app @(setActivationPolicy:) :int 0]
 
       (let ((app-delegate (objc-runtime::objc-allocate-class-pair
                            #@NSObject "AppDelegate" 0)))
         (objc-runtime::add-pointer-ivar app-delegate "window")
         (objc-runtime::add-pointer-ivar app-delegate "delegate"))
 
       (let* ((bundle [#@NSBundle @(mainBundle)])
              (nib [[#@NSNib @(alloc)] @(initWithNibNamed:bundle:)
                                       :pointer @"MainMenu"
                                       :pointer bundle]))
         (cffi:with-foreign-object (p :pointer)
           [nib @(instantiateWithOwner:topLevelObjects:)
                :pointer objc-runtime::ns-app
                :pointer p]))
       [objc-runtime::ns-app @(activateIgnoringOtherApps:) :boolean t]
       [objc-runtime::ns-app @(run)]))
 #+END_SRC