Skip to content

Commit

Permalink
Merge branch 'release/v2.3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed May 3, 2023
2 parents 018a2e1 + d30f691 commit 6558290
Show file tree
Hide file tree
Showing 320 changed files with 21,276 additions and 44,629 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/platform_tests.yml
Expand Up @@ -21,7 +21,7 @@ jobs:
go-version: ${{ matrix.go-version }}

- name: Get dependencies
run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev libwayland-dev libxkbcommon-dev bc
run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libx11-dev xorg-dev libwayland-dev libxkbcommon-dev bc
if: ${{ runner.os == 'Linux' }}

- name: Tests
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS
Expand Up @@ -7,7 +7,7 @@ Tilo Prütz <tilo@pruetz.net>
Stephen Houston <smhouston88@gmail.com>
Storm Hess <stormhess@gloryskulls.com>
Stuart Scott <stuart.murray.scott@gmail.com>
Jacob Alzén <>
Jacob Alzén <jacalz@tutanota.com>
Charles A. Daniels <charles@cdaniels.net>
Pablo Fuentes <f.pablo1@hotmail.com>
Changkun Ou <hi@changkun.de>
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,12 +3,29 @@
This file lists the main changes with each version of the Fyne toolkit.
More detailed release notes can be found on the [releases page](https://github.com/fyne-io/fyne/releases).

## 2.3.4 - 3 May 2023

### Fixed

* Memory leak when switching theme (#3640)
* Systray MenuItem separators not rendered in macOS root menu (#3759)
* Systray leaks window handles on Windows (#3760)
* RadioGroup miscalculates label widths in horizontal mode (#3386)
* Start of selection in entry is shifted when moving too fast (#3804)
* Performance issue in widget.List (#3816)
* Moving canvas items (e.g. Images) does not cause canvas repaint (#2205)
* Minor graphic glitch with checkbox (#3792)
* VBox and HBox using heap memory that was not required
* Menu hover is slow on long menus


## 2.3.3 - 24 March 2023

### Fixed

* Linux, Windows and BSD builds could fail if gles was missing


## 2.3.2 - 20 March 2023

### Fixed
Expand Down
14 changes: 14 additions & 0 deletions canvas/canvas.go
Expand Up @@ -13,3 +13,17 @@ func Refresh(obj fyne.CanvasObject) {
c.Refresh(obj)
}
}

// repaint instructs the containing canvas to redraw, even if nothing changed.
func repaint(obj fyne.CanvasObject) {
if fyne.CurrentApp() == nil || fyne.CurrentApp().Driver() == nil {
return
}

c := fyne.CurrentApp().Driver().CanvasForObject(obj)
if c != nil {
if paint, ok := c.(interface{ SetDirty() }); ok {
paint.SetDirty()
}
}
}
5 changes: 3 additions & 2 deletions canvas/circle.go
Expand Up @@ -31,7 +31,7 @@ func NewCircle(color color.Color) *Circle {
func (c *Circle) Hide() {
c.Hidden = true

c.Refresh()
repaint(c)
}

// MinSize for a Circle simply returns Size{1, 1} as there is no
Expand All @@ -45,14 +45,15 @@ func (c *Circle) Move(pos fyne.Position) {
size := c.Size()
c.Position1 = pos
c.Position2 = fyne.NewPos(c.Position1.X+size.Width, c.Position1.Y+size.Height)
repaint(c)
}

// Position gets the current top-left position of this circle object, relative to its parent / canvas
func (c *Circle) Position() fyne.Position {
return c.Position1
}

// Refresh causes this object to be redrawn in it's current state
// Refresh causes this object to be redrawn with its configured state.
func (c *Circle) Refresh() {
Refresh(c)
}
Expand Down
36 changes: 33 additions & 3 deletions canvas/gradient.go
Expand Up @@ -4,6 +4,8 @@ import (
"image"
"image/color"
"math"

"fyne.io/fyne/v2"
)

// LinearGradient defines a Gradient travelling straight at a given angle.
Expand Down Expand Up @@ -57,7 +59,21 @@ func (g *LinearGradient) Generate(iw, ih int) image.Image {
return computeGradient(generator, iw, ih, g.StartColor, g.EndColor)
}

// Refresh causes this object to be redrawn in it's current state
// Hide will set this gradient to not be visible
func (g *LinearGradient) Hide() {
g.baseObject.Hide()

repaint(g)
}

// Move the gradient to a new position, relative to its parent / canvas
func (g *LinearGradient) Move(pos fyne.Position) {
g.baseObject.Move(pos)

repaint(g)
}

// Refresh causes this gradient to be redrawn with its configured state.
func (g *LinearGradient) Refresh() {
Refresh(g)
}
Expand Down Expand Up @@ -106,7 +122,21 @@ func (g *RadialGradient) Generate(iw, ih int) image.Image {
return computeGradient(generator, iw, ih, g.StartColor, g.EndColor)
}

// Refresh causes this object to be redrawn in it's current state
// Hide will set this gradient to not be visible
func (g *RadialGradient) Hide() {
g.baseObject.Hide()

repaint(g)
}

// Move the gradient to a new position, relative to its parent / canvas
func (g *RadialGradient) Move(pos fyne.Position) {
g.baseObject.Move(pos)

repaint(g)
}

// Refresh causes this gradient to be redrawn with its configured state.
func (g *RadialGradient) Refresh() {
Refresh(g)
}
Expand Down Expand Up @@ -161,7 +191,7 @@ func NewHorizontalGradient(start, end color.Color) *LinearGradient {
return g
}

// NewLinearGradient creates a linear gradient at a the specified angle.
// NewLinearGradient creates a linear gradient at the specified angle.
// The angle parameter is the degree angle along which the gradient is calculated.
// A NewHorizontalGradient uses 270 degrees and NewVerticalGradient is 0 degrees.
func NewLinearGradient(start, end color.Color, angle float64) *LinearGradient {
Expand Down
28 changes: 21 additions & 7 deletions canvas/image.go
Expand Up @@ -46,7 +46,7 @@ const (
var _ fyne.CanvasObject = (*Image)(nil)

// Image describes a drawable image area that can render in a Fyne canvas
// The image may be a vector or a bitmap representation and it will fill the area.
// The image may be a vector or a bitmap representation, it will fill the area.
// The fill mode can be changed by setting FillMode to a different ImageFill.
type Image struct {
baseObject
Expand All @@ -68,6 +68,25 @@ func (i *Image) Alpha() float64 {
return 1.0 - i.Translucency
}

// Hide will set this image to not be visible
func (i *Image) Hide() {
i.baseObject.Hide()

repaint(i)
}

// Move the image object to a new position, relative to its parent top, left corner.
func (i *Image) Move(pos fyne.Position) {
i.baseObject.Move(pos)

repaint(i)
}

// Refresh causes this image to be redrawn with its configured state.
func (i *Image) Refresh() {
Refresh(i)
}

// Resize on an image will scale the content or reposition it according to FillMode.
// It will normally cause a Refresh to ensure the pixels are recalculated.
func (i *Image) Resize(s fyne.Size) {
Expand All @@ -83,11 +102,6 @@ func (i *Image) Resize(s fyne.Size) {
Refresh(i)
}

// Refresh causes this object to be redrawn in it's current state
func (i *Image) Refresh() {
Refresh(i)
}

// NewImageFromFile creates a new image from a local file.
// Images returned from this method will scale to fit the canvas object.
// The method for scaling can be set using the Fill field.
Expand Down Expand Up @@ -124,7 +138,7 @@ func NewImageFromURI(uri fyne.URI) *Image {
}

// NewImageFromReader creates a new image from a data stream.
// The name parameter is required to uniquely identify this image (for caching etc).
// The name parameter is required to uniquely identify this image (for caching etc.).
// If the image in this io.Reader is an SVG, the name should end ".svg".
// Images returned from this method will scale to fit the canvas object.
// The method for scaling can be set using the Fill field.
Expand Down
9 changes: 5 additions & 4 deletions canvas/line.go
Expand Up @@ -15,7 +15,7 @@ var _ fyne.CanvasObject = (*Line)(nil)
// an inverse slope (i.e. slope up vs down).
type Line struct {
Position1 fyne.Position // The current top-left position of the Line
Position2 fyne.Position // The current bottomright position of the Line
Position2 fyne.Position // The current bottom-right position of the Line
Hidden bool // Is this Line currently hidden

StrokeColor color.Color // The line stroke color
Expand All @@ -28,7 +28,7 @@ func (l *Line) Size() fyne.Size {
float32(math.Abs(float64(l.Position2.Y)-float64(l.Position1.Y))))
}

// Resize sets a new bottom-right position for the line object and it will then be refreshed.
// Resize sets a new bottom-right position for the line object, then it will then be refreshed.
func (l *Line) Resize(size fyne.Size) {
if size == l.Size() {
return
Expand Down Expand Up @@ -60,6 +60,7 @@ func (l *Line) Move(pos fyne.Position) {

l.Position1 = l.Position1.Add(fyne.NewPos(deltaX, deltaY))
l.Position2 = l.Position2.Add(fyne.NewPos(deltaX, deltaY))
repaint(l)
}

// MinSize for a Line simply returns Size{1, 1} as there is no
Expand All @@ -84,10 +85,10 @@ func (l *Line) Show() {
func (l *Line) Hide() {
l.Hidden = true

l.Refresh()
repaint(l)
}

// Refresh causes this object to be redrawn in it's current state
// Refresh causes this line to be redrawn with its configured state.
func (l *Line) Refresh() {
Refresh(l)
}
Expand Down
36 changes: 25 additions & 11 deletions canvas/raster.go
Expand Up @@ -31,6 +31,20 @@ func (r *Raster) Alpha() float64 {
return 1.0 - r.Translucency
}

// Hide will set this raster to not be visible
func (r *Raster) Hide() {
r.baseObject.Hide()

repaint(r)
}

// Move the raster to a new position, relative to its parent / canvas
func (r *Raster) Move(pos fyne.Position) {
r.baseObject.Move(pos)

repaint(r)
}

// Resize on a raster image causes the new size to be set and then calls Refresh.
// This causes the underlying data to be recalculated and a new output to be drawn.
func (r *Raster) Resize(s fyne.Size) {
Expand All @@ -42,7 +56,7 @@ func (r *Raster) Resize(s fyne.Size) {
Refresh(r)
}

// Refresh causes this object to be redrawn in it's current state
// Refresh causes this raster to be redrawn with its configured state.
func (r *Raster) Refresh() {
Refresh(r)
}
Expand Down Expand Up @@ -151,25 +165,25 @@ func NewRasterFromImage(img image.Image) *Raster {
// respect the user's pixel format (if possible)
var dst draw.Image
switch i := img.(type) {
case (*image.Alpha):
case *image.Alpha:
dst = image.NewAlpha(rect)
case (*image.Alpha16):
case *image.Alpha16:
dst = image.NewAlpha16(rect)
case (*image.CMYK):
case *image.CMYK:
dst = image.NewCMYK(rect)
case (*image.Gray):
case *image.Gray:
dst = image.NewGray(rect)
case (*image.Gray16):
case *image.Gray16:
dst = image.NewGray16(rect)
case (*image.NRGBA):
case *image.NRGBA:
dst = image.NewNRGBA(rect)
case (*image.NRGBA64):
case *image.NRGBA64:
dst = image.NewNRGBA64(rect)
case (*image.Paletted):
case *image.Paletted:
dst = image.NewPaletted(rect, i.Palette)
case (*image.RGBA):
case *image.RGBA:
dst = image.NewRGBA(rect)
case (*image.RGBA64):
case *image.RGBA64:
dst = image.NewRGBA64(rect)
default:
dst = image.NewRGBA(rect)
Expand Down
16 changes: 15 additions & 1 deletion canvas/rectangle.go
Expand Up @@ -18,7 +18,21 @@ type Rectangle struct {
StrokeWidth float32 // The stroke width of the rectangle
}

// Refresh causes this object to be redrawn in it's current state
// Hide will set this rectangle to not be visible
func (r *Rectangle) Hide() {
r.baseObject.Hide()

repaint(r)
}

// Move the rectangle to a new position, relative to its parent / canvas
func (r *Rectangle) Move(pos fyne.Position) {
r.baseObject.Move(pos)

repaint(r)
}

// Refresh causes this rectangle to be redrawn with its configured state.
func (r *Rectangle) Refresh() {
Refresh(r)
}
Expand Down
18 changes: 16 additions & 2 deletions canvas/text.go
Expand Up @@ -22,12 +22,26 @@ type Text struct {
TextStyle fyne.TextStyle // The style of the text content
}

// Hide will set this text to not be visible
func (t *Text) Hide() {
t.baseObject.Hide()

repaint(t)
}

// MinSize returns the minimum size of this text object based on its font size and content.
// This is normally determined by the render implementation.
func (t *Text) MinSize() fyne.Size {
return fyne.MeasureText(t.Text, t.TextSize, t.TextStyle)
}

// Move the text to a new position, relative to its parent / canvas
func (t *Text) Move(pos fyne.Position) {
t.baseObject.Move(pos)

repaint(t)
}

// Resize on a text updates the new size of this object, which may not result in a visual change, depending on alignment.
func (t *Text) Resize(s fyne.Size) {
if s == t.Size() {
Expand All @@ -39,11 +53,11 @@ func (t *Text) Resize(s fyne.Size) {
}

// SetMinSize has no effect as the smallest size this canvas object can be is based on its font size and content.
func (t *Text) SetMinSize(size fyne.Size) {
func (t *Text) SetMinSize(fyne.Size) {
// no-op
}

// Refresh causes this object to be redrawn in it's current state
// Refresh causes this text to be redrawn with its configured state.
func (t *Text) Refresh() {
Refresh(t)
}
Expand Down

0 comments on commit 6558290

Please sign in to comment.