add click count in gestures and win32

darcs
erg 2006-10-20 00:40:41 +00:00
parent 7a0e6979b8
commit 31bac04760
3 changed files with 26 additions and 4 deletions

View File

@ -69,6 +69,7 @@ SYMBOL: hand-loc
SYMBOL: hand-clicked SYMBOL: hand-clicked
SYMBOL: hand-click-loc SYMBOL: hand-click-loc
SYMBOL: hand-click#
SYMBOL: hand-buttons SYMBOL: hand-buttons
V{ } clone hand-buttons set-global V{ } clone hand-buttons set-global

View File

@ -165,14 +165,35 @@ SYMBOL: hWnd
: mouse-lparam ( lParam -- seq ) [ lo-word ] keep hi-word 2array ; : mouse-lparam ( lParam -- seq ) [ lo-word ] keep hi-word 2array ;
: mouse-wheel ( lParam -- n ) mouse-lparam [ sgn neg ] map ; : mouse-wheel ( lParam -- n ) mouse-lparam [ sgn neg ] map ;
SYMBOL: last-button
SYMBOL: last-time
0 last-button set-global
0 last-time set-global
: update-click# ( button -- )
last-button get = [
global [ hand-click# inc ] bind
] [
1 hand-click# set-global
] if ;
: mouse-click ( button -- )
millis last-time get - GetDoubleClickTime < [
dup update-click#
] [
1 hand-click# set-global
] if
last-button set
millis last-time set ;
: mouse-event>gesture ( uMsg -- button ) : mouse-event>gesture ( uMsg -- button )
key-modifiers swap key-modifiers swap
{ {
{ [ dup WM_LBUTTONDOWN = ] [ drop 1 <button-down> ] } { [ dup WM_LBUTTONDOWN = ] [ drop 1 dup mouse-click <button-down> ] }
{ [ dup WM_LBUTTONUP = ] [ drop 1 <button-up> ] } { [ dup WM_LBUTTONUP = ] [ drop 1 <button-up> ] }
{ [ dup WM_MBUTTONDOWN = ] [ drop 2 <button-down> ] } { [ dup WM_MBUTTONDOWN = ] [ drop 2 dup mouse-click <button-down> ] }
{ [ dup WM_MBUTTONUP = ] [ drop 2 <button-up> ] } { [ dup WM_MBUTTONUP = ] [ drop 2 <button-up> ] }
{ [ dup WM_RBUTTONDOWN = ] [ drop 3 <button-down> ] } { [ dup WM_RBUTTONDOWN = ] [ drop 3 dup mouse-click <button-down> ] }
{ [ dup WM_RBUTTONUP = ] [ drop 3 <button-up> ] } { [ dup WM_RBUTTONUP = ] [ drop 3 <button-up> ] }
{ [ t ] [ "bad button" throw ] } { [ t ] [ "bad button" throw ] }
} cond ; } cond ;

View File

@ -822,7 +822,7 @@ FUNCTION: HDC GetDCEx ( HWND hWnd, HRGN hrgnClip, DWORD flags ) ;
! FUNCTION: GetDlgItemInt ! FUNCTION: GetDlgItemInt
! FUNCTION: GetDlgItemTextA ! FUNCTION: GetDlgItemTextA
! FUNCTION: GetDlgItemTextW ! FUNCTION: GetDlgItemTextW
! FUNCTION: GetDoubleClickTime FUNCTION: uint GetDoubleClickTime ( ) ;
FUNCTION: HWND GetFocus ( ) ; FUNCTION: HWND GetFocus ( ) ;
! FUNCTION: GetForegroundWindow ! FUNCTION: GetForegroundWindow
! FUNCTION: GetGuiResources ! FUNCTION: GetGuiResources