|
|
@ -817,7 +817,7 @@ func (a *Application) GetFocus() Primitive {
|
|
|
|
// This function returns after f has executed.
|
|
|
|
// This function returns after f has executed.
|
|
|
|
func (a *Application) QueueUpdate(
|
|
|
|
func (a *Application) QueueUpdate(
|
|
|
|
f func(),
|
|
|
|
f func(),
|
|
|
|
) *Application {
|
|
|
|
) bool {
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
|
if err := recover(); err != nil {
|
|
|
|
if err := recover(); err != nil {
|
|
|
|
// dealing with panic, as we can still get a closed channel
|
|
|
|
// dealing with panic, as we can still get a closed channel
|
|
|
@ -832,27 +832,25 @@ func (a *Application) QueueUpdate(
|
|
|
|
if a.runContext.Err() == nil {
|
|
|
|
if a.runContext.Err() == nil {
|
|
|
|
select {
|
|
|
|
select {
|
|
|
|
case a.updates <- msg:
|
|
|
|
case a.updates <- msg:
|
|
|
|
break
|
|
|
|
return true
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return a
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// QueueUpdateDraw works like QueueUpdate() except it refreshes the screen
|
|
|
|
// QueueUpdateDraw works like QueueUpdate() except it refreshes the screen
|
|
|
|
// immediately after executing f.
|
|
|
|
// immediately after executing f.
|
|
|
|
func (a *Application) QueueUpdateDraw(
|
|
|
|
func (a *Application) QueueUpdateDraw(
|
|
|
|
f func(),
|
|
|
|
f func(),
|
|
|
|
) *Application {
|
|
|
|
) bool {
|
|
|
|
a.QueueUpdate(
|
|
|
|
return a.QueueUpdate(
|
|
|
|
func() {
|
|
|
|
func() {
|
|
|
|
f()
|
|
|
|
f()
|
|
|
|
a.draw()
|
|
|
|
a.draw()
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return a
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// QueueEvent sends an event to the Application event loop.
|
|
|
|
// QueueEvent sends an event to the Application event loop.
|
|
|
|