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
Andy Williams committed Mar 20, 2023
2 parents 1999664 + 04335ae commit fc2c70b
Show file tree
Hide file tree
Showing 300 changed files with 16,862 additions and 6,223 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/static_analysis.yml
Expand Up @@ -22,7 +22,7 @@ jobs:
sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install honnef.co/go/tools/cmd/staticcheck@v0.3.3
go install honnef.co/go/tools/cmd/staticcheck@v0.4.0
- name: Cleanup repository
run: rm -rf vendor/
Expand Down
25 changes: 25 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,31 @@
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.2 - 20 March 2023

### Fixed

* Fyne does not run perfectly on ARM-based MacOS platforms (#3639)
* Panic on closing window in form submit on Мac M2 (#3397)
* Wobbling slider effect for very small steps (#3648)
* Fix memory leak in test canvas refresh
* Optimise text texture memory by switching to single channel
* Packaging an android fyne app that uses tags can fail (#3641)
* NewAdaptiveGrid(0) blanks app window on start until first resize on Windows (#3669)
* Unnecessary refresh when sliding Split container
* Linux window resize refreshes all content
* Themed and unthemed svg resources can cache collide
* When packaging an ampersand in "Name" causes an error (#3195)
* Svg in ThemedResource without viewBox does not match theme (#3714)
* Missing menu icons in Windows system tray
* Systray Menu Separators don't respect the submenu placement (#3642)
* List row focus indicator disappears on scrolling (#3699)
* List row focus not reset when row widget is reused to display a new item (#3700)
* Avoid panic if accidental 5th nil is passed to Border container
* Mobile simulator not compiling on Apple M1/2
* Cropped letters in certain cases with the new v2.3.0 theme (#3500)


## 2.3.1 - 13 February 2023

### Changed
Expand Down
Binary file modified canvas/testdata/text/layout_long_center_large.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified canvas/testdata/text/layout_long_leading_large.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions cmd/fyne/internal/commands/encode.go
@@ -0,0 +1,9 @@
package commands

import (
"html"
)

func encodeXMLString(in string) string {
return html.EscapeString(in)
}
16 changes: 16 additions & 0 deletions cmd/fyne/internal/commands/encode_test.go
@@ -0,0 +1,16 @@
package commands

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestEncodeXMLString(t *testing.T) {
assert.Equal(t, "", encodeXMLString(""))
assert.Equal(t, "Hello", encodeXMLString("Hello"))
assert.Equal(t, "Hi & bye", encodeXMLString("Hi & bye"))
assert.Equal(t, "Hi & bye", encodeXMLString("Hi & bye"))

assert.Equal(t, "Hi &lt;&gt; bye", encodeXMLString("Hi <> bye"))
}
4 changes: 2 additions & 2 deletions cmd/fyne/internal/commands/package-windows.go
Expand Up @@ -35,7 +35,7 @@ func (p *Packager) packageWindows() error {
return fmt.Errorf("failed to decode source image: %w", err)
}

icoPath := filepath.Join(exePath, p.Name+".ico")
icoPath := filepath.Join(exePath, "FyneApp.ico")
file, err := os.Create(icoPath)
if err != nil {
return fmt.Errorf("failed to open image file: %w", err)
Expand All @@ -59,7 +59,7 @@ func (p *Packager) packageWindows() error {
manifestFile, _ := os.Create(manifest)

tplData := windowsData{
Name: p.Name,
Name: encodeXMLString(p.Name),
CombinedVersion: p.combinedVersion(),
}
err := templates.ManifestWindows.Execute(manifestFile, tplData)
Expand Down
6 changes: 3 additions & 3 deletions cmd/fyne/internal/commands/release.go
Expand Up @@ -346,9 +346,9 @@ func (r *Releaser) packageWindowsRelease(outFile string) error {
manifestData := struct{ AppID, Developer, DeveloperName, Name, Version string }{
AppID: r.AppID,
// TODO read this info
Developer: r.developer,
DeveloperName: r.nameFromCertInfo(r.developer),
Name: r.Name,
Developer: encodeXMLString(r.developer),
DeveloperName: encodeXMLString(r.nameFromCertInfo(r.developer)),
Name: encodeXMLString(r.Name),
Version: r.combinedVersion(),
}
err = templates.AppxManifestWindows.Execute(manifest, manifestData)
Expand Down
6 changes: 6 additions & 0 deletions cmd/hello/FyneApp.toml
@@ -0,0 +1,6 @@
[Details]
Icon = "../../theme/icons/fyne.png"
Name = "Fyne Hello"
ID = "io.fyne.hello"
Version = "2.3.0"
Build = 1
6 changes: 6 additions & 0 deletions container/layouts.go
Expand Up @@ -2,6 +2,7 @@ package container // import "fyne.io/fyne/v2/container"

import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/internal"
"fyne.io/fyne/v2/layout"
)

Expand Down Expand Up @@ -33,6 +34,11 @@ func NewBorder(top, bottom, left, right fyne.CanvasObject, objects ...fyne.Canva
if right != nil {
all = append(all, right)
}

if len(objects) == 1 && objects[0] == nil {
internal.LogHint("Border layout requires only 4 parameters, optional items cannot be nil")
all = all[1:]
}
return New(layout.NewBorderLayout(top, bottom, left, right), all...)
}

Expand Down
22 changes: 22 additions & 0 deletions container/layouts_test.go
@@ -0,0 +1,22 @@
package container

import (
"image/color"
"testing"

"github.com/stretchr/testify/assert"

"fyne.io/fyne/v2/canvas"
)

func TestNewBorder_Nil(t *testing.T) {
b := NewBorder(nil, nil, nil, nil)
assert.Equal(t, 0, len(b.Objects))
b = NewBorder(canvas.NewRectangle(color.Black), canvas.NewRectangle(color.Black), canvas.NewRectangle(color.Black), canvas.NewRectangle(color.Black))
assert.Equal(t, 4, len(b.Objects))

b = NewBorder(canvas.NewRectangle(color.Black), nil, nil, nil, nil) // a common error - adding nil to component list
assert.Equal(t, 1, len(b.Objects))
b = NewBorder(canvas.NewRectangle(color.Black), canvas.NewRectangle(color.Black), canvas.NewRectangle(color.Black), canvas.NewRectangle(color.Black), nil)
assert.Equal(t, 4, len(b.Objects))
}
2 changes: 0 additions & 2 deletions container/split.go
Expand Up @@ -125,8 +125,6 @@ func (r *splitContainerRenderer) Layout(size fyne.Size) {
r.split.Trailing.Move(trailingPos)
r.split.Trailing.Resize(trailingSize)
canvas.Refresh(r.divider)
canvas.Refresh(r.split.Leading)
canvas.Refresh(r.split.Trailing)
}

func (r *splitContainerRenderer) MinSize() fyne.Size {
Expand Down
Binary file modified container/testdata/apptabs/desktop/single_custom_theme.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified container/testdata/apptabs/mobile/theme_ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified container/testdata/doctabs/desktop/single_custom_theme.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified container/testdata/doctabs/mobile/theme_ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_expanded_theme_default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_expanded_theme_ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_recents_theme_ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_simple_recents_theme_ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_simple_theme_ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/dialog_theme_ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/color/picker_layout_advanced.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/dialog-custom-default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/dialog-custom-ugly.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/dialog-onshow-theme-changed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dialog/testdata/dialog-onshow-theme-default.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions go.mod
Expand Up @@ -3,7 +3,7 @@ module fyne.io/fyne/v2
go 1.14

require (
fyne.io/systray v1.10.1-0.20230207085535-4a244dbb9d03
fyne.io/systray v1.10.1-0.20230312215936-7f71b037e260
github.com/BurntSushi/toml v1.1.0
github.com/fredbi/uri v0.1.0
github.com/fsnotify/fsnotify v1.5.4
Expand All @@ -26,12 +26,13 @@ require (
github.com/srwiley/rasterx v0.0.0-20210519020934-456a8d69b780
github.com/stretchr/testify v1.8.0
github.com/urfave/cli/v2 v2.4.0
github.com/yuin/goldmark v1.4.0
github.com/yuin/goldmark v1.4.13
golang.org/x/image v0.0.0-20220601225756-64ec528b34cd
golang.org/x/mobile v0.0.0-20211207041440-4e6c2922fdee
golang.org/x/mod v0.4.2
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
golang.org/x/text v0.6.0 // indirect
golang.org/x/tools v0.1.12
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2
)
27 changes: 18 additions & 9 deletions go.sum
Expand Up @@ -37,8 +37,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
fyne.io/systray v1.10.1-0.20230207085535-4a244dbb9d03 h1:zb84y6X6lIi4Aeo8ehu6Qtu2fipBZ6Wzp41Ki/F4qdg=
fyne.io/systray v1.10.1-0.20230207085535-4a244dbb9d03/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE=
fyne.io/systray v1.10.1-0.20230312215936-7f71b037e260 h1:hNHShALSK9F0n6iJoBNmXs1GW0AzOgkKvp8N4ECK59M=
fyne.io/systray v1.10.1-0.20230312215936-7f71b037e260/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
Expand Down Expand Up @@ -298,8 +298,9 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0 h1:OtISOGfH6sOWa1/qXqqAiOIAO6Z5J3AEAE18WAq6BiQ=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsXlzd7alYQ=
Expand All @@ -321,6 +322,7 @@ golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -363,8 +365,9 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -403,8 +406,9 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4 h1:DZshvxDdVoeKIbudAdFEKi+f70l51luSy/7b76ibTY0=
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand All @@ -428,6 +432,7 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -475,9 +480,12 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -486,8 +494,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -543,12 +552,12 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098 h1:YuekqPskqwCCPM79F1X5Dhv4ezTCj+Ki1oNwiafxkA0=
golang.org/x/tools v0.1.8-0.20211022200916-316ba0b74098/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
Expand Down
9 changes: 5 additions & 4 deletions internal/driver/glfw/driver.go
Expand Up @@ -37,6 +37,8 @@ var (
// Declare conformity with Driver
var _ fyne.Driver = (*gLDriver)(nil)

var drawOnMainThread bool // A workaround on Apple M1, just use 1 thread until fixed upstream

type gLDriver struct {
windowLock sync.RWMutex
windows []fyne.Window
Expand All @@ -46,17 +48,16 @@ type gLDriver struct {

animation *animation.Runner

drawOnMainThread bool // A workaround on Apple M1, just use 1 thread until fixed upstream
trayStart, trayStop func() // shut down the system tray, if used
systrayMenu *fyne.Menu // cache the menu set so we know when to refresh
}

func toOSIcon(icon fyne.Resource) ([]byte, error) {
func toOSIcon(icon []byte) ([]byte, error) {
if runtime.GOOS != "windows" {
return icon.Content(), nil
return icon, nil
}

img, _, err := image.Decode(bytes.NewReader(icon.Content()))
img, _, err := image.Decode(bytes.NewReader(icon))
if err != nil {
return nil, err
}
Expand Down
22 changes: 18 additions & 4 deletions internal/driver/glfw/driver_desktop.go
Expand Up @@ -64,7 +64,11 @@ func (d *gLDriver) SetSystemTrayMenu(m *fyne.Menu) {

func itemForMenuItem(i *fyne.MenuItem, parent *systray.MenuItem) *systray.MenuItem {
if i.IsSeparator {
systray.AddSeparator()
if parent != nil {
parent.AddSeparator()
} else {
systray.AddSeparator()
}
return nil
}

Expand All @@ -89,15 +93,25 @@ func itemForMenuItem(i *fyne.MenuItem, parent *systray.MenuItem) *systray.MenuIt
data := i.Icon.Content()
if painter.IsResourceSVG(i.Icon) {
b := &bytes.Buffer{}
img := painter.PaintImage(canvas.NewImageFromResource(i.Icon), nil, 64, 64)
res := i.Icon
if runtime.GOOS == "windows" && isDark() { // windows menus don't match dark mode so invert icons
res = theme.NewInvertedThemedResource(i.Icon)
}
img := painter.PaintImage(canvas.NewImageFromResource(res), nil, 64, 64)
err := png.Encode(b, img)
if err != nil {
fyne.LogError("Failed to encode SVG icon for menu", err)
} else {
data = b.Bytes()
}
}
item.SetIcon(data)

img, err := toOSIcon(data)
if err != nil {
fyne.LogError("Failed to convert systray icon", err)
} else {
item.SetIcon(img)
}
}
return item
}
Expand Down Expand Up @@ -139,7 +153,7 @@ func (d *gLDriver) refreshSystrayMenu(m *fyne.Menu, parent *systray.MenuItem) {
func (d *gLDriver) SetSystemTrayIcon(resource fyne.Resource) {
systrayIcon = resource // in case we need it later

img, err := toOSIcon(resource)
img, err := toOSIcon(resource.Content())
if err != nil {
fyne.LogError("Failed to convert systray icon", err)
return
Expand Down
4 changes: 4 additions & 0 deletions internal/driver/glfw/driver_notwindows.go
Expand Up @@ -8,3 +8,7 @@ import "fyne.io/fyne/v2"
func logError(msg string, err error) {
fyne.LogError(msg, err)
}

func isDark() bool {
return true // this is really a no-op placeholder for a windows menu workaround
}

0 comments on commit fc2c70b

Please sign in to comment.