diff --git a/internal/system/event.go b/internal/system/event.go index fe76c30..476e6da 100644 --- a/internal/system/event.go +++ b/internal/system/event.go @@ -26,8 +26,8 @@ func (this *Hierarchy) HandleKeyDown (key input.Key, numberPad bool) { } else { this.focusNext() } - } else if this.focused != nil { - this.keyboardTarget().handleKeyDown(key, numberPad) + } else if target := this.keyboardTarget(); target != nil { + target.handleKeyDown(key, numberPad) } } @@ -35,8 +35,8 @@ func (this *Hierarchy) HandleKeyDown (key input.Key, numberPad bool) { // which triggers this comes with modifier key information, HandleModifiers must // be called *before* HandleKeyUp. func (this *Hierarchy) HandleKeyUp (key input.Key, numberPad bool) { - if this.focused == nil { - this.keyboardTarget().handleKeyUp(key, numberPad) + if target := this.keyboardTarget(); target != nil { + target.handleKeyDown(key, numberPad) } }