From ba7828ef2d78f409d5dbdcb74960e083bd6953d4 Mon Sep 17 00:00:00 2001
From: Colin Okay <colin@cicadas.surf>
Date: Fri, 24 Jun 2022 07:17:30 -0500
Subject: [example] added focus and blur examples

---
 examples/02-moving-bitmp.lisp | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'examples')

diff --git a/examples/02-moving-bitmp.lisp b/examples/02-moving-bitmp.lisp
index 3a7fbc9..53f9229 100644
--- a/examples/02-moving-bitmp.lisp
+++ b/examples/02-moving-bitmp.lisp
@@ -62,7 +62,13 @@
     (ww::on-mousemotion ()
       (print (list target x y xrel yrel state))))
 
+(ww::defhandler look-at-me 
+  (ww::on-focus ()
+    (format t "~a got focus~%" target)))
 
+(ww::defhandler look-away 
+  (ww::on-blur ()
+    (format t "~a lost focus~%" target)))
 
 (defmethod ww::boot ((app bitmap-display))
   (let ((bm
@@ -82,6 +88,8 @@
           (ww::unit-y bm2) 90)
     (ww::set-handler bm2 #'move-thing)
     (ww::set-handler bm2 #'thing-clicked)
+    (ww::set-handler bm2 #'look-at-me )
+    (ww::set-handler bm2 #'look-away)
     (ww::add-unit app bm2)))
 
 
-- 
cgit v1.2.3