From d7df0b209b91c9e0c4ec6baf639ac6b43405d5ab Mon Sep 17 00:00:00 2001 From: erg Date: Fri, 20 Oct 2006 19:25:56 +0000 Subject: [PATCH] add to ui backend update-click# and button-down --- library/ui/gestures.factor | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/library/ui/gestures.factor b/library/ui/gestures.factor index 1b6829676c..196125f1bb 100644 --- a/library/ui/gestures.factor +++ b/library/ui/gestures.factor @@ -70,6 +70,10 @@ SYMBOL: hand-loc SYMBOL: hand-clicked SYMBOL: hand-click-loc SYMBOL: hand-click# +SYMBOL: hand-last-button +SYMBOL: hand-last-time +0 hand-last-button set-global +0 hand-last-time set-global SYMBOL: hand-buttons V{ } clone hand-buttons set-global @@ -146,6 +150,22 @@ SYMBOL: scroll-direction : hand-click-rel ( gadget -- loc ) hand-click-loc get-global relative-loc ; +: update-click# ( button -- ) + hand-last-button get = [ + global [ hand-click# inc ] bind + ] [ + 1 hand-click# set-global + ] if ; + +: button-down ( button timeout -- ) + millis hand-last-time get - rot < [ + dup update-click# + ] [ + 1 hand-click# set-global + ] if + hand-last-button set-global + millis hand-last-time set-global ; + : under-hand ( -- seq ) #! A sequence whose first element is the world and last is #! the current gadget, with all parents in between.