Top-level window focus handling
parent
628c9de692
commit
805d73ca22
|
@ -63,7 +63,8 @@ M: word summary ( word -- )
|
|||
] if ;
|
||||
|
||||
M: input summary ( input -- )
|
||||
"Input: " swap input-string unparse-short append ;
|
||||
"Input: " swap input-string
|
||||
dup string? [ unparse-short ] unless append ;
|
||||
|
||||
: format-column ( list ? -- list )
|
||||
>r [ unparse-short ] map r> [
|
||||
|
|
|
@ -63,6 +63,18 @@ sequences ;
|
|||
swap [contentView] window set-world-loc
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"windowDidBecomeKey:" "void" { "id" "SEL" "id" } [
|
||||
2nip [object] [contentView] window focus-world
|
||||
]
|
||||
}
|
||||
|
||||
{
|
||||
"windowDidResignKey:" "void" { "id" "SEL" "id" } [
|
||||
2nip [object] [contentView] window unfocus-world
|
||||
]
|
||||
}
|
||||
} { } define-objc-class
|
||||
|
||||
: install-window-delegate ( window -- )
|
||||
|
|
|
@ -105,6 +105,14 @@ V{ } clone hand-buttons set-global
|
|||
: request-focus ( gadget -- )
|
||||
dup focusable-child swap find-world request-focus* ;
|
||||
|
||||
: focus-world ( world -- )
|
||||
#! Sent when native window receives focus
|
||||
focused-ancestors f focus-gestures ;
|
||||
|
||||
: unfocus-world ( world -- )
|
||||
#! Sent when native window loses focus.
|
||||
focused-ancestors f swap focus-gestures ;
|
||||
|
||||
: modifier ( mod modifiers -- seq )
|
||||
[ second swap bitand 0 > ] subset-with
|
||||
[ first ] map f like ;
|
||||
|
|
Loading…
Reference in New Issue