Fix strange logic in Hierarchy event managing

This commit is contained in:
Sasha Koshka 2024-06-02 22:48:32 -04:00
parent 8d3a708bca
commit 687b40b35a

View File

@ -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)
}
}