Skip to content

Commit eb088a8

Browse files
authored
Merge branch 'develop' into efficient-runloop
2 parents fc3f109 + 739f0e6 commit eb088a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2308
-6217
lines changed

.github/workflows/platform_tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ jobs:
1414
include:
1515
- os: ubuntu-latest
1616
runner: xvfb-run
17+
tags: ci
1718
- os: macos-latest
18-
tags: no_glfw
19+
tags: no_glfw,ci
1920

2021
steps:
2122
- uses: actions/checkout@v4

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ More detailed release notes can be found on the [releases page](https://github.c
1616
* Odd looking SelectEntry with long PlaceHolder (#4430)
1717

1818

19+
## 2.5.4 - 1 February 2025
20+
21+
### Changed
22+
23+
* Added Tamil translation
24+
25+
### Fixed
26+
27+
* Checkbox not responding to click because it is too "large"? (#5331)
28+
* Fix progressbar not showing label until first refresh
29+
* FyneApp.toml causes BadLength error (#5272)
30+
* Test suite: failure with locale/language different from 'en' (#5362)
31+
* fix GridWrap crash when resizing to same size without creating renderer
32+
* Submenus not working on mobile (#5398)
33+
* Subtle scrolling bug in List when the last two items are of different size (#5281)
34+
* File picker does not ignore case (#5113)
35+
* Tab "OnSelected" doesn't appear to allow focussing tab content (#5454)
36+
* Documentation fixes
37+
>>>>>>> master
38+
39+
1940
## 2.5.3 - 15 December 2024
2041

2142
### Changed

app.go

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ type App interface {
6464
Lifecycle() Lifecycle
6565

6666
// Metadata returns the application metadata that was set at compile time.
67+
// The items of metadata are available after "fyne package" or when running "go run"
68+
// Building with "go build" may cause this to be unavailable.
6769
//
6870
// Since: 2.2
6971
Metadata() AppMetadata

app/app_windows.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,7 @@ func runScript(name, script string) {
9090
}
9191

9292
func watchTheme(s *settings) {
93-
go internalapp.WatchTheme(s.setupTheme)
93+
go internalapp.WatchTheme(func() {
94+
fyne.Do(s.setupTheme)
95+
})
9496
}

app/app_xdg.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ func watchTheme(s *settings) {
118118
// Theme lookup hangs on some desktops. Update theme variant cache from within goroutine.
119119
themeVariant := findFreedesktopColorScheme()
120120
internalapp.CurrentVariant.Store(uint64(themeVariant))
121-
s.applyVariant(themeVariant)
121+
fyne.Do(func() { s.applyVariant(themeVariant) })
122122

123123
portalSettings.OnSignalSettingChanged(func(changed portalSettings.Changed) {
124124
if changed.Namespace == appearance.Namespace && changed.Key == "color-scheme" {
125125
themeVariant := colorSchemeToThemeVariant(appearance.ColorScheme(changed.Value.(uint32)))
126126
internalapp.CurrentVariant.Store(uint64(themeVariant))
127-
s.applyVariant(themeVariant)
127+
fyne.Do(func() { s.applyVariant(themeVariant) })
128128
}
129129
})
130130
}()

app/cloud_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ func TestFyneApp_transitionCloud(t *testing.T) {
4545
a.Preferences().AddChangeListener(func() {
4646
preferenceChanged = true
4747
})
48-
a.Settings().AddChangeListener(settingsChan)
48+
a.Settings().AddListener(func(s fyne.Settings) {
49+
go func() { settingsChan <- s }()
50+
})
4951

5052
done := make(chan struct{})
5153
go func() {

app/settings.go

+6-25
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"os"
66
"path/filepath"
7-
"sync"
87

98
"fyne.io/fyne/v2"
109
"fyne.io/fyne/v2/internal/app"
@@ -33,17 +32,14 @@ func (sc *SettingsSchema) StoragePath() string {
3332
var _ fyne.Settings = (*settings)(nil)
3433

3534
type settings struct {
36-
propertyLock sync.RWMutex
3735
theme fyne.Theme
3836
themeSpecified bool
3937
variant fyne.ThemeVariant
4038

39+
listeners []func(fyne.Settings)
4140
changeListeners async.Map[chan fyne.Settings, bool]
4241
watcher any // normally *fsnotify.Watcher or nil - avoid import in this file
4342

44-
changeListenerFuncsMutex sync.Mutex
45-
changeListenerFuncs []func(fyne.Settings)
46-
4743
schema SettingsSchema
4844
}
4945

@@ -52,8 +48,6 @@ func (s *settings) BuildType() fyne.BuildType {
5248
}
5349

5450
func (s *settings) PrimaryColor() string {
55-
s.propertyLock.RLock()
56-
defer s.propertyLock.RUnlock()
5751
return s.schema.PrimaryColor
5852
}
5953

@@ -62,8 +56,6 @@ func (s *settings) PrimaryColor() string {
6256
//
6357
// Deprecated: Use container.NewThemeOverride to change the appearance of part of your application.
6458
func (s *settings) OverrideTheme(theme fyne.Theme, name string) {
65-
s.propertyLock.Lock()
66-
defer s.propertyLock.Unlock()
6759
s.schema.PrimaryColor = name
6860
s.theme = theme
6961
}
@@ -73,8 +65,6 @@ func (s *settings) Theme() fyne.Theme {
7365
fyne.LogError("Attempt to access current Fyne theme when no app is started", nil)
7466
return nil
7567
}
76-
s.propertyLock.RLock()
77-
defer s.propertyLock.RUnlock()
7868
return s.theme
7969
}
8070

@@ -92,23 +82,17 @@ func (s *settings) ThemeVariant() fyne.ThemeVariant {
9282
}
9383

9484
func (s *settings) applyTheme(theme fyne.Theme, variant fyne.ThemeVariant) {
95-
s.propertyLock.Lock()
96-
defer s.propertyLock.Unlock()
9785
s.variant = variant
9886
s.theme = theme
9987
s.apply()
10088
}
10189

10290
func (s *settings) applyVariant(variant fyne.ThemeVariant) {
103-
s.propertyLock.Lock()
104-
defer s.propertyLock.Unlock()
10591
s.variant = variant
10692
s.apply()
10793
}
10894

10995
func (s *settings) Scale() float32 {
110-
s.propertyLock.RLock()
111-
defer s.propertyLock.RUnlock()
11296
if s.schema.Scale < 0.0 {
11397
return 1.0 // catching any really old data still using the `-1` value for "auto" scale
11498
}
@@ -119,10 +103,8 @@ func (s *settings) AddChangeListener(listener chan fyne.Settings) {
119103
s.changeListeners.Store(listener, true) // the boolean is just a dummy value here.
120104
}
121105

122-
func (s *settings) AddChangeListenerFunc(f func(fyne.Settings)) {
123-
s.changeListenerFuncsMutex.Lock()
124-
s.changeListenerFuncs = append(s.changeListenerFuncs, f)
125-
s.changeListenerFuncsMutex.Unlock()
106+
func (s *settings) AddListener(listener func(fyne.Settings)) {
107+
s.listeners = append(s.listeners, listener)
126108
}
127109

128110
func (s *settings) apply() {
@@ -135,11 +117,10 @@ func (s *settings) apply() {
135117
}
136118
return true
137119
})
138-
s.changeListenerFuncsMutex.Lock()
139-
for _, f := range s.changeListenerFuncs {
140-
f(s)
120+
121+
for _, l := range s.listeners {
122+
l(s)
141123
}
142-
s.changeListenerFuncsMutex.Unlock()
143124
}
144125

145126
func (s *settings) fileChanged() {

cmd/fyne_demo/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ func makeNav(setTutorial func(tutorial tutorials.Tutorial), loadPrevious bool) f
229229
OnSelected: func(uid string) {
230230
if t, ok := tutorials.Tutorials[uid]; ok {
231231
for _, f := range tutorials.OnChangeFuncs {
232-
f(uid)
232+
f()
233233
}
234234
tutorials.OnChangeFuncs = nil // Loading a page registers a new cleanup.
235235

cmd/fyne_demo/tutorials/advanced.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,7 @@ func advancedScreen(win fyne.Window) fyne.CanvasObject {
3737
))
3838

3939
ticker := time.NewTicker(time.Second)
40-
41-
OnChangeFuncs = append(OnChangeFuncs, func(page string) {
42-
if page != "advanced" {
43-
ticker.Stop()
44-
}
45-
})
40+
OnChangeFuncs = append(OnChangeFuncs, ticker.Stop)
4641

4742
go func(canvas fyne.Canvas) {
4843
for range ticker.C {

cmd/fyne_demo/tutorials/animation.go

+2-14
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ func makeAnimationCanvas() fyne.CanvasObject {
4646
a2.Curve = fyne.AnimationLinear
4747
a2.Start()
4848

49-
OnChangeFuncs = append(OnChangeFuncs, func(page string) {
50-
if page != "animations" {
51-
a.Stop()
52-
a2.Stop()
53-
}
54-
})
49+
OnChangeFuncs = append(OnChangeFuncs, a.Stop, a2.Stop)
5550

5651
running := true
5752
var toggle *widget.Button
@@ -78,14 +73,7 @@ func makeAnimationCurves() fyne.CanvasObject {
7873
label3, box3, a3 := makeAnimationCurveItem("EaseOut", fyne.AnimationEaseOut, 60+theme.Padding()*2)
7974
label4, box4, a4 := makeAnimationCurveItem("Linear", fyne.AnimationLinear, 90+theme.Padding()*3)
8075

81-
OnChangeFuncs = append(OnChangeFuncs, func(page string) {
82-
if page != "animations" {
83-
a1.Stop()
84-
a2.Stop()
85-
a3.Stop()
86-
a4.Stop()
87-
}
88-
})
76+
OnChangeFuncs = append(OnChangeFuncs, a1.Stop, a2.Stop, a3.Stop, a4.Stop)
8977

9078
start := widget.NewButton("Compare", func() {
9179
a1.Start()

cmd/fyne_demo/tutorials/canvas.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ func canvasScreen(_ fyne.Window) fyne.CanvasObject {
2222
gradient := canvas.NewHorizontalGradient(color.NRGBA{0x80, 0, 0, 0xff}, color.NRGBA{0, 0x80, 0, 0xff})
2323
ticker := time.NewTicker(time.Second)
2424

25-
OnChangeFuncs = append(OnChangeFuncs, func(page string) {
26-
if page != "canvas" {
27-
ticker.Stop()
28-
}
29-
})
25+
OnChangeFuncs = append(OnChangeFuncs, ticker.Stop)
3026

3127
go func() {
3228
for range ticker.C {

cmd/fyne_demo/tutorials/container.go

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package tutorials
33
import (
44
"fmt"
55
"image/color"
6+
"log"
67
"strconv"
78

89
"fyne.io/fyne/v2"
@@ -116,6 +117,12 @@ func makeInnerWindowTab(_ fyne.Window) fyne.CanvasObject {
116117
label.SetText("Tapped")
117118
})))
118119
win1.Icon = data.FyneLogo
120+
win1.OnMaximized = func() {
121+
log.Println("Should maximize here")
122+
}
123+
win1.OnMinimized = func() {
124+
log.Println("Should minimize here")
125+
}
119126

120127
win2 := container.NewInnerWindow("Inner2", widget.NewLabel("Win 2"))
121128

cmd/fyne_demo/tutorials/data.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
// OnChangeFuncs is a slice of functions that can be registered
88
// to run when the user switches tutorial.
9-
var OnChangeFuncs []func(string)
9+
var OnChangeFuncs []func()
1010

1111
// Tutorial defines the data structure for a tutorial
1212
type Tutorial struct {

cmd/fyne_demo/tutorials/welcome.go

+9-15
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,15 @@ func welcomeScreen(_ fyne.Window) fyne.CanvasObject {
5959
slideBG := container.New(underlayer, underlay)
6060
footerBG := canvas.NewRectangle(shadowColor)
6161

62-
listen := make(chan fyne.Settings)
63-
fyne.CurrentApp().Settings().AddChangeListener(listen)
64-
go func() {
65-
for range listen {
66-
fyne.Do(func() {
67-
bgColor = withAlpha(theme.Color(theme.ColorNameBackground), 0xe0)
68-
bg.FillColor = bgColor
69-
bg.Refresh()
70-
71-
shadowColor = withAlpha(theme.Color(theme.ColorNameBackground), 0x33)
72-
footerBG.FillColor = bgColor
73-
footer.Refresh()
74-
})
75-
}
76-
}()
62+
fyne.CurrentApp().Settings().AddListener(func(fyne.Settings) {
63+
bgColor = withAlpha(theme.Color(theme.ColorNameBackground), 0xe0)
64+
bg.FillColor = bgColor
65+
bg.Refresh()
66+
67+
shadowColor = withAlpha(theme.Color(theme.ColorNameBackground), 0x33)
68+
footerBG.FillColor = bgColor
69+
footer.Refresh()
70+
})
7771

7872
underlay.Resize(fyne.NewSize(1024, 1024))
7973
scroll.OnScrolled = func(p fyne.Position) {

cmd/fyne_demo/tutorials/widget.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -418,12 +418,7 @@ func makeProgressTab(_ fyne.Window) fyne.CanvasObject {
418418

419419
progressAnimation.Start()
420420

421-
OnChangeFuncs = append(OnChangeFuncs, func(page string) {
422-
if page != "progress" {
423-
progressAnimation.Stop()
424-
infProgress.Stop()
425-
}
426-
})
421+
OnChangeFuncs = append(OnChangeFuncs, progressAnimation.Stop, infProgress.Stop)
427422

428423
return container.NewVBox(
429424
widget.NewLabel("Percent"), progress,

0 commit comments

Comments
 (0)