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:
Tim Culverhouse 2022-10-06 11:46:42 -05:00 committed by Robin Jarry
parent bb1249164d
commit 725fe07d24
1 changed files with 1 additions and 11 deletions

View File

@ -79,16 +79,9 @@ func (state *UI) Close() {
state.screen.Fini()
}
func (state *UI) Render() bool {
more := false
func (state *UI) Render() {
wasInvalid := atomic.SwapInt32(&state.invalid, 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
state.popover = nil
state.Content.Draw(state.ctx)
@ -97,10 +90,7 @@ func (state *UI) Render() bool {
state.popover.Draw(state.ctx)
}
state.screen.Show()
more = true
}
return more
}
func (state *UI) EnableMouse() {