Key down events now sent
parent
5d1aff6e86
commit
c3677c7147
|
@ -69,13 +69,22 @@ H{ } clone views set-global
|
||||||
dup [keyCode] key-codes hash
|
dup [keyCode] key-codes hash
|
||||||
[ ] [ [charactersIgnoringModifiers] CF>string ] ?if ;
|
[ ] [ [charactersIgnoringModifiers] CF>string ] ?if ;
|
||||||
|
|
||||||
: event>gesture ( event -- gesture )
|
: event>gesture ( event -- modifiers keycode )
|
||||||
dup [modifierFlags] modifiers modifier swap key-code
|
dup [modifierFlags] modifiers modifier swap key-code ;
|
||||||
<key-down> ;
|
|
||||||
|
|
||||||
: send-key-event ( view event -- )
|
: send-key-event ( view event quot -- )
|
||||||
>r view world-focus r> dup event>gesture pick handle-gesture
|
>r event>gesture r> call swap view world-focus
|
||||||
[ [characters] CF>string swap user-input ] [ 2drop ] if ;
|
handle-gesture ; inline
|
||||||
|
|
||||||
|
: send-user-input ( view event -- )
|
||||||
|
[characters] CF>string swap view world-focus user-input ;
|
||||||
|
|
||||||
|
: send-key-down-event ( view event -- )
|
||||||
|
2dup [ <key-down> ] send-key-event
|
||||||
|
[ send-user-input ] [ 2drop ] if ;
|
||||||
|
|
||||||
|
: send-key-up-event ( view event -- )
|
||||||
|
[ <key-up> ] send-key-event ;
|
||||||
|
|
||||||
: send-button-down$ ( view event -- )
|
: send-button-down$ ( view event -- )
|
||||||
over >r button&loc r> view send-button-down ;
|
over >r button&loc r> view send-button-down ;
|
||||||
|
@ -136,7 +145,11 @@ H{ } clone views set-global
|
||||||
}
|
}
|
||||||
|
|
||||||
{ "keyDown:" "void" { "id" "SEL" "id" }
|
{ "keyDown:" "void" { "id" "SEL" "id" }
|
||||||
[ nip send-key-event ]
|
[ nip send-key-down-event ]
|
||||||
|
}
|
||||||
|
|
||||||
|
{ "keyUp:" "void" { "id" "SEL" "id" }
|
||||||
|
[ nip send-key-up-event ]
|
||||||
}
|
}
|
||||||
|
|
||||||
{ "updateFactorGadgetSize:" "void" { "id" "SEL" "id" }
|
{ "updateFactorGadgetSize:" "void" { "id" "SEL" "id" }
|
||||||
|
|
|
@ -8,7 +8,6 @@ IN: gadgets
|
||||||
SYMBOL: clip
|
SYMBOL: clip
|
||||||
|
|
||||||
: init-gl ( dim -- )
|
: init-gl ( dim -- )
|
||||||
{ 1.0 0.0 0.0 1.0 } gl-color
|
|
||||||
GL_PROJECTION glMatrixMode
|
GL_PROJECTION glMatrixMode
|
||||||
glLoadIdentity
|
glLoadIdentity
|
||||||
GL_MODELVIEW glMatrixMode
|
GL_MODELVIEW glMatrixMode
|
||||||
|
@ -21,7 +20,6 @@ SYMBOL: clip
|
||||||
GL_BLEND glEnable
|
GL_BLEND glEnable
|
||||||
GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
|
GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA glBlendFunc
|
||||||
GL_SCISSOR_TEST glEnable
|
GL_SCISSOR_TEST glEnable
|
||||||
GL_MODELVIEW glMatrixMode
|
|
||||||
1.0 1.0 1.0 1.0 glClearColor
|
1.0 1.0 1.0 1.0 glClearColor
|
||||||
GL_COLOR_BUFFER_BIT glClear ;
|
GL_COLOR_BUFFER_BIT glClear ;
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,7 @@ C: world ( gadget status -- world )
|
||||||
H{ } clone over set-world-fonts
|
H{ } clone over set-world-fonts
|
||||||
dup world-gadget request-focus ;
|
dup world-gadget request-focus ;
|
||||||
|
|
||||||
GENERIC: find-world ( gadget -- world )
|
: find-world [ world? ] find-parent ;
|
||||||
|
|
||||||
M: f find-world ;
|
|
||||||
|
|
||||||
M: gadget find-world gadget-parent find-world ;
|
|
||||||
|
|
||||||
M: world find-world ;
|
|
||||||
|
|
||||||
M: world pref-dim* ( world -- dim )
|
M: world pref-dim* ( world -- dim )
|
||||||
delegate pref-dim* { 1024 768 0 } vmin ;
|
delegate pref-dim* { 1024 768 0 } vmin ;
|
||||||
|
|
Loading…
Reference in New Issue