From 622add17d99c909b582b175f5e8378f9888cca8a Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Fri, 24 Jun 2022 08:39:43 -0500 Subject: [modify] mousedown events default to the app itself --- examples/02-moving-bitmp.lisp | 3 +++ wheelwork.lisp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp index 153ca1d..ca32b44 100644 --- a/examples/02-moving-bitmp.lisp +++ b/examples/02-moving-bitmp.lisp @@ -86,6 +86,9 @@ (bm2 (make-instance 'ww::bitmap :texture (ww::get-asset "RootBear.png")))) + + (ww::set-handler app #'wheelie) + ;; first (ww::refocus-on bm) (ww::set-handler bm #'animate-move-thing ) diff --git a/wheelwork.lisp b/wheelwork.lisp index fb4e5bb..3a39dd2 100644 --- a/wheelwork.lisp +++ b/wheelwork.lisp @@ -393,7 +393,9 @@ necessary." Additionally, if the APPLICATION's REFOCUS-ON-MOUSEDOWN-P is T, try to give focus to whatever was clicked." (destructuring-bind (x y) (screen-to-world wx wy) - (when-let (target (unit-under app x y)) + (let ((target + (or (unit-under app x y) ; if no unit is under the mouse, + app))) ; then target the app itself (when (refocus-on-mousedown-p app) (refocus-on target)) (when-let (handler (get-handler-for target 'mousedown)) -- cgit v1.2.3