render: clean up render code
The render method sets everything as invalid if there was a popover. This is no longer necessary, as everything is redrawn anyways. Remove the check and extra atomic set of dirty and invalidate. Remove unused return value Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
bb1249164d
commit
725fe07d24
1 changed files with 1 additions and 11 deletions
12
lib/ui/ui.go
12
lib/ui/ui.go
|
@ -79,16 +79,9 @@ func (state *UI) Close() {
|
||||||
state.screen.Fini()
|
state.screen.Fini()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (state *UI) Render() bool {
|
func (state *UI) Render() {
|
||||||
more := false
|
|
||||||
|
|
||||||
wasInvalid := atomic.SwapInt32(&state.invalid, 0)
|
wasInvalid := atomic.SwapInt32(&state.invalid, 0)
|
||||||
if wasInvalid != 0 {
|
if wasInvalid != 0 {
|
||||||
if state.popover != nil {
|
|
||||||
// if the previous frame had a popover, rerender the entire display
|
|
||||||
state.Content.Invalidate()
|
|
||||||
atomic.StoreInt32(&state.invalid, 0)
|
|
||||||
}
|
|
||||||
// reset popover for the next Draw
|
// reset popover for the next Draw
|
||||||
state.popover = nil
|
state.popover = nil
|
||||||
state.Content.Draw(state.ctx)
|
state.Content.Draw(state.ctx)
|
||||||
|
@ -97,10 +90,7 @@ func (state *UI) Render() bool {
|
||||||
state.popover.Draw(state.ctx)
|
state.popover.Draw(state.ctx)
|
||||||
}
|
}
|
||||||
state.screen.Show()
|
state.screen.Show()
|
||||||
more = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return more
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (state *UI) EnableMouse() {
|
func (state *UI) EnableMouse() {
|
||||||
|
|
Loading…
Reference in a new issue