libui: don't require beeper for main content

This commit is contained in:
Drew DeVault 2020-05-05 09:57:19 -04:00
parent 866cd17dd7
commit 52eb38ae5d
1 changed files with 4 additions and 2 deletions

View File

@ -17,7 +17,7 @@ type UI struct {
invalid int32 // access via atomic invalid int32 // access via atomic
} }
func Initialize(content DrawableInteractiveBeeper) (*UI, error) { func Initialize(content DrawableInteractive) (*UI, error) {
screen, err := tcell.NewScreen() screen, err := tcell.NewScreen()
if err != nil { if err != nil {
@ -52,7 +52,9 @@ func Initialize(content DrawableInteractiveBeeper) (*UI, error) {
content.OnInvalidate(func(_ Drawable) { content.OnInvalidate(func(_ Drawable) {
atomic.StoreInt32(&state.invalid, 1) atomic.StoreInt32(&state.invalid, 1)
}) })
content.OnBeep(screen.Beep) if beeper, ok := content.(DrawableInteractiveBeeper); ok {
beeper.OnBeep(screen.Beep)
}
content.Focus(true) content.Focus(true)
if root, ok := content.(RootDrawable); ok { if root, ok := content.(RootDrawable); ok {