aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2024-05-12 17:19:49 -0400
committerSam Anthony <sam@samanthony.xyz>2024-05-12 17:19:49 -0400
commit0f90df6e1acbd2e3d085438c3a4851b6297dcd34 (patch)
tree1f3890454cbf3b0e52488707d4e7fc7b40eaf203
parent9dd70a042702b26b17086a4cf5bf478f34529c9c (diff)
downloadvolute-0f90df6e1acbd2e3d085438c3a4851b6297dcd34.zip
remove unnecessary loop labelsfaiface
-rw-r--r--gui/widget/input.go7
-rw-r--r--gui/widget/output.go5
2 files changed, 5 insertions, 7 deletions
diff --git a/gui/widget/input.go b/gui/widget/input.go
index 1e15da9..7d5f809 100644
--- a/gui/widget/input.go
+++ b/gui/widget/input.go
@@ -18,25 +18,24 @@ func Input(val chan<- uint, r image.Rectangle, focus FocusSlave, env gui.Env, wg
text := "0"
focused := false
env.Draw() <- inputDraw(text, focused, r)
-Loop:
for {
select {
case _, ok := <-focus.gain:
if !ok {
- break Loop
+ return
}
focused = true
env.Draw() <- inputDraw(text, focused, r)
case dir, ok := <-focus.lose:
if !ok {
- break Loop
+ return
}
focus.yield <- dir
focused = false
env.Draw() <- inputDraw(text, focused, r)
case event, ok := <-env.Events():
if !ok {
- break Loop
+ return
}
switch event := event.(type) {
case win.WiFocus:
diff --git a/gui/widget/output.go b/gui/widget/output.go
index 16aacca..8bd25b1 100644
--- a/gui/widget/output.go
+++ b/gui/widget/output.go
@@ -17,14 +17,13 @@ func Output(val <-chan float64, r image.Rectangle, env gui.Env, wg *sync.WaitGro
var v float64 = 0.0
env.Draw() <- outputDraw(v, r)
-Loop:
for {
select {
case v = <-val:
env.Draw() <- outputDraw(v, r)
case event, ok := <-env.Events():
- if !ok { // channel closed
- break Loop
+ if !ok {
+ return
}
if event, ok := event.(win.WiFocus); ok && event.Focused {
env.Draw() <- outputDraw(v, r)