From cccc8a7de8781970d025727c4e4ba843e88ae6a4 Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Wed, 21 Jan 2026 08:49:27 -0800 Subject: [PATCH] Fix #804: update to fyne develop for rectangle paint bug fix, optimize peak meter refresh --- go.mod | 5 +++-- go.sum | 10 ++++++---- ui/visualizations/peakmeter.go | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index a025346..e585fb9 100644 --- a/go.mod +++ b/go.mod @@ -33,8 +33,9 @@ require ( require ( al.essio.dev/pkg/shellescape v1.5.1 // indirect - fyne.io/systray v1.11.1-0.20250603113521-ca66a66d8b58 // indirect + fyne.io/systray v1.12.0 // indirect github.com/BurntSushi/toml v1.5.0 // indirect + github.com/FyshOS/fancyfs v0.0.0-20251025194026-1f03098ff624 // indirect github.com/danieljoos/wincred v1.2.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/fredbi/uri v1.1.1 // indirect @@ -67,7 +68,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace fyne.io/fyne/v2 v2.7.1 => github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20251115180245-c1288f7754ab +replace fyne.io/fyne/v2 v2.7.1 => github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20260121163844-a0f2c1dd0601 replace github.com/go-audio/wav v1.1.0 => github.com/dweymouth/go-wav v0.0.0-20250719173115-e60429a83eb0 diff --git a/go.sum b/go.sum index c5193bc..991f2e8 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,13 @@ al.essio.dev/pkg/shellescape v1.5.1 h1:86HrALUujYS/h+GtqoB26SBEdkWfmMI6FubjXlsXyho= al.essio.dev/pkg/shellescape v1.5.1/go.mod h1:6sIqp7X2P6mThCQ7twERpZTuigpr6KbZWtls1U8I890= -fyne.io/systray v1.11.1-0.20250603113521-ca66a66d8b58 h1:eA5/u2XRd8OUkoMqEv3IBlFYSruNlXD8bRHDiqm0VNI= -fyne.io/systray v1.11.1-0.20250603113521-ca66a66d8b58/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs= +fyne.io/systray v1.12.0 h1:CA1Kk0e2zwFlxtc02L3QFSiIbxJ/P0n582YrZHT7aTM= +fyne.io/systray v1.12.0/go.mod h1:RVwqP9nYMo7h5zViCBHri2FgjXF7H2cub7MAq4NSoLs= github.com/20after4/configdir v0.1.1 h1:ylL5dO+aGxBV4jDtG9Ej9hZfeE8Fw9jULQVq0N+ErJ8= github.com/20after4/configdir v0.1.1/go.mod h1:kZ7yOiD6MFUABqBI2/N62QA1wyEB8sGeI+mygme1pl4= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= +github.com/FyshOS/fancyfs v0.0.0-20251025194026-1f03098ff624 h1:ryzrudl71BPWW9jalH/6qSXOmj/B96lunzJEi6zuuR4= +github.com/FyshOS/fancyfs v0.0.0-20251025194026-1f03098ff624/go.mod h1:oLKntpN0BPY75aajV735V/14CnSF/GEHCa6mKNDhOjw= github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/boxes-ltd/imaging v1.7.1 h1:JlfPQkr9sowLuPY24OLNw1Wa0UjriPVo2BN0YyxdCf0= @@ -25,8 +27,8 @@ github.com/dweymouth/fyne-advanced-list v0.0.0-20250211191927-58ea85eec72c h1:UX github.com/dweymouth/fyne-advanced-list v0.0.0-20250211191927-58ea85eec72c/go.mod h1:Idgzr4LYzve8IPHF1stLO1bdGQZnDKt/bT9WfJflCGw= github.com/dweymouth/fyne-tooltip v0.3.0 h1:NKCyTkh9NtvnTsiHtTOtaJzRDOFYP8AckQ2tyhOh6JY= github.com/dweymouth/fyne-tooltip v0.3.0/go.mod h1:m04ShLW/Tp6LXrNieTumApvNgo7YSB+wi+jZTN+kDBU= -github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20251115180245-c1288f7754ab h1:3a3Dop0y5uGYSgjoyReYlwZqpo7xFQu+tULfZueCjEQ= -github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20251115180245-c1288f7754ab/go.mod h1:xClVlrhxl7D+LT+BWYmcrW4Nf+dJTvkhnPgji7spAwE= +github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20260121163844-a0f2c1dd0601 h1:Z75H0KinbkuXn0y/+vFB4R6jvwgwHkgCivvPT5fIYcc= +github.com/dweymouth/fyne/v2 v2.3.0-rc1.0.20260121163844-a0f2c1dd0601/go.mod h1:M3Fkb8eUU6se8E+coikK8x7f3vCIakxAW7bPyw3d9fA= github.com/dweymouth/go-jellyfin v0.0.0-20250928223159-bd2fb9681ef5 h1:Or5VJodg7cGmdnBIcS+FrEH0twBi7mZsFCz6V0vCOQI= github.com/dweymouth/go-jellyfin v0.0.0-20250928223159-bd2fb9681ef5/go.mod h1:fcUagHBaQnt06GmBAllNE0J4O/7064zXRWdqnTTtVjI= github.com/dweymouth/go-wav v0.0.0-20250719173115-e60429a83eb0 h1:mYcctuWgVArHhSLJxndlUM43C3hoE18BLDBkXKM2tl0= diff --git a/ui/visualizations/peakmeter.go b/ui/visualizations/peakmeter.go index 5da0135..67296c8 100644 --- a/ui/visualizations/peakmeter.go +++ b/ui/visualizations/peakmeter.go @@ -32,6 +32,10 @@ type PeakMeter struct { lPeakHoldFrame uint64 rPeakHoldFrame uint64 frameCounter uint64 + + // true iff only a layout is needed, rathern than a full refresh. + // cleared by the renderer + refreshLayoutOnly bool } func NewPeakMeter() *PeakMeter { @@ -68,6 +72,7 @@ func (p *PeakMeter) UpdatePeaks(lPeak, rPeak, lRMS, rRMS float64) { } p.frameCounter++ + p.refreshLayoutOnly = true p.Refresh() } @@ -75,6 +80,11 @@ func (p *PeakMeter) CreateRenderer() fyne.WidgetRenderer { return newPeakMeterRenderer(p) } +func (p *PeakMeter) Refresh() { + p.refreshLayoutOnly = false + p.BaseWidget.Refresh() +} + type peakMeterRenderer struct { p *PeakMeter @@ -168,6 +178,12 @@ func (l *peakMeterRenderer) Layout(size fyne.Size) { } func (l *peakMeterRenderer) Refresh() { + if l.p.refreshLayoutOnly { + l.p.refreshLayoutOnly = false + l.Layout(l.p.Size()) + return + } + foreground := theme.ForegroundColor() background := theme.BackgroundColor() errC := theme.ErrorColor()