From a995e9ea6cba33067fad86f53d65041265910a61 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Thu, 27 Feb 2020 08:35:08 +0100 Subject: [PATCH] widget: remove unused Button.prevClicks It was left over from a previous approach to enable the program to decide the ordering between calls to Layout vs Clicked. Signed-off-by: Elias Naur --- widget/button.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/widget/button.go b/widget/button.go index 24cc8d11..2c9a37d1 100644 --- a/widget/button.go +++ b/widget/button.go @@ -14,11 +14,8 @@ import ( type Button struct { click gesture.Click // clicks tracks the number of unreported clicks. - clicks int - // prevClicks tracks the number of unreported clicks - // that belong to the previous frame. - prevClicks int - history []Click + clicks int + history []Click } // Click represents a historic click. @@ -31,9 +28,6 @@ func (b *Button) Clicked(gtx *layout.Context) bool { b.processEvents(gtx) if b.clicks > 0 { b.clicks-- - if b.prevClicks > 0 { - b.prevClicks-- - } if b.clicks > 0 { // Ensure timely delivery of remaining clicks. op.InvalidateOp{}.Add(gtx.Ops) @@ -49,8 +43,6 @@ func (b *Button) History() []Click { func (b *Button) Layout(gtx *layout.Context) { // Flush clicks from before the previous frame. - b.clicks -= b.prevClicks - b.prevClicks = 0 b.processEvents(gtx) b.click.Add(gtx.Ops) for len(b.history) > 0 {