aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/wheelwork.lisp
diff options
context:
space:
mode:
authorcolin <colin@cicadas.surf>2024-12-14 12:29:29 -0800
committercolin <colin@cicadas.surf>2024-12-14 12:29:29 -0800
commit543704f0f54cbb1de78754ad8a323c482ab6829c (patch)
tree7528c0105516a2a2800e432de9f4f1a6c3fe506e /src/wheelwork.lisp
parent3a2217263d581be9a7f629b10d75aa8e3d581890 (diff)
Loop style nitsHEADmain
Diffstat (limited to 'src/wheelwork.lisp')
-rw-r--r--src/wheelwork.lisp48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/wheelwork.lisp b/src/wheelwork.lisp
index 506ba9b..88ea772 100644
--- a/src/wheelwork.lisp
+++ b/src/wheelwork.lisp
@@ -115,19 +115,19 @@ position. The list always contains the app itself as the last element."
single elemtn list, or nil if none found"
(with-slots (scene) app
(loop
- for idx from (1- (length scene)) downto 0
- for u = (elt scene idx)
- when (unit-visibly-contains-p u x y)
- return (list u))))
+ :for idx :from (1- (length scene)) :downto 0
+ :for u := (elt scene idx)
+ :when (unit-visibly-contains-p u x y)
+ :return (list u))))
(defun all-units-under (app x y)
"Finds all units under the point x y"
(with-slots (scene) app
(loop
- for idx from (1- (length scene)) downto 0
- for u = (elt scene idx)
- when (unit-visibly-contains-p u x y)
- collect u)))
+ :for idx :from (1- (length scene)) :downto 0
+ :for u := (elt scene idx)
+ :when (unit-visibly-contains-p u x y)
+ :collect u)))
(defvar *event-still-bubbling-p* nil
"Controls whether an event is bubbling")
@@ -140,7 +140,7 @@ single elemtn list, or nil if none found"
"Scales the screen point - the literal pixel position relative to
the top corner of the application window - to reflect the
application's scaling factor"
- (declare (optimize (speed 3) (saftey 0)))
+ (declare (optimize (speed 3) (safety 0)))
(with-slots (height scale) app
(list (/ x scale) (/ (- height y) scale))))
@@ -156,24 +156,21 @@ give focus to whatever was clicked."
(when (and (refocus-on-mousedown-p app)
(focusablep (first candidate-targets)))
(refocus-on (first candidate-targets)))
- (let ((*event-still-bubbling-p*
- (mouse-button-events-bubble-p app)))
- (loop for target in candidate-targets
- do
- (dolist (handler (get-handlers-for target 'mousedown))
- (funcall handler target x y clicks button wx wy))
- while *event-still-bubbling-p*)))))
+ (let ((*event-still-bubbling-p* (mouse-button-events-bubble-p app)))
+ (loop :for target :in candidate-targets :do
+ (dolist (handler (get-handlers-for target 'mousedown))
+ (funcall handler target x y clicks button wx wy))
+ :while *event-still-bubbling-p*)))))
(defun eventloop-mousebuttonup (app wx wy clicks button)
(when (should-listen-for-p 'mouseup app)
(destructuring-bind (x y) (screen-to-world wx wy)
(let ((*event-still-bubbling-p*
(mouse-button-events-bubble-p app)))
- (loop for target in (mouse-event-targets app x y (mouse-button-events-bubble-p app))
- do
- (dolist (handler (get-handlers-for target 'mouseup))
- (funcall handler target x y clicks button wx wy))
- while *event-still-bubbling-p*)))))
+ (loop :for target :in (mouse-event-targets app x y (mouse-button-events-bubble-p app)) :do
+ (dolist (handler (get-handlers-for target 'mouseup))
+ (funcall handler target x y clicks button wx wy))
+ :while *event-still-bubbling-p*)))))
(defun eventloop-mousemotion (app wx wy wxrel wyrel state)
(when (should-listen-for-p 'mousemotion app)
@@ -183,11 +180,10 @@ give focus to whatever was clicked."
(yrel (* -1 (/ wyrel scale))))
(let ((*event-still-bubbling-p*
(mouse-motion-events-bubble-p app)))
- (loop for target in (mouse-event-targets app x y (mouse-motion-events-bubble-p app))
- do
- (dolist (handler (get-handlers-for target 'mousemotion))
- (funcall handler target x y xrel yrel state wx wy wxrel wyrel))
- while *event-still-bubbling-p*))))))
+ (loop :for target :in (mouse-event-targets app x y (mouse-motion-events-bubble-p app)) :do
+ (dolist (handler (get-handlers-for target 'mousemotion))
+ (funcall handler target x y xrel yrel state wx wy wxrel wyrel))
+ :while *event-still-bubbling-p*))))))
(defun eventloop-mousewheel (app wx wy dir)
(when (should-listen-for-p 'mousewheel app)