From 725fe07d240b035205e48fba3af3de6dc0ddc9d2 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Thu, 6 Oct 2022 11:46:42 -0500 Subject: [PATCH] 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 Acked-by: Robin Jarry --- lib/ui/ui.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/ui/ui.go b/lib/ui/ui.go index e29ab13..42d584f 100644 --- a/lib/ui/ui.go +++ b/lib/ui/ui.go @@ -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() {