Removed unneeded Container.reflectChildProperties()

This commit is contained in:
Sasha Koshka 2023-03-12 01:57:56 -05:00
parent b09994973c
commit 7ef95cc751
2 changed files with 2 additions and 17 deletions

View File

@ -87,7 +87,6 @@ func (element *Container) Adopt (child elements.Element, expand bool) {
// refresh stale data
element.updateMinimumSize()
element.reflectChildProperties()
if element.core.HasImage() && !element.warping {
element.redoAll()
element.core.DamageAll()
@ -130,7 +129,6 @@ func (element *Container) Disown (child elements.Element) {
}
element.updateMinimumSize()
element.reflectChildProperties()
if element.core.HasImage() && !element.warping {
element.redoAll()
element.core.DamageAll()
@ -158,7 +156,6 @@ func (element *Container) DisownAll () {
element.children = nil
element.updateMinimumSize()
element.reflectChildProperties()
if element.core.HasImage() && !element.warping {
element.redoAll()
element.core.DamageAll()
@ -256,20 +253,6 @@ func (element *Container) OnFocusMotionRequest (
element.Propagator.OnFocusMotionRequest(callback)
}
func (element *Container) reflectChildProperties () {
focusable := false
for _, entry := range element.children {
_, focusable := entry.Element.(elements.Focusable)
if focusable {
focusable = true
break
}
}
if !focusable && element.Focused() {
element.Propagator.HandleUnfocus()
}
}
func (element *Container) childFocusRequestCallback (
child elements.Focusable,
) (

View File

@ -1,5 +1,6 @@
package core
// import "runtime/debug"
import "git.tebibyte.media/sashakoshka/tomo/input"
// FocusableCore is a struct that can be embedded into objects to make them
@ -71,6 +72,7 @@ func (core *FocusableCore) HandleFocus (
// HandleUnfocus causes this element to mark itself as unfocused.
func (core *FocusableCore) HandleUnfocus () {
core.focused = false
// debug.PrintStack()
if core.drawFocusChange != nil { core.drawFocusChange() }
}