Forever Buttons - Handle stop correctly
[clnl] / src / main / model.lisp
index 3e7c9514705e2abd79832ea7f170c71017f7f9c3..0ab8c101bf190198f7781452d4c92eb3b124fa3a 100644 (file)
@@ -308,7 +308,12 @@ DESCRIPTION:
        (loop
         :while (find button *enabled-forever-buttons* :test #'equal)
         ; The sleep is necessary so that it gives other threads time
-        :do (progn (clnl:run-commands (button-code button)) (sleep .001))))
+        :do
+        (let
+         ((result (funcall *current-callback* (button-code button))))
+         (when (eql :stop result)
+          (setf *enabled-forever-buttons* (remove button *enabled-forever-buttons* :test #'equal)))
+         (sleep .001))))
       :name (format nil "Forever button: ~A" (button-display button))))
     (t (funcall *current-callback* (button-code button)))))))