cvs
Slava Pestov 2005-11-14 06:54:40 +00:00
parent a651cc87b1
commit f710a2df78
5 changed files with 26 additions and 18 deletions

View File

@ -7,8 +7,6 @@
- default library names are not useful - default library names are not useful
- fix remaining GL issues - fix remaining GL issues
- fix up the min thumb size hack - fix up the min thumb size hack
- bug: left click to bring up context menu, click splitter bar
and pane grows to 100%
- bug: click tutorial, full screen, the right-most arrow icon - bug: click tutorial, full screen, the right-most arrow icon
loses the vertical bar loses the vertical bar
- signal handler should not lose stack pointers - signal handler should not lose stack pointers

View File

@ -9,16 +9,11 @@ GENERIC: handle-event ( event -- )
M: object handle-event ( event -- ) M: object handle-event ( event -- )
drop ; drop ;
: button-gesture ( button gesture -- )
swap add hand get hand-clicked handle-gesture drop ;
M: button-down-event handle-event ( event -- ) M: button-down-event handle-event ( event -- )
button-event-button dup hand get button/ button-event-button button/ ;
[ button-down ] button-gesture ;
M: button-up-event handle-event ( event -- ) M: button-up-event handle-event ( event -- )
button-event-button dup hand get button\ button-event-button button\ ;
[ button-up ] button-gesture ;
: motion-event-loc ( event -- loc ) : motion-event-loc ( event -- loc )
dup motion-event-x swap motion-event-y 0 3array ; dup motion-event-x swap motion-event-y 0 3array ;

View File

@ -16,14 +16,17 @@ TUPLE: hand click-loc click-rel clicked buttons gadget focus ;
C: hand ( -- hand ) C: hand ( -- hand )
dup delegate>gadget V{ } clone over set-hand-buttons ; dup delegate>gadget V{ } clone over set-hand-buttons ;
: button/ ( n hand -- ) : button-gesture ( button gesture -- )
dup hand-gadget over set-hand-clicked swap add hand get hand-clicked handle-gesture drop ;
dup screen-loc over set-hand-click-loc
dup hand-gadget over relative over set-hand-click-rel
hand-buttons push ;
: button\ ( n hand -- ) : button/ ( n -- )
hand-buttons delete ; update-clicked
dup hand get hand-buttons push
[ button-down ] button-gesture ;
: button\ ( n -- )
dup hand get hand-buttons delete
[ button-up ] button-gesture ;
: drag-gesture ( hand gadget gesture -- ) : drag-gesture ( hand gadget gesture -- )
#! Send a gesture like [ drag 2 ]. #! Send a gesture like [ drag 2 ].

View File

@ -9,9 +9,12 @@ namespaces sequences ;
hand get [ hand-gadget ] keep 2dup hand-clicked eq? hand get [ hand-gadget ] keep 2dup hand-clicked eq?
[ 2dup set-hand-clicked update-hand ] unless 2drop ; [ 2dup set-hand-clicked update-hand ] unless 2drop ;
: retarget-click ( -- )
update-hand-gadget update-clicked ;
: menu-actions ( glass -- ) : menu-actions ( glass -- )
dup [ drop retarget-drag ] [ drag 1 ] set-action dup [ drop retarget-drag ] [ drag 1 ] set-action
[ drop hide-glass ] [ button-down 1 ] set-action ; [ drop hide-glass retarget-click ] [ button-down 1 ] set-action ;
: fit-bounds ( loc dim max -- loc ) : fit-bounds ( loc dim max -- loc )
#! Adjust loc to fit inside max. #! Adjust loc to fit inside max.

View File

@ -72,14 +72,23 @@ M: f set-message 2drop ;
#! the current gadget, with all parents in between. #! the current gadget, with all parents in between.
hand get hand-gadget parents reverse-slice ; hand get hand-gadget parents reverse-slice ;
: update-hand-gadget ( -- )
hand-grab hand get set-hand-gadget ;
: hand-grab ( -- gadget ) : hand-grab ( -- gadget )
hand get rect-loc world get pick-up ; hand get rect-loc world get pick-up ;
: move-hand ( loc -- ) : move-hand ( loc -- )
under-hand >r hand get set-rect-loc under-hand >r hand get set-rect-loc
hand-grab hand get set-hand-gadget update-hand-gadget
under-hand r> hand-gestures update-help ; under-hand r> hand-gestures update-help ;
: update-clicked ( -- )
hand get
dup hand-gadget over set-hand-clicked
dup screen-loc over set-hand-click-loc
dup hand-gadget over relative swap set-hand-click-rel ;
M: motion-event handle-event ( event -- ) M: motion-event handle-event ( event -- )
motion-event-loc move-hand ; motion-event-loc move-hand ;