Skip to content

Commit 66c8de3

Browse files
committed
Merge branch 'release/v2.6.x'
2 parents a276e57 + 7ffd028 commit 66c8de3

File tree

15 files changed

+140
-18
lines changed

15 files changed

+140
-18
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
This file lists the main changes with each version of the Fyne toolkit.
44
More detailed release notes can be found on the [releases page](https://github.com/fyne-io/fyne/releases).
55

6+
## 2.6.1 - 8 May 2025
7+
8+
### Changed
9+
10+
* Added Russian translations
11+
12+
### Fixed
13+
14+
* Activity indicator is light and not visible when a light theme is active (#5661)
15+
* Unsafe use of map in RichText on 2.6.0 (#5639)
16+
* Image translucency causes blurriness on small icons (#5476)
17+
* Infinite progress bar snapping and doesn't loop nicely (#5433)
18+
* RichTextSegment SizeName is not SizeNameText by default (#5307)
19+
* When there is an offline netdrive, the file dialog will freeze (#2411)
20+
* Correctly reset image cache when Resource goes to nil
21+
* Data race after migration to v2.6.0 (#5713)
22+
623
## 2.6.0 - 10 April 2025
724

825
### Added

canvas/image.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ type Image struct {
7070
Translucency float64 // Set a translucency value > 0.0 to fade the image
7171
FillMode ImageFill // Specify how the image should expand to fill or fit the available space
7272
ScaleMode ImageScale // Specify the type of scaling interpolation applied to the image
73+
74+
previousRender bool // did we successfully draw before? if so a nil content will need a reset
7375
}
7476

7577
// Alpha is a convenience function that returns the alpha value for an image
@@ -131,6 +133,11 @@ func (i *Image) Refresh() {
131133
return
132134
}
133135
rc = io.NopCloser(r)
136+
} else if i.previousRender {
137+
i.previousRender = false
138+
139+
Refresh(i)
140+
return
134141
} else {
135142
return
136143
}
@@ -165,6 +172,7 @@ func (i *Image) Refresh() {
165172
}
166173
}
167174

175+
i.previousRender = true
168176
Refresh(i)
169177
}
170178

canvas/image_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ import (
99
"strings"
1010
"testing"
1111

12+
"fyne.io/fyne/v2"
1213
"fyne.io/fyne/v2/canvas"
1314
"fyne.io/fyne/v2/storage"
1415
_ "fyne.io/fyne/v2/test"
16+
"fyne.io/fyne/v2/theme"
1517

1618
"github.com/stretchr/testify/assert"
1719
)
@@ -28,6 +30,22 @@ func TestImage_TranslucencyDefault(t *testing.T) {
2830
assert.Equal(t, 0.0, img.Translucency)
2931
}
3032

33+
func TestImage_RefreshBlank(t *testing.T) {
34+
img := &canvas.Image{}
35+
img.Resize(fyne.NewSize(64, 64))
36+
img.Refresh()
37+
assert.Nil(t, img.Image)
38+
39+
img.Resource = theme.HomeIcon()
40+
img.Refresh()
41+
assert.NotNil(t, img.Image)
42+
43+
img.Image = nil
44+
img.Resource = nil
45+
img.Refresh()
46+
assert.Nil(t, img.Image)
47+
}
48+
3149
func TestNewImageFromFile(t *testing.T) {
3250
pwd, _ := os.Getwd()
3351
path := filepath.Join(filepath.Dir(pwd), "theme", "icons", "fyne.png")

internal/driver/glfw/loop.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type funcData struct {
2121

2222
// channel for queuing functions on the main thread
2323
var funcQueue = async.NewUnboundedChan[funcData]()
24-
var running atomic.Bool
24+
var running, drained atomic.Bool
2525

2626
// Arrange that main.main runs on main thread.
2727
func init() {
@@ -36,9 +36,9 @@ func runOnMain(f func()) {
3636

3737
// force a function f to run on the main thread and specify if we should wait for it to return
3838
func runOnMainWithWait(f func(), wait bool) {
39-
// If we are on main just execute - otherwise add it to the main queue and wait.
40-
// The "running" variable is normally false when we are on the main thread.
41-
if !running.Load() {
39+
// If we are on main before app run just execute - otherwise add it to the main queue and wait.
40+
// We also need to run it as-is if the app is in the process of shutting down as the queue will be stopped.
41+
if (!running.Load() && async.IsMainGoroutine()) || drained.Load() {
4242
f()
4343
return
4444
}
@@ -130,6 +130,16 @@ func (d *gLDriver) runGL() {
130130
if f := l.OnStopped(); f != nil {
131131
l.QueueEvent(f)
132132
}
133+
134+
// as we are shutting down make sure we drain the pending funcQueue and close it out.
135+
for len(funcQueue.Out()) > 0 {
136+
f := <-funcQueue.Out()
137+
if f.done != nil {
138+
f.done <- struct{}{}
139+
}
140+
}
141+
drained.Store(true)
142+
funcQueue.Close()
133143
return
134144
case f := <-funcQueue.Out():
135145
f.f()

internal/painter/gl/draw.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,10 @@ func (p *painter) drawTextureWithDetails(o fyne.CanvasObject, creator func(canva
264264
p.defineVertexArray(p.program, "vert", 3, 5, 0)
265265
p.defineVertexArray(p.program, "vertTexCoord", 2, 5, 3)
266266

267-
if alpha != 1.0 {
268-
p.ctx.BlendColor(alpha, alpha, alpha, alpha)
269-
p.ctx.BlendFunc(constantAlpha, oneMinusConstantAlpha)
270-
} else {
271-
p.ctx.BlendFunc(one, oneMinusSrcAlpha)
272-
}
267+
vertAttrib := p.ctx.GetUniformLocation(p.program, "alpha")
268+
p.ctx.Uniform1f(vertAttrib, alpha)
269+
270+
p.ctx.BlendFunc(one, oneMinusSrcAlpha)
273271
p.logError()
274272

275273
p.ctx.ActiveTexture(texture0)

internal/painter/gl/shaders.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/painter/gl/shaders/simple.frag

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
uniform sampler2D tex;
44

55
varying vec2 fragTexCoord;
6+
varying float fragAlpha;
67

78
void main() {
89
vec4 texColor = texture2D(tex, fragTexCoord);
10+
texColor.a *= fragAlpha;
11+
texColor.r *= fragAlpha;
12+
texColor.g *= fragAlpha;
13+
texColor.b *= fragAlpha;
14+
915
if(texColor.a < 0.01)
1016
discard;
1117
gl_FragColor = texColor;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#version 110
22

3+
uniform float alpha;
4+
35
attribute vec3 vert;
46
attribute vec2 vertTexCoord;
7+
58
varying vec2 fragTexCoord;
9+
varying float fragAlpha;
610

711
void main() {
812
fragTexCoord = vertTexCoord;
13+
fragAlpha = alpha;
914

1015
gl_Position = vec4(vert, 1);
1116
}

internal/painter/gl/shaders/simple_es.frag

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@ precision lowp sampler2D;
1313
uniform sampler2D tex;
1414

1515
varying vec2 fragTexCoord;
16+
varying float fragAlpha;
1617

1718
void main() {
1819
vec4 texColor = texture2D(tex, fragTexCoord);
20+
texColor.a *= fragAlpha;
21+
texColor.r *= fragAlpha;
22+
texColor.g *= fragAlpha;
23+
texColor.b *= fragAlpha;
24+
1925
if(texColor.a < 0.01)
2026
discard;
2127
gl_FragColor = texColor;

internal/painter/gl/shaders/simple_es.vert

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ precision mediump int;
1010
precision lowp sampler2D;
1111
#endif
1212

13+
uniform float alpha;
14+
1315
attribute vec3 vert;
1416
attribute vec2 vertTexCoord;
17+
1518
varying vec2 fragTexCoord;
19+
varying float fragAlpha;
1620

1721
void main() {
1822
fragTexCoord = vertTexCoord;
23+
fragAlpha = alpha;
1924

2025
gl_Position = vec4(vert, 1);
2126
}

0 commit comments

Comments
 (0)