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 { } else {
this.focusNext() this.focusNext()
} }
} else if this.focused != nil { } else if target := this.keyboardTarget(); target != nil {
this.keyboardTarget().handleKeyDown(key, numberPad) 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 // which triggers this comes with modifier key information, HandleModifiers must
// be called *before* HandleKeyUp. // be called *before* HandleKeyUp.
func (this *Hierarchy) HandleKeyUp (key input.Key, numberPad bool) { func (this *Hierarchy) HandleKeyUp (key input.Key, numberPad bool) {
if this.focused == nil { if target := this.keyboardTarget(); target != nil {
this.keyboardTarget().handleKeyUp(key, numberPad) target.handleKeyDown(key, numberPad)
} }
} }