                                  listeners)
         prx-obj           (quil.Applet. applet-state)]
     (doto prx-obj
-      (applet-run title renderer target)
+      (applet-run title renderer)
       (attach-applet-listeners))))
 
 (def ^{:private true}


(defn- applet-run
  "Launches the applet to the specified target."
  [applet title renderer target]
  (PApplet/runSketch (into-array String ["--hide-stop" title]) applet)
  (case target
    :frame (prepare-applet-frame applet title renderer false)
    :perm-frame (prepare-applet-frame applet title renderer true)))


(def ^{:private true}

  (set! (.finished applet) true))

(defn- prepare-applet-frame
  [applet title renderer]
  (let [m              (meta applet)
        keep-on-top?   (true? (:keep-on-top m))
        frame          (.frame applet)]
    (doseq [listener (.getWindowListeners frame)]
      (.removeWindowListener frame listener))
