From 46ea1968b65055b1a665d34f26284efe95723f46 Mon Sep 17 00:00:00 2001 From: aynakeya Date: Wed, 16 Jul 2025 22:43:11 +0800 Subject: [PATCH] downgrade fyne to v2.5.5 --- go.mod | 26 ++++++++++++-------------- gui/component/button.go | 6 +++++- gui/gutil/fyne.go | 18 ++++++++++++------ gui/player_controller.go | 2 +- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index 14ce493..8891063 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ replace ( ) require ( - fyne.io/fyne/v2 v2.6.1 + fyne.io/fyne/v2 v2.5.5 github.com/AynaLivePlayer/liveroom-sdk v0.1.0 github.com/AynaLivePlayer/miaosic v0.2.3 github.com/adrg/libvlc-go/v3 v3.1.6 @@ -33,14 +33,14 @@ require ( github.com/virtuald/go-paniclog v0.0.0-20190812204905-43a7fa316459 go.uber.org/zap v1.27.0 golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b - golang.org/x/sys v0.33.0 + golang.org/x/sys v0.34.0 gopkg.in/ini.v1 v1.67.0 ) require ( - fyne.io/systray v1.11.0 // indirect - github.com/AynaLivePlayer/blivedm-go v0.0.0-20250527143915-74cc4b2603bc // indirect - github.com/BurntSushi/toml v1.4.0 // indirect + fyne.io/systray v1.11.1-0.20250603113521-ca66a66d8b58 // indirect + github.com/AynaLivePlayer/blivedm-go v0.0.0-20250629154348-690af765bfbc // indirect + github.com/BurntSushi/toml v1.5.0 // indirect github.com/PuerkitoBio/goquery v1.10.3 // indirect github.com/XiaoMengXinX/Music163Api-Go v0.1.30 // indirect github.com/andybalholm/brotli v1.1.0 // indirect @@ -50,19 +50,16 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8 // indirect github.com/fredbi/uri v1.1.0 // indirect - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/fyne-io/gl-js v0.1.0 // indirect - github.com/fyne-io/glfw-js v0.2.0 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/fyne-io/gl-js v0.2.0 // indirect + github.com/fyne-io/glfw-js v0.3.0 // indirect github.com/fyne-io/image v0.1.1 // indirect - github.com/fyne-io/oksvg v0.1.0 // indirect github.com/go-gl/gl v0.0.0-20231021071112-07e5d0ea2e71 // indirect github.com/go-text/render v0.2.0 // indirect github.com/go-text/typesetting v0.2.1 // indirect github.com/godbus/dbus/v5 v5.1.0 // indirect github.com/google/uuid v1.5.0 // indirect - github.com/hack-pad/go-indexeddb v0.3.2 // indirect - github.com/hack-pad/safejs v0.1.0 // indirect - github.com/jeandeaual/go-locale v0.0.0-20241217141322-fcc2cadd6f08 // indirect + github.com/jeandeaual/go-locale v0.0.0-20250612000132-0ef82f21eade // indirect github.com/jinzhu/copier v0.4.0 // indirect github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 // indirect github.com/makiuchi-d/gozxing v0.1.1 // indirect @@ -80,8 +77,9 @@ require ( github.com/yuin/goldmark v1.7.8 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/image v0.24.0 // indirect - golang.org/x/net v0.41.0 // indirect - golang.org/x/text v0.26.0 // indirect + golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect + golang.org/x/net v0.42.0 // indirect + golang.org/x/text v0.27.0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/gui/component/button.go b/gui/component/button.go index 8e77113..933a5d0 100644 --- a/gui/component/button.go +++ b/gui/component/button.go @@ -1,6 +1,7 @@ package component import ( + "AynaLivePlayer/gui/gutil" "fyne.io/fyne/v2" "fyne.io/fyne/v2/widget" ) @@ -38,7 +39,10 @@ func (b *AsyncButton) SetOnTapped(f func()) { go func() { f() //time.Sleep(3 * time.Second) - fyne.Do(b.Enable) + // todo use fyne.Do after upgrade to v2.6.x + gutil.RunInFyneThread(b.Enable) + //b.Enable() + //fyne.Do(b.Enable) }() } } diff --git a/gui/gutil/fyne.go b/gui/gutil/fyne.go index 985bdb8..3f3c119 100644 --- a/gui/gutil/fyne.go +++ b/gui/gutil/fyne.go @@ -2,14 +2,20 @@ package gutil import ( "AynaLivePlayer/pkg/event" - "fyne.io/fyne/v2" ) // since 2.6.1, calls to fyne API from other go routine must be wrapped in fyne.Do func ThreadSafeHandler(fn func(e *event.Event)) func(e *event.Event) { - return func(e *event.Event) { - fyne.Do(func() { - fn(e) - }) - } + return fn + // todo: uncomment this after 2.6.x become stable + //return func(e *event.Event) { + // fyne.Do(func() { + // fn(e) + // }) + //} +} + +func RunInFyneThread(fn func()) { + fn() + //fyne.Do(fn) } diff --git a/gui/player_controller.go b/gui/player_controller.go index 1931785..3aca8c3 100644 --- a/gui/player_controller.go +++ b/gui/player_controller.go @@ -176,7 +176,7 @@ func registerPlayControllerHandler() { return } PlayController.Cover.Resource = pic.Resource - fyne.Do(PlayController.Cover.Refresh) + gutil.RunInFyneThread(PlayController.Cover.Refresh) } }()