From ae2e47be672493d4a83ede984c7c144a03818e23 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Sun, 24 Jul 2022 13:24:46 -0500 Subject: [add] cleanup for menu and interactive --- src/interactive/interactive.lisp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/interactive') diff --git a/src/interactive/interactive.lisp b/src/interactive/interactive.lisp index ceacf1b..11bc5ca 100644 --- a/src/interactive/interactive.lisp +++ b/src/interactive/interactive.lisp @@ -7,6 +7,14 @@ (focusablep :std t :doc "Whether or not this object can receive application focus.")) (:documentation "Supplies an object with a listener slot.")) +(defun remove-all-handlers (interactive) + (loop + for type in '(keydown keyup mousedown mouseup mousemotion mousewheel focus blur perframe) + do (remove-handler interactive type))) + +(defmethod cleanup :after ((ob interactive)) + (remove-all-handlers ob)) + (defun add-handler (interactive handler) "Adds HANDLER to INTERACTIVE. HANDLER is an instance of WHEELWORK::EVENT-HANDLER, as most readily constructed by using the -- cgit v1.2.3