+
+static void
+apple2_reshape (Display *dpy, Window window, void *closure,
+ unsigned int w, unsigned int h)
+{
+ struct state *st = (struct state *) closure;
+ analogtv_reconfigure (st->sim->dec);
+}
+
+static Bool
+apple2_event (Display *dpy, Window window, void *closure, XEvent *event)
+{
+ struct state *st = (struct state *) closure;
+
+ if (st->controller == terminal_controller &&
+ event->xany.type == KeyPress) {
+ terminal_keypress_handler (dpy, event, st->sim->controller_data);
+ return True;
+ }
+
+ return False;
+}
+
+static void
+apple2_free (Display *dpy, Window window, void *closure)
+{
+ struct state *st = (struct state *) closure;
+ if (st->sim) {
+ st->sim->stepno = A2CONTROLLER_DONE;
+ if (apple2_one_frame (st->sim))
+ abort(); /* should have freed! */
+ }
+ free (st);
+}
+
+
+XSCREENSAVER_MODULE ("Apple2", apple2)