git.fiddlerwoaroof.com
name mode size
demo.app.template 040000
.gitignore 100644 0 kb
MainMenu.xib 100644 54 kb
Makefile 100644 2 kb
README.org 100644 2 kb
demo-app.lisp 100644 7 kb
demo-app.svg 100644 12 kb
nsrect-expose.m 100644 1 kb
objc-runtime-types.lisp 100644 1 kb
objc-runtime.asd 100644 1 kb
objc-runtime.lisp 100644 7 kb
package.lisp 100644 0 kb
readtable.lisp 100644 2 kb
README.org
* 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. 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. * 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) 2. Install rsvg-convert: #+BEGIN_SRC sh brew install librsvg #+END_SRC 3. build + run the demo: #+BEGIN_SRC sh make mkapp CCL=/path/to/ccl open demo.app #+END_SRC * 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