+static char *osx_text_fallback(void *handle, const char *const *strings,
+ int nstrings)
+{
+ /*
+ * We assume OS X can cope with any UTF-8 likely to be emitted
+ * by a puzzle.
+ */
+ return dupstr(strings[0]);
+}
+struct blitter {
+ int w, h;
+ int x, y;
+ NSImage *img;
+};
+static blitter *osx_blitter_new(void *handle, int w, int h)
+{
+ blitter *bl = snew(blitter);
+ bl->x = bl->y = -1;
+ bl->w = w;
+ bl->h = h;
+ bl->img = [[NSImage alloc] initWithSize:NSMakeSize(w, h)];
+ [bl->img setFlipped:YES];
+ return bl;
+}
+static void osx_blitter_free(void *handle, blitter *bl)
+{
+ [bl->img release];
+ sfree(bl);
+}
+static void osx_blitter_save(void *handle, blitter *bl, int x, int y)
+{
+ frontend *fe = (frontend *)handle;
+ [fe->image unlockFocus];
+ [bl->img lockFocus];
+ [fe->image drawInRect:NSMakeRect(0, 0, bl->w, bl->h)
+ fromRect:NSMakeRect(x, y, bl->w, bl->h)
+ operation:NSCompositeCopy fraction:1.0];
+ [bl->img unlockFocus];
+ [fe->image lockFocus];
+ bl->x = x;
+ bl->y = y;
+}
+static void osx_blitter_load(void *handle, blitter *bl, int x, int y)
+{
+ /* frontend *fe = (frontend *)handle; */
+ if (x == BLITTER_FROMSAVED && y == BLITTER_FROMSAVED) {
+ x = bl->x;
+ y = bl->y;
+ }
+ [bl->img drawInRect:NSMakeRect(x, y, bl->w, bl->h)
+ fromRect:NSMakeRect(0, 0, bl->w, bl->h)
+ operation:NSCompositeCopy fraction:1.0];
+}
+static void osx_draw_update(void *handle, int x, int y, int w, int h)