                                                    (make-font else-font Font/PLAIN font-size)))
           ;; false if Display is destoyed
           gl-lock            (atom true)
-          ; Used to request Display destruction.
-          close-ref          (ref false)
           {:keys [screen-width
                   screen-height
                   character-width

                  font-texture-height
                  font-texture-image]} (get @font-textures (font-key @normal-font))
          _                  (log/info "screen size" screen-width "x" screen-height)
          _                  (init-display title screen-width screen-height icon-paths gl-lock close-ref)

          font-texture       (with-gl-context gl-lock (texture-id font-texture-image))
          _                  (swap! font-textures update (font-key @normal-font) (fn [m] (assoc m :font-texture font-texture)))

               ; Process messages in the main thread rather than the input go-loop due to Windows only allowing
               ; input on the thread that created the window
               (Display/processMessages)
               (or (Display/isCloseRequested) (not @gl-lock)))
           (do
             (log/info "Destroying display")
             (with-gl-context gl-lock
