aboutsummaryrefslogtreecommitdiffstats
path: root/gui/widget
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-05-12 17:18:01 -0400
committerSam Anthony <sam@samanthony.xyz>2024-05-12 17:18:01 -0400
commit9dd70a042702b26b17086a4cf5bf478f34529c9c (patch)
tree58c922db4cdf788f6e6690fae885f004336bb445 /gui/widget
parent61a63fec579f88766c6be0d392bb4eaed3b8564a (diff)
downloadvolute-9dd70a042702b26b17086a4cf5bf478f34529c9c.zip
rename struct fields and add comment
Diffstat (limited to 'gui/widget')
-rw-r--r--gui/widget/button.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/gui/widget/button.go b/gui/widget/button.go
index fe2f30b..4ef5ef4 100644
--- a/gui/widget/button.go
+++ b/gui/widget/button.go
@@ -10,9 +10,10 @@ import (
"volute/gui/win"
)
+// Sends signal over tx when Enter is pressed while focused.
func Button[T any](
- signal chan<- T,
- val T,
+ tx chan<- T,
+ signal T,
label string,
r image.Rectangle,
focus FocusSlave,
@@ -20,7 +21,7 @@ func Button[T any](
wg *sync.WaitGroup,
) {
defer wg.Done()
- defer close(signal)
+ defer close(tx)
focused := false
env.Draw() <- buttonDraw(label, focused, r)
@@ -44,7 +45,7 @@ func Button[T any](
return
}
if event, ok := event.(win.KbDown); ok && focused && event.Key == win.KeyEnter {
- signal <- val
+ tx <- signal
}
}
}