From 4893a325d416ad996fa25b7bfd56b2b7341bef4a Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 20 Jun 2022 17:08:49 +0100 Subject: [PATCH 01/29] Set version info for windows exe (#3084) Fixes #3046 --- cmd/fyne/internal/commands/package-windows.go | 34 +++++++++++++++++++ cmd/fyne/internal/commands/package_test.go | 18 ++++++++++ 2 files changed, 52 insertions(+) diff --git a/cmd/fyne/internal/commands/package-windows.go b/cmd/fyne/internal/commands/package-windows.go index 9ace2add52..6d85616f24 100644 --- a/cmd/fyne/internal/commands/package-windows.go +++ b/cmd/fyne/internal/commands/package-windows.go @@ -6,7 +6,10 @@ import ( "os" "path/filepath" "runtime" + "strconv" + "strings" + "fyne.io/fyne/v2" "fyne.io/fyne/v2/cmd/fyne/internal/templates" "github.com/fyne-io/image/ico" "github.com/josephspurrier/goversioninfo" @@ -72,6 +75,8 @@ func (p *Packager) packageWindows() error { vi.ProductName = p.Name vi.IconPath = icoPath vi.ManifestPath = manifest + vi.StringFileInfo.ProductVersion = p.combinedVersion() + vi.FixedFileInfo.FileVersion = fixedVersionInfo(p.combinedVersion()) vi.Build() vi.Walk() @@ -131,3 +136,32 @@ func runAsAdminWindows(args ...string) error { return execabs.Command("powershell.exe", "Start-Process", "cmd.exe", "-Verb", "runAs", "-ArgumentList", cmd).Run() } + +func fixedVersionInfo(ver string) (ret goversioninfo.FileVersion) { + ret.Build = 1 // as 0,0,0,0 is not valid + if len(ver) == 0 { + return ret + } + split := strings.Split(ver, ".") + setVersionField(&ret.Major, split[0]) + if len(split) > 1 { + setVersionField(&ret.Minor, split[1]) + } + if len(split) > 2 { + setVersionField(&ret.Patch, split[2]) + } + if len(split) > 3 { + setVersionField(&ret.Build, split[3]) + } + return ret +} + +func setVersionField(to *int, ver string) { + num, err := strconv.Atoi(ver) + if err != nil { + fyne.LogError("Failed to parse app version field", err) + return + } + + *to = num +} diff --git a/cmd/fyne/internal/commands/package_test.go b/cmd/fyne/internal/commands/package_test.go index d66ce5786f..40bc7db4f1 100644 --- a/cmd/fyne/internal/commands/package_test.go +++ b/cmd/fyne/internal/commands/package_test.go @@ -5,6 +5,7 @@ import ( "runtime" "testing" + "github.com/josephspurrier/goversioninfo" "github.com/stretchr/testify/assert" "fyne.io/fyne/v2/cmd/fyne/internal/metadata" @@ -21,6 +22,23 @@ func Test_calculateExeName(t *testing.T) { assert.Equal(t, "testdata", nonModulesApp) } +func Test_fixedVersionInfo(t *testing.T) { + tests := []struct { + ver string + fixed goversioninfo.FileVersion + }{ + {"", goversioninfo.FileVersion{Major: 0, Minor: 0, Patch: 0, Build: 1}}, + {"1.1.1.1", goversioninfo.FileVersion{Major: 1, Minor: 1, Patch: 1, Build: 1}}, + {"2.2.2", goversioninfo.FileVersion{Major: 2, Minor: 2, Patch: 2, Build: 1}}, + {"3.3.3.3.3", goversioninfo.FileVersion{Major: 3, Minor: 3, Patch: 3, Build: 3}}, + } + + for _, tt := range tests { + parsed := fixedVersionInfo(tt.ver) + assert.Equal(t, tt.fixed, parsed) + } +} + func Test_isValidVersion(t *testing.T) { assert.True(t, isValidVersion("1")) assert.True(t, isValidVersion("1.2")) From ab10ae03a40a44ee5be94fb352b01081c240087e Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 20 Jun 2022 17:14:40 +0100 Subject: [PATCH 02/29] Start release log --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74ab7ad8fc..e5295a6bf2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ 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.2.2 - Ongoing + +### Fixed + +* Windows missing version metadata when packaged (#3046) + + ## 2.2.1 - 12 June 2022 ### Fixed From 3234b25a5e0fe128d0911ced82e5a8318587c8d9 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Wed, 15 Jun 2022 15:21:33 -0600 Subject: [PATCH 03/29] Check fyne module version and inject metadata only in recent enough version. --- cmd/fyne/internal/commands/build.go | 80 +++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 17 deletions(-) diff --git a/cmd/fyne/internal/commands/build.go b/cmd/fyne/internal/commands/build.go index 75425c0507..61f78b3299 100644 --- a/cmd/fyne/internal/commands/build.go +++ b/cmd/fyne/internal/commands/build.go @@ -1,7 +1,9 @@ package commands import ( + "encoding/json" "fmt" + "log" "os" "path/filepath" "runtime" @@ -128,6 +130,41 @@ func checkGoVersion(runner runner, versionConstraint *version.ConstraintGroup) e return checkVersion(string(goVersion), versionConstraint) } +type GoModEdit struct { + Module struct { + Path string + } + Require []struct { + Path string + Version string + } +} + +func getFyneGoModVersion(runner runner) (string, error) { + dependenciesOutput, err := runner.runOutput("mod", "edit", "-json") + if err != nil { + return "", err + } + + var goModEdit GoModEdit + err = json.Unmarshal(dependenciesOutput, &goModEdit) + if err != nil { + return "", err + } + + if goModEdit.Module.Path == "fyne.io/fyne/v2" { + return "master", nil + } + + for _, dep := range goModEdit.Require { + if dep.Path == "fyne.io/fyne/v2" { + return dep.Version, nil + } + } + + return "", fmt.Errorf("fyne version not found") +} + func (b *Builder) build() error { var versionConstraint *version.ConstraintGroup @@ -151,27 +188,36 @@ func (b *Builder) build() error { env = append(env, "CGO_CFLAGS=-mmacosx-version-min=10.11", "CGO_LDFLAGS=-mmacosx-version-min=10.11") } - data, err := metadata.LoadStandard(b.srcdir) - if err == nil { - mergeMetadata(b.appData, data) - } + if fyneGoModVersion, err := getFyneGoModVersion(b.runner); err == nil { + fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) + fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") + if fyneGoModVersion == "master" || fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { - metadataInitFilePath := filepath.Join(b.srcdir, "fyne_metadata_init.go") - metadataInitFile, err := os.Create(metadataInitFilePath) - if err != nil { - fyne.LogError("Failed to make metadata init file, omitting metadata", err) - } - defer os.Remove(metadataInitFilePath) + data, err := metadata.LoadStandard(b.srcdir) + if err == nil { + mergeMetadata(b.appData, data) + } - err = templates.FyneMetadataInit.Execute(metadataInitFile, b.appData) - if err != nil { - fyne.LogError("Failed to generate metadata init, omitting metadata", err) - } else { - if b.icon != "" { - writeResource(b.icon, "fyneMetadataIcon", metadataInitFile) + metadataInitFilePath := filepath.Join(b.srcdir, "fyne_metadata_init.go") + metadataInitFile, err := os.Create(metadataInitFilePath) + if err != nil { + fyne.LogError("Failed to make metadata init file, omitting metadata", err) + } + defer os.Remove(metadataInitFilePath) + + err = templates.FyneMetadataInit.Execute(metadataInitFile, b.appData) + if err != nil { + fyne.LogError("Failed to generate metadata init, omitting metadata", err) + } else { + if b.icon != "" { + writeResource(b.icon, "fyneMetadataIcon", metadataInitFile) + } + } + metadataInitFile.Close() + } else { + log.Println("It is recommended to use the same version of Fyne as the fyne command line.") } } - metadataInitFile.Close() if !isWeb(goos) { env = append(env, "CGO_ENABLED=1") // in case someone is trying to cross-compile... From fc453e693be3edf119be3222203fcbf23a64a23c Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Wed, 15 Jun 2022 15:37:47 -0600 Subject: [PATCH 04/29] Handle mocking for testing. --- cmd/fyne/internal/commands/build.go | 4 +- cmd/fyne/internal/commands/build_test.go | 24 +++++++++++ cmd/fyne/internal/commands/package_test.go | 48 ++++++++++++++++++++++ 3 files changed, 75 insertions(+), 1 deletion(-) diff --git a/cmd/fyne/internal/commands/build.go b/cmd/fyne/internal/commands/build.go index 61f78b3299..7ac10895e1 100644 --- a/cmd/fyne/internal/commands/build.go +++ b/cmd/fyne/internal/commands/build.go @@ -173,7 +173,9 @@ func (b *Builder) build() error { goos = targetOS() } + fyneGoModRunner := b.runner if b.runner == nil { + fyneGoModRunner = newCommand("go") if goos != "gopherjs" { b.runner = newCommand("go") } else { @@ -188,7 +190,7 @@ func (b *Builder) build() error { env = append(env, "CGO_CFLAGS=-mmacosx-version-min=10.11", "CGO_LDFLAGS=-mmacosx-version-min=10.11") } - if fyneGoModVersion, err := getFyneGoModVersion(b.runner); err == nil { + if fyneGoModVersion, err := getFyneGoModVersion(fyneGoModRunner); err == nil { fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") if fyneGoModVersion == "master" || fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { diff --git a/cmd/fyne/internal/commands/build_test.go b/cmd/fyne/internal/commands/build_test.go index 185f714737..6076271905 100644 --- a/cmd/fyne/internal/commands/build_test.go +++ b/cmd/fyne/internal/commands/build_test.go @@ -101,6 +101,12 @@ func Test_CheckVersionTableTests(t *testing.T) { func Test_BuildWasmVersion(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"}"), + }, + }, { expectedValue: expectedValue{args: []string{"version"}}, mockReturn: mockReturn{ret: []byte("go version go1.17.6 windows/amd64")}, @@ -125,6 +131,12 @@ func Test_BuildWasmVersion(t *testing.T) { func Test_BuildWasmReleaseVersion(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"}"), + }, + }, { expectedValue: expectedValue{args: []string{"version"}}, mockReturn: mockReturn{ @@ -153,6 +165,12 @@ func Test_BuildWasmReleaseVersion(t *testing.T) { func Test_BuildGopherJSReleaseVersion(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"}"), + }, + }, { expectedValue: expectedValue{ args: []string{"version"}, @@ -184,6 +202,12 @@ func Test_BuildGopherJSReleaseVersion(t *testing.T) { func Test_BuildWasmOldVersion(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"}"), + }, + }, { expectedValue: expectedValue{args: []string{"version"}}, mockReturn: mockReturn{ret: []byte("go version go1.16.0 windows/amd64")}, diff --git a/cmd/fyne/internal/commands/package_test.go b/cmd/fyne/internal/commands/package_test.go index 40bc7db4f1..46bd9d22be 100644 --- a/cmd/fyne/internal/commands/package_test.go +++ b/cmd/fyne/internal/commands/package_test.go @@ -97,6 +97,12 @@ func Test_validateAppID(t *testing.T) { func Test_buildPackageWasm(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{args: []string{"version"}}, mockReturn: mockReturn{ @@ -131,6 +137,12 @@ func Test_buildPackageWasm(t *testing.T) { func Test_PackageWasm(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{args: []string{"version"}}, mockReturn: mockReturn{ @@ -223,6 +235,12 @@ func Test_PackageWasm(t *testing.T) { func Test_buildPackageGopherJS(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{ args: []string{"version"}, @@ -261,6 +279,12 @@ func Test_buildPackageGopherJS(t *testing.T) { func Test_PackageGopherJS(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{ args: []string{"version"}, @@ -356,6 +380,12 @@ func Test_PackageGopherJS(t *testing.T) { func Test_BuildPackageWeb(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{args: []string{"version"}}, mockReturn: mockReturn{ @@ -373,6 +403,12 @@ func Test_BuildPackageWeb(t *testing.T) { ret: []byte(""), }, }, + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{ args: []string{"version"}, @@ -411,6 +447,12 @@ func Test_BuildPackageWeb(t *testing.T) { func Test_PackageWeb(t *testing.T) { expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{args: []string{"version"}}, mockReturn: mockReturn{ @@ -428,6 +470,12 @@ func Test_PackageWeb(t *testing.T) { ret: []byte(""), }, }, + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ + ret: []byte("{ \"Module\": { \"Path\": \"fyne.io/fyne/v2\"} }"), + }, + }, { expectedValue: expectedValue{ args: []string{"version"}, From 63161c90dcd41b0e25ca94044ebaa0456f0a48e3 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Wed, 15 Jun 2022 21:25:30 -0600 Subject: [PATCH 05/29] Move creation of metadata to its own function. --- cmd/fyne/internal/commands/build.go | 74 +++++++++++++++++------------ 1 file changed, 43 insertions(+), 31 deletions(-) diff --git a/cmd/fyne/internal/commands/build.go b/cmd/fyne/internal/commands/build.go index 7ac10895e1..a78e419bdf 100644 --- a/cmd/fyne/internal/commands/build.go +++ b/cmd/fyne/internal/commands/build.go @@ -165,6 +165,46 @@ func getFyneGoModVersion(runner runner) (string, error) { return "", fmt.Errorf("fyne version not found") } +func (b *Builder) createMetadataInitFile() (func(), error) { + data, err := metadata.LoadStandard(b.srcdir) + if err == nil { + mergeMetadata(b.appData, data) + } + + metadataInitFilePath := filepath.Join(b.srcdir, "fyne_metadata_init.go") + metadataInitFile, err := os.Create(metadataInitFilePath) + if err != nil { + return func() {}, err + } + defer metadataInitFile.Close() + + err = templates.FyneMetadataInit.Execute(metadataInitFile, b.appData) + if err == nil { + if b.icon != "" { + writeResource(b.icon, "fyneMetadataIcon", metadataInitFile) + } + } + + return func() { os.Remove(metadataInitFilePath) }, err +} + +func (b *Builder) injectMetadataIfPossible(runner runner, createMetadataInitFile func() (func(), error)) func() { + if fyneGoModVersion, err := getFyneGoModVersion(runner); err == nil { + fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) + fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") + if fyneGoModVersion == "master" || fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { + close, err := createMetadataInitFile() + if err != nil { + fyne.LogError("Failed to make metadata init file, omitting metadata", err) + } + return close + } else { + log.Println("It is recommended to use the same version of Fyne as the fyne command line.") + } + } + return func() {} +} + func (b *Builder) build() error { var versionConstraint *version.ConstraintGroup @@ -183,6 +223,9 @@ func (b *Builder) build() error { } } + close := b.injectMetadataIfPossible(fyneGoModRunner, b.createMetadataInitFile) + defer close() + args := []string{"build"} env := os.Environ() @@ -190,37 +233,6 @@ func (b *Builder) build() error { env = append(env, "CGO_CFLAGS=-mmacosx-version-min=10.11", "CGO_LDFLAGS=-mmacosx-version-min=10.11") } - if fyneGoModVersion, err := getFyneGoModVersion(fyneGoModRunner); err == nil { - fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) - fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") - if fyneGoModVersion == "master" || fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { - - data, err := metadata.LoadStandard(b.srcdir) - if err == nil { - mergeMetadata(b.appData, data) - } - - metadataInitFilePath := filepath.Join(b.srcdir, "fyne_metadata_init.go") - metadataInitFile, err := os.Create(metadataInitFilePath) - if err != nil { - fyne.LogError("Failed to make metadata init file, omitting metadata", err) - } - defer os.Remove(metadataInitFilePath) - - err = templates.FyneMetadataInit.Execute(metadataInitFile, b.appData) - if err != nil { - fyne.LogError("Failed to generate metadata init, omitting metadata", err) - } else { - if b.icon != "" { - writeResource(b.icon, "fyneMetadataIcon", metadataInitFile) - } - } - metadataInitFile.Close() - } else { - log.Println("It is recommended to use the same version of Fyne as the fyne command line.") - } - } - if !isWeb(goos) { env = append(env, "CGO_ENABLED=1") // in case someone is trying to cross-compile... From 59c398e222ebb1720e95d6e4a5340f56db193216 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Wed, 15 Jun 2022 21:26:13 -0600 Subject: [PATCH 06/29] Add tests covering fyne go mod version. --- cmd/fyne/internal/commands/build_test.go | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/cmd/fyne/internal/commands/build_test.go b/cmd/fyne/internal/commands/build_test.go index 6076271905..c631de4b42 100644 --- a/cmd/fyne/internal/commands/build_test.go +++ b/cmd/fyne/internal/commands/build_test.go @@ -220,3 +220,36 @@ func Test_BuildWasmOldVersion(t *testing.T) { assert.NotNil(t, err) wasmBuildTest.verifyExpectation() } + +type jsonTest struct { + expected bool + json []byte +} + +func Test_FyneGoMod(t *testing.T) { + jsonTests := []jsonTest{ + {false, []byte(`{"Module": {"Path": "github.com/fyne-io/calculator"},"Go": "1.14", "Require": [ { "Path": "fyne.io/fyne/v2","Version": "v2.1.4"} ] }`)}, + {true, []byte(`{ "Module": {"Path": "fyne.io/fyne/v2"},"Require": [{ "Path": "test","Version": "v2.1.4"} ] }`)}, + {true, []byte(`{"Module": {"Path": "github.com/fyne-io/calculator"},"Go": "1.14", "Require": [ { "Path": "fyne.io/fyne/v2","Version": "v2.2.0"} ] }`)}, + } + + for _, j := range jsonTests { + expected := []mockRunner{ + { + expectedValue: expectedValue{args: []string{"mod", "edit", "-json"}}, + mockReturn: mockReturn{ret: j.json}, + }, + } + + called := false + + fyneGoModTest := &testCommandRuns{runs: expected, t: t} + b := &Builder{appData: &appData{}, os: "wasm", srcdir: "myTest", runner: fyneGoModTest} + b.injectMetadataIfPossible(fyneGoModTest, func() (func(), error) { + called = true + return func() {}, nil + }) + + assert.Equal(t, j.expected, called) + } +} From 5976f953b1b6e7f80612c1f06d3cb9c214922035 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Thu, 16 Jun 2022 10:34:42 -0600 Subject: [PATCH 07/29] Address PR comments. --- cmd/fyne/internal/commands/build.go | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/fyne/internal/commands/build.go b/cmd/fyne/internal/commands/build.go index a78e419bdf..8ed53605b2 100644 --- a/cmd/fyne/internal/commands/build.go +++ b/cmd/fyne/internal/commands/build.go @@ -3,7 +3,6 @@ package commands import ( "encoding/json" "fmt" - "log" "os" "path/filepath" "runtime" @@ -130,7 +129,7 @@ func checkGoVersion(runner runner, versionConstraint *version.ConstraintGroup) e return checkVersion(string(goVersion), versionConstraint) } -type GoModEdit struct { +type goModEdit struct { Module struct { Path string } @@ -146,17 +145,17 @@ func getFyneGoModVersion(runner runner) (string, error) { return "", err } - var goModEdit GoModEdit - err = json.Unmarshal(dependenciesOutput, &goModEdit) + var parsed goModEdit + err = json.Unmarshal(dependenciesOutput, &parsed) if err != nil { return "", err } - if goModEdit.Module.Path == "fyne.io/fyne/v2" { + if parsed.Module.Path == "fyne.io/fyne/v2" { return "master", nil } - for _, dep := range goModEdit.Require { + for _, dep := range parsed.Require { if dep.Path == "fyne.io/fyne/v2" { return dep.Version, nil } @@ -188,21 +187,18 @@ func (b *Builder) createMetadataInitFile() (func(), error) { return func() { os.Remove(metadataInitFilePath) }, err } -func (b *Builder) injectMetadataIfPossible(runner runner, createMetadataInitFile func() (func(), error)) func() { - if fyneGoModVersion, err := getFyneGoModVersion(runner); err == nil { +func (b *Builder) injectMetadataIfPossible(runner runner, createMetadataInitFile func() (func(), error)) (func(), error) { + fyneGoModVersion, err := getFyneGoModVersion(runner) + if err == nil { fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") if fyneGoModVersion == "master" || fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { - close, err := createMetadataInitFile() - if err != nil { - fyne.LogError("Failed to make metadata init file, omitting metadata", err) - } - return close + return createMetadataInitFile() } else { - log.Println("It is recommended to use the same version of Fyne as the fyne command line.") + return nil, fmt.Errorf("fyne command line version is more recent than the version used in go.mod") } } - return func() {} + return nil, err } func (b *Builder) build() error { @@ -223,8 +219,12 @@ func (b *Builder) build() error { } } - close := b.injectMetadataIfPossible(fyneGoModRunner, b.createMetadataInitFile) - defer close() + close, err := b.injectMetadataIfPossible(fyneGoModRunner, b.createMetadataInitFile) + if err != nil { + fyne.LogError("Failed to inject metadata init file, omitting metadata", err) + } else { + defer close() + } args := []string{"build"} env := os.Environ() From 6d1cb8fe1a621482322ac56c5543e04b209ed74d Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Mon, 20 Jun 2022 09:57:55 -0600 Subject: [PATCH 08/29] Address PR comment unesting if and error path. --- cmd/fyne/internal/commands/build.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/fyne/internal/commands/build.go b/cmd/fyne/internal/commands/build.go index 8ed53605b2..a77cfb19c4 100644 --- a/cmd/fyne/internal/commands/build.go +++ b/cmd/fyne/internal/commands/build.go @@ -189,16 +189,17 @@ func (b *Builder) createMetadataInitFile() (func(), error) { func (b *Builder) injectMetadataIfPossible(runner runner, createMetadataInitFile func() (func(), error)) (func(), error) { fyneGoModVersion, err := getFyneGoModVersion(runner) - if err == nil { - fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) - fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") - if fyneGoModVersion == "master" || fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { - return createMetadataInitFile() - } else { - return nil, fmt.Errorf("fyne command line version is more recent than the version used in go.mod") - } + if err != nil { + return nil, err } - return nil, err + + fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) + fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") + if fyneGoModVersion != "master" && !fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { + return nil, fmt.Errorf("fyne command line version is more recent than the version used in go.mod") + } + + return createMetadataInitFile() } func (b *Builder) build() error { From 4ada4b045286e5a3bcd3f794cc612c9a7bfb4e85 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Mon, 20 Jun 2022 10:48:18 -0600 Subject: [PATCH 09/29] Remove error that was really just a warning. --- cmd/fyne/internal/commands/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/fyne/internal/commands/build.go b/cmd/fyne/internal/commands/build.go index a77cfb19c4..dab3f363e3 100644 --- a/cmd/fyne/internal/commands/build.go +++ b/cmd/fyne/internal/commands/build.go @@ -196,7 +196,7 @@ func (b *Builder) injectMetadataIfPossible(runner runner, createMetadataInitFile fyneGoModVersionNormalized := version.Normalize(fyneGoModVersion) fyneGoModVersionConstraint := version.NewConstrainGroupFromString(">=2.2") if fyneGoModVersion != "master" && !fyneGoModVersionConstraint.Match(fyneGoModVersionNormalized) { - return nil, fmt.Errorf("fyne command line version is more recent than the version used in go.mod") + return nil, nil } return createMetadataInitFile() From ee07686b5dc1f14945bf8999e4e1bd23a10a2450 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 20 Jun 2022 18:25:19 +0100 Subject: [PATCH 10/29] Thanks for this version check Bluebugs, merged to release branch --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5295a6bf2..d4a00d6ee5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ More detailed release notes can be found on the [releases page](https://github.c ### Fixed * Windows missing version metadata when packaged (#3046) +* Fyne package would not build apps using old Fyne versions ## 2.2.1 - 12 June 2022 From 951e2473525dc94f241580aafd4eb0050c18c372 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 21 Jun 2022 09:59:51 +0100 Subject: [PATCH 11/29] Latest systray library fixes :) --- CHANGELOG.md | 1 + go.mod | 2 +- go.sum | 4 +- vendor/fyne.io/systray/README.md | 3 +- vendor/fyne.io/systray/systray.go | 21 +++- vendor/fyne.io/systray/systray_menu_unix.go | 117 +++++++++----------- vendor/fyne.io/systray/systray_notlinux.go | 22 ---- vendor/fyne.io/systray/systray_unix.go | 20 ++-- vendor/modules.txt | 2 +- 9 files changed, 87 insertions(+), 105 deletions(-) delete mode 100644 vendor/fyne.io/systray/systray_notlinux.go diff --git a/CHANGELOG.md b/CHANGELOG.md index d4a00d6ee5..a138df6fed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ More detailed release notes can be found on the [releases page](https://github.c * Windows missing version metadata when packaged (#3046) * Fyne package would not build apps using old Fyne versions +* System tray icon may not be removed on app exit in Windows ## 2.2.1 - 12 June 2022 diff --git a/go.mod b/go.mod index 7023c8c3d9..9784ef81a3 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module fyne.io/fyne/v2 go 1.14 require ( - fyne.io/systray v1.10.0 + fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 github.com/BurntSushi/toml v1.1.0 github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 github.com/fsnotify/fsnotify v1.5.4 diff --git a/go.sum b/go.sum index 41eaa077d4..17c2fa5c6e 100644 --- a/go.sum +++ b/go.sum @@ -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.0 h1:Yr1D9Lxeiw3+vSuZWPlaHC8BMjIHZXJKkek706AfYQk= -fyne.io/systray v1.10.0/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE= +fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 h1:V2IC9t0Zj9Ur6qDbfhUuzVmIvXKFyxZXRJyigUvovs4= +fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93/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= diff --git a/vendor/fyne.io/systray/README.md b/vendor/fyne.io/systray/README.md index f72da8eef5..84b6b28dcf 100644 --- a/vendor/fyne.io/systray/README.md +++ b/vendor/fyne.io/systray/README.md @@ -16,6 +16,7 @@ removing the GTK dependency and support for legacy linux system tray. package main import "fyne.io/systray" +import "fyne.io/systray/example/icon" func main() { systray.Run(onReady, onExit) @@ -27,7 +28,7 @@ func onReady() { systray.SetTooltip("Pretty awesome超级棒") mQuit := systray.AddMenuItem("Quit", "Quit the whole app") - // Sets the icon of a menu item. Only available on Mac and Windows. + // Sets the icon of a menu item. mQuit.SetIcon(icon.Data) } diff --git a/vendor/fyne.io/systray/systray.go b/vendor/fyne.io/systray/systray.go index aa849ff587..d0a0dfaed6 100644 --- a/vendor/fyne.io/systray/systray.go +++ b/vendor/fyne.io/systray/systray.go @@ -3,6 +3,7 @@ package systray import ( "fmt" + "log" "runtime" "sync" "sync/atomic" @@ -79,7 +80,10 @@ func Run(onReady, onExit func()) { func RunWithExternalLoop(onReady, onExit func()) (start, end func()) { Register(onReady, onExit) - return nativeStart, nativeEnd + return nativeStart, func() { + nativeEnd() + Quit() + } } // Register initializes GUI and registers the callbacks but relies on the @@ -228,3 +232,18 @@ func (item *MenuItem) update() { menuItemsLock.Unlock() addOrUpdateMenuItem(item) } + +func systrayMenuItemSelected(id uint32) { + menuItemsLock.RLock() + item, ok := menuItems[id] + menuItemsLock.RUnlock() + if !ok { + log.Printf("systray error: no menu item with ID %d\n", id) + return + } + select { + case item.ClickedCh <- struct{}{}: + // in case no one waiting for the channel + default: + } +} diff --git a/vendor/fyne.io/systray/systray_menu_unix.go b/vendor/fyne.io/systray/systray_menu_unix.go index c1e99d825e..c0e64854da 100644 --- a/vendor/fyne.io/systray/systray_menu_unix.go +++ b/vendor/fyne.io/systray/systray_menu_unix.go @@ -5,7 +5,6 @@ package systray import ( "log" - "sync/atomic" "github.com/godbus/dbus/v5" "github.com/godbus/dbus/v5/prop" @@ -13,9 +12,16 @@ import ( "fyne.io/systray/internal/generated/menu" ) -// SetIcon sets the icon of a menu item. Only works on macOS and Windows. +// SetIcon sets the icon of a menu item. // iconBytes should be the content of .ico/.jpg/.png func (item *MenuItem) SetIcon(iconBytes []byte) { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() + m, exists := findLayout(int32(item.id)) + if exists { + m.V1["icon-data"] = dbus.MakeVariant(iconBytes) + refresh() + } } // copyLayout makes full copy of layout @@ -39,12 +45,13 @@ func copyLayout(in *menuLayout, depth int32) *menuLayout { return &out } +// GetLayout is com.canonical.dbusmenu.GetLayout method. func (t *tray) GetLayout(parentID int32, recursionDepth int32, propertyNames []string) (revision uint32, layout menuLayout, err *dbus.Error) { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() if m, ok := findLayout(parentID); ok { - instance.menuLock.RLock() - defer instance.menuLock.RUnlock() // return copy of menu layout to prevent panic from cuncurrent access to layout - return atomic.LoadUint32(&instance.menuVersion), *copyLayout(m, recursionDepth), nil + return instance.menuVersion, *copyLayout(m, recursionDepth), nil } return } @@ -54,6 +61,8 @@ func (t *tray) GetGroupProperties(ids []int32, propertyNames []string) (properti V0 int32 V1 map[string]dbus.Variant }, err *dbus.Error) { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() for _, id := range ids { if m, ok := findLayout(id); ok { p := struct { @@ -63,11 +72,9 @@ func (t *tray) GetGroupProperties(ids []int32, propertyNames []string) (properti V0: m.V0, V1: make(map[string]dbus.Variant, len(m.V1)), } - instance.menuLock.RLock() for k, v := range m.V1 { p.V1[k] = v } - instance.menuLock.RUnlock() properties = append(properties, p) } } @@ -76,9 +83,9 @@ func (t *tray) GetGroupProperties(ids []int32, propertyNames []string) (properti // GetProperty is com.canonical.dbusmenu.GetProperty method. func (t *tray) GetProperty(id int32, name string) (value dbus.Variant, err *dbus.Error) { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() if m, ok := findLayout(id); ok { - instance.menuLock.RLock() - defer instance.menuLock.RUnlock() if p, ok := m.V1[name]; ok { return p, nil } @@ -89,15 +96,7 @@ func (t *tray) GetProperty(id int32, name string) (value dbus.Variant, err *dbus // Event is com.canonical.dbusmenu.Event method. func (t *tray) Event(id int32, eventID string, data dbus.Variant, timestamp uint32) (err *dbus.Error) { if eventID == "clicked" { - menuItemsLock.RLock() - item, ok := menuItems[uint32(id)] - menuItemsLock.RUnlock() - if !ok { - log.Printf("systray error: failed to look up clicked menu item with ID %d\n", id) - return - } - - item.ClickedCh <- struct{}{} + systrayMenuItemSelected(uint32(id)) } return } @@ -111,15 +110,7 @@ func (t *tray) EventGroup(events []struct { }) (idErrors []int32, err *dbus.Error) { for _, event := range events { if event.V1 == "clicked" { - menuItemsLock.RLock() - item, ok := menuItems[uint32(event.V0)] - menuItemsLock.RUnlock() - if !ok { - log.Printf("systray error: failed to look up clicked menu item with ID %d\n", event.V0) - return - } - - item.ClickedCh <- struct{}{} + systrayMenuItemSelected(uint32(event.V0)) } } return @@ -136,10 +127,12 @@ func (t *tray) AboutToShowGroup(ids []int32) (updatesNeeded []int32, idErrors [] } func createMenuPropSpec() map[string]map[string]*prop.Prop { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() return map[string]map[string]*prop.Prop{ "com.canonical.dbusmenu": { "Version": { - Value: atomic.LoadUint32(&instance.menuVersion), + Value: instance.menuVersion, Writable: true, Emit: prop.EmitTrue, Callback: nil, @@ -175,8 +168,9 @@ type menuLayout = struct { func addOrUpdateMenuItem(item *MenuItem) { var layout *menuLayout + instance.menuLock.Lock() + defer instance.menuLock.Unlock() m, exists := findLayout(int32(item.id)) - if exists { layout = m } else { @@ -191,14 +185,10 @@ func addOrUpdateMenuItem(item *MenuItem) { m, ok := findLayout(int32(item.parent.id)) if ok { parent = m - instance.menuLock.Lock() parent.V1["children-display"] = dbus.MakeVariant("submenu") - instance.menuLock.Unlock() } } - instance.menuLock.Lock() parent.V2 = append(parent.V2, dbus.MakeVariant(layout)) - instance.menuLock.Unlock() } applyItemToLayout(item, layout) @@ -208,6 +198,8 @@ func addOrUpdateMenuItem(item *MenuItem) { } func addSeparator(id uint32) { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() layout := &menuLayout{ V0: int32(id), V1: map[string]dbus.Variant{ @@ -215,15 +207,11 @@ func addSeparator(id uint32) { }, V2: []dbus.Variant{}, } - instance.menuLock.Lock() instance.menu.V2 = append(instance.menu.V2, dbus.MakeVariant(layout)) - instance.menuLock.Unlock() + refresh() } func applyItemToLayout(in *MenuItem, out *menuLayout) { - instance.menuLock.Lock() - defer instance.menuLock.Unlock() - out.V1["type"] = dbus.MakeVariant("standard") out.V1["enabled"] = dbus.MakeVariant(!in.disabled) out.V1["label"] = dbus.MakeVariant(in.title) @@ -244,8 +232,6 @@ func findLayout(id int32) (*menuLayout, bool) { if id == 0 { return instance.menu, true } - instance.menuLock.RLock() - defer instance.menuLock.RUnlock() return findSubLayout(id, instance.menu.V2) } @@ -268,52 +254,51 @@ func findSubLayout(id int32, vals []dbus.Variant) (*menuLayout, bool) { } func hideMenuItem(item *MenuItem) { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() m, exists := findLayout(int32(item.id)) if exists { - instance.menuLock.Lock() m.V1["visible"] = dbus.MakeVariant(false) - instance.menuLock.Unlock() refresh() } } func showMenuItem(item *MenuItem) { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() m, exists := findLayout(int32(item.id)) if exists { - instance.menuLock.Lock() m.V1["visible"] = dbus.MakeVariant(true) - instance.menuLock.Unlock() refresh() } } func refresh() { - instance.lock.RLock() - conn := instance.conn - menuProps := instance.menuProps - instance.lock.RUnlock() - if conn != nil && menuProps != nil { - version := atomic.AddUint32(&instance.menuVersion, 1) - dbusErr := menuProps.Set("com.canonical.dbusmenu", "Version", - dbus.MakeVariant(version)) - if dbusErr != nil { - log.Printf("systray error: failed to update menu version: %s\n", dbusErr) - return - } - - err := menu.Emit(conn, &menu.Dbusmenu_LayoutUpdatedSignal{ - Path: menuPath, - Body: &menu.Dbusmenu_LayoutUpdatedSignalBody{ - Revision: version, - }, - }) - if err != nil { - log.Printf("systray error: failed to emit layout updated signal: %s\n", err) - } + if instance.conn == nil || instance.menuProps == nil { + return + } + instance.menuVersion++ + dbusErr := instance.menuProps.Set("com.canonical.dbusmenu", "Version", + dbus.MakeVariant(instance.menuVersion)) + if dbusErr != nil { + log.Printf("systray error: failed to update menu version: %s\n", dbusErr) + return } + err := menu.Emit(instance.conn, &menu.Dbusmenu_LayoutUpdatedSignal{ + Path: menuPath, + Body: &menu.Dbusmenu_LayoutUpdatedSignalBody{ + Revision: instance.menuVersion, + }, + }) + if err != nil { + log.Printf("systray error: failed to emit layout updated signal: %s\n", err) + } + } func resetMenu() { + instance.menuLock.Lock() + defer instance.menuLock.Unlock() instance.menu = &menuLayout{} instance.menuVersion++ refresh() diff --git a/vendor/fyne.io/systray/systray_notlinux.go b/vendor/fyne.io/systray/systray_notlinux.go deleted file mode 100644 index d37fa887da..0000000000 --- a/vendor/fyne.io/systray/systray_notlinux.go +++ /dev/null @@ -1,22 +0,0 @@ -// !build windows,darwin -package systray - -import ( - "log" -) - -func systrayMenuItemSelected(id uint32) { - menuItemsLock.RLock() - item, ok := menuItems[id] - menuItemsLock.RUnlock() - if !ok { - log.Printf("systray error: no menu item with ID %d\n", id) - return - } - select { - case item.ClickedCh <- struct{}{}: - // in case no one waiting for the channel - default: - } -} - diff --git a/vendor/fyne.io/systray/systray_unix.go b/vendor/fyne.io/systray/systray_unix.go index 33d370da14..053bb5aa93 100644 --- a/vendor/fyne.io/systray/systray_unix.go +++ b/vendor/fyne.io/systray/systray_unix.go @@ -131,11 +131,12 @@ func SetTooltip(tooltipTitle string) { } } -// SetTemplateIcon sets the icon of a menu item as a template icon (on macOS). On Windows, it -// falls back to the regular icon bytes and on Linux it does nothing. +// SetTemplateIcon sets the icon of a menu item as a template icon (on macOS). On Windows and +// Linux, it falls back to the regular icon bytes. // templateIconBytes and regularIconBytes should be the content of .ico for windows and // .ico/.jpg/.png for other platforms. func (item *MenuItem) SetTemplateIcon(templateIconBytes []byte, regularIconBytes []byte) { + item.SetIcon(regularIconBytes) } func setInternalLoop(_ bool) { @@ -242,7 +243,7 @@ type tray struct { // title and tooltip state title, tooltipTitle string - lock sync.RWMutex + lock sync.Mutex menu *menuLayout menuLock sync.RWMutex props, menuProps *prop.Properties @@ -250,11 +251,8 @@ type tray struct { } func (t *tray) createPropSpec() map[string]map[string]*prop.Prop { - t.lock.RLock() - title := t.title - tooltipTitle := t.tooltipTitle - iconData := t.iconData - t.lock.RUnlock() + t.lock.Lock() + t.lock.Unlock() return map[string]map[string]*prop.Prop{ "org.kde.StatusNotifierItem": { "Status": { @@ -264,7 +262,7 @@ func (t *tray) createPropSpec() map[string]map[string]*prop.Prop { Callback: nil, }, "Title": { - Value: title, + Value: t.title, Writable: true, Emit: prop.EmitTrue, Callback: nil, @@ -288,7 +286,7 @@ func (t *tray) createPropSpec() map[string]map[string]*prop.Prop { Callback: nil, }, "IconPixmap": { - Value: []PX{convertToPixels(iconData)}, + Value: []PX{convertToPixels(t.iconData)}, Writable: true, Emit: prop.EmitTrue, Callback: nil, @@ -312,7 +310,7 @@ func (t *tray) createPropSpec() map[string]map[string]*prop.Prop { Callback: nil, }, "ToolTip": { - Value: tooltip{V2: tooltipTitle}, + Value: tooltip{V2: t.tooltipTitle}, Writable: true, Emit: prop.EmitTrue, Callback: nil, diff --git a/vendor/modules.txt b/vendor/modules.txt index 4b9584be1c..37aff4defa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# fyne.io/systray v1.10.0 +# fyne.io/systray v1.10.1-0.20220621085403-9a2652634e93 ## explicit fyne.io/systray fyne.io/systray/internal/generated/menu From 30bd373b7702254d7d1c8f45fbaf55f4a1ec6e1e Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 21 Jun 2022 15:25:15 +0100 Subject: [PATCH 12/29] Fix issue bold not applying if it is the last text item Fixes #2974 --- widget/markdown.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widget/markdown.go b/widget/markdown.go index 59eef9093d..2fe5cb7854 100644 --- a/widget/markdown.go +++ b/widget/markdown.go @@ -172,7 +172,7 @@ func (m *markdownRenderer) handleExitNode(n ast.Node) error { } else if !m.blockquote && !m.heading { if len(m.segs) > 0 { if text, ok := m.segs[len(m.segs)-1].(*TextSegment); ok && n.Kind().String() == "Paragraph" { - text.Style = RichTextStyleParagraph + text.Style.Inline = false } } m.nextSeg = &TextSegment{ From f97a14ed6abd26e03e2eee74997aa9ef6946ae83 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 21 Jun 2022 19:55:04 +0100 Subject: [PATCH 13/29] Add missing test --- widget/markdown_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/widget/markdown_test.go b/widget/markdown_test.go index 81a03e791b..9c0ea9bce5 100644 --- a/widget/markdown_test.go +++ b/widget/markdown_test.go @@ -58,12 +58,12 @@ func TestRichTextMarkdown_Code_Incomplete(t *testing.T) { } func TestRichTextMarkdown_Emphasis(t *testing.T) { - r := NewRichTextFromMarkdown("*a*.") + r := NewRichTextFromMarkdown("*a*") - assert.Equal(t, 2, len(r.Segments)) + assert.Equal(t, 1, len(r.Segments)) if text, ok := r.Segments[0].(*TextSegment); ok { assert.Equal(t, "a", text.Text) - assert.Equal(t, RichTextStyleEmphasis, text.Style) + assert.True(t, text.Style.TextStyle.Italic) } else { t.Error("Segment should be text") } @@ -73,7 +73,7 @@ func TestRichTextMarkdown_Emphasis(t *testing.T) { assert.Equal(t, 2, len(r.Segments)) if text, ok := r.Segments[0].(*TextSegment); ok { assert.Equal(t, "b", text.Text) - assert.Equal(t, RichTextStyleStrong, text.Style) + assert.True(t, text.Style.TextStyle.Bold) } else { t.Error("Segment should be text") } From 601f9f18f2fe83eed7a2a571f23059394616cf1e Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 21 Jun 2022 21:16:00 +0100 Subject: [PATCH 14/29] Update CHANGELOG for rc1 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a138df6fed..c564b2c466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ More detailed release notes can be found on the [releases page](https://github.c * Windows missing version metadata when packaged (#3046) * Fyne package would not build apps using old Fyne versions * System tray icon may not be removed on app exit in Windows +* Emphasis in Markdown gives erroneous output in RichText (#2974) ## 2.2.1 - 12 June 2022 From bef5371fc9849f791088c36d243488841237f692 Mon Sep 17 00:00:00 2001 From: Daniel Stutz Date: Wed, 22 Jun 2022 19:48:19 +0200 Subject: [PATCH 15/29] do not consider hidden windows as candidates for requesting focus --- internal/driver/glfw/driver.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/driver/glfw/driver.go b/internal/driver/glfw/driver.go index dd1137cdda..d6969e0f30 100644 --- a/internal/driver/glfw/driver.go +++ b/internal/driver/glfw/driver.go @@ -123,6 +123,9 @@ func (d *gLDriver) focusPreviousWindow() { var chosen fyne.Window for _, w := range wins { + if !w.(*window).visible { + continue + } chosen = w if w.(*window).master { break From 78d5f45aa9556c2f3e634bc1dfd2d75980ae72b8 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Wed, 22 Jun 2022 22:00:41 +0100 Subject: [PATCH 16/29] Don't re-show windows accidentally to v2.2.2 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c564b2c466..ac8e787fcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ More detailed release notes can be found on the [releases page](https://github.c * Fyne package would not build apps using old Fyne versions * System tray icon may not be removed on app exit in Windows * Emphasis in Markdown gives erroneous output in RichText (#2974) +* When last visible window is closed, hidden window is set visi le (#3059) ## 2.2.1 - 12 June 2022 From 19d461415f4eda32f92964f5918bfb7be37de435 Mon Sep 17 00:00:00 2001 From: d1ss0nanz Date: Fri, 24 Jun 2022 12:12:43 +0200 Subject: [PATCH 17/29] =?UTF-8?q?only=20quit=20applications=20when=20no=20?= =?UTF-8?q?windows=20remain=20if=20theres=20no=20systrayMen=E2=80=A6=20(#3?= =?UTF-8?q?094)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit document changed behavior of window.Close() --- internal/driver/glfw/loop.go | 2 +- window.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/driver/glfw/loop.go b/internal/driver/glfw/loop.go index f013dba3c5..f851822b46 100644 --- a/internal/driver/glfw/loop.go +++ b/internal/driver/glfw/loop.go @@ -181,7 +181,7 @@ func (d *gLDriver) runGL() { d.windows = newWindows d.windowLock.Unlock() - if len(newWindows) == 0 { + if d.systrayMenu == nil && len(newWindows) == 0 { d.Quit() } } diff --git a/window.go b/window.go index fc5f812374..be30cdc67c 100644 --- a/window.go +++ b/window.go @@ -76,7 +76,9 @@ type Window interface { // This will not destroy the window or cause the app to exit. Hide() // Close the window. - // If it is the only open window, or the "master" window the app will Quit. + // If it is he "master" window the app will Quit. + // If it is the only open window and no menu is set via [desktop.App] + // SetSystemTrayMenu the app will also Quit. Close() // ShowAndRun is a shortcut to show the window and then run the application. From bc2dfb5d25955c962342305da8a189a6b89e8a26 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Fri, 24 Jun 2022 11:15:05 +0100 Subject: [PATCH 18/29] Wrap up changelog for v2.2.2 --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac8e787fcd..8176ffccb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ 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.2.2 - Ongoing +## 2.2.2 - 28 June 2022 ### Fixed @@ -12,6 +12,7 @@ More detailed release notes can be found on the [releases page](https://github.c * System tray icon may not be removed on app exit in Windows * Emphasis in Markdown gives erroneous output in RichText (#2974) * When last visible window is closed, hidden window is set visi le (#3059) +* Do not close app when last window is closed but systrayMenu exists (#3092) ## 2.2.1 - 12 June 2022 From 81b8dc6e4e2c592d33de43b54feb821d6bd1d18c Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Fri, 24 Jun 2022 15:26:08 +0100 Subject: [PATCH 19/29] Fix typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8176ffccb2..cc0a84b85a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ More detailed release notes can be found on the [releases page](https://github.c * Fyne package would not build apps using old Fyne versions * System tray icon may not be removed on app exit in Windows * Emphasis in Markdown gives erroneous output in RichText (#2974) -* When last visible window is closed, hidden window is set visi le (#3059) +* When last visible window is closed, hidden window is set visible (#3059) * Do not close app when last window is closed but systrayMenu exists (#3092) From 282ae68be75744a121af4e569db6dca4ee22e5d8 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sat, 25 Jun 2022 21:23:40 +0100 Subject: [PATCH 20/29] Fix nil pointer when compiling old app --- cmd/fyne/internal/commands/build.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/fyne/internal/commands/build.go b/cmd/fyne/internal/commands/build.go index dab3f363e3..cc663f0e9f 100644 --- a/cmd/fyne/internal/commands/build.go +++ b/cmd/fyne/internal/commands/build.go @@ -8,11 +8,12 @@ import ( "runtime" "strings" + version "github.com/mcuadros/go-version" + "github.com/urfave/cli/v2" + "fyne.io/fyne/v2" "fyne.io/fyne/v2/cmd/fyne/internal/metadata" "fyne.io/fyne/v2/cmd/fyne/internal/templates" - version "github.com/mcuadros/go-version" - "github.com/urfave/cli/v2" ) // Builder generate the executables. @@ -223,7 +224,7 @@ func (b *Builder) build() error { close, err := b.injectMetadataIfPossible(fyneGoModRunner, b.createMetadataInitFile) if err != nil { fyne.LogError("Failed to inject metadata init file, omitting metadata", err) - } else { + } else if close != nil { defer close() } From 1ed3e56996f0fc4e537b811a3b1e7c37446cc509 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 27 Jun 2022 14:50:37 +0100 Subject: [PATCH 21/29] Don't forget about icons set before systray menu --- internal/driver/glfw/driver_desktop.go | 29 ++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/internal/driver/glfw/driver_desktop.go b/internal/driver/glfw/driver_desktop.go index c3f6de449e..59e4613fbd 100644 --- a/internal/driver/glfw/driver_desktop.go +++ b/internal/driver/glfw/driver_desktop.go @@ -13,7 +13,10 @@ import ( "fyne.io/fyne/v2/theme" ) -var setup sync.Once +var ( + iconSet fyne.Resource + setup sync.Once +) func goroutineID() (id uint64) { var buf [30]byte @@ -27,16 +30,12 @@ func goroutineID() (id uint64) { func (d *gLDriver) SetSystemTrayMenu(m *fyne.Menu) { setup.Do(func() { d.trayStart, d.trayStop = systray.RunWithExternalLoop(func() { - if fyne.CurrentApp().Icon() != nil { - img, err := toOSIcon(fyne.CurrentApp().Icon()) - if err == nil { - systray.SetIcon(img) - } + if iconSet != nil { + d.SetSystemTrayIcon(iconSet) + } else if fyne.CurrentApp().Icon() != nil { + d.SetSystemTrayIcon(fyne.CurrentApp().Icon()) } else { - img, err := toOSIcon(theme.FyneLogo()) - if err == nil { - systray.SetIcon(img) - } + d.SetSystemTrayIcon(theme.FyneLogo()) } // it must be refreshed after init, so an earlier call would have been ineffective @@ -86,7 +85,15 @@ func (d *gLDriver) refreshSystray(m *fyne.Menu) { } func (d *gLDriver) SetSystemTrayIcon(resource fyne.Resource) { - systray.SetIcon(resource.Content()) + iconSet = resource // in case we need it later + + img, err := toOSIcon(resource) + if err != nil { + fyne.LogError("Failed to convert systray icon", err) + return + } + + systray.SetIcon(img) } func (d *gLDriver) SystemTrayMenu() *fyne.Menu { From 9689be816643193ad3a80730501643b687ca293e Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 27 Jun 2022 21:35:26 +0100 Subject: [PATCH 22/29] Better naming --- internal/driver/glfw/driver_desktop.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/driver/glfw/driver_desktop.go b/internal/driver/glfw/driver_desktop.go index 59e4613fbd..cdc4b2d40f 100644 --- a/internal/driver/glfw/driver_desktop.go +++ b/internal/driver/glfw/driver_desktop.go @@ -14,8 +14,8 @@ import ( ) var ( - iconSet fyne.Resource - setup sync.Once + systrayIcon fyne.Resource + setup sync.Once ) func goroutineID() (id uint64) { @@ -30,8 +30,8 @@ func goroutineID() (id uint64) { func (d *gLDriver) SetSystemTrayMenu(m *fyne.Menu) { setup.Do(func() { d.trayStart, d.trayStop = systray.RunWithExternalLoop(func() { - if iconSet != nil { - d.SetSystemTrayIcon(iconSet) + if systrayIcon != nil { + d.SetSystemTrayIcon(systrayIcon) } else if fyne.CurrentApp().Icon() != nil { d.SetSystemTrayIcon(fyne.CurrentApp().Icon()) } else { @@ -85,7 +85,7 @@ func (d *gLDriver) refreshSystray(m *fyne.Menu) { } func (d *gLDriver) SetSystemTrayIcon(resource fyne.Resource) { - iconSet = resource // in case we need it later + systrayIcon = resource // in case we need it later img, err := toOSIcon(resource) if err != nil { From f2d9f37c4f27396c0a7eab831d6ebdec8323c79d Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 27 Jun 2022 19:48:08 +0100 Subject: [PATCH 23/29] The uniqueID should be read from the metadata if it is present Also update docs to reference this. now has a uniqueID if metadata is present --- app/app.go | 14 ++++++++------ app/app_test.go | 5 +++++ app/preferences.go | 2 +- app/storage.go | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/app/app.go b/app/app.go index 324798adae..c18818bccf 100644 --- a/app/app.go +++ b/app/app.go @@ -54,7 +54,7 @@ func (a *fyneApp) UniqueID() string { return a.Metadata().ID } - fyne.LogError("Preferences API requires a unique ID, use app.NewWithID()", nil) + fyne.LogError("Preferences API requires a unique ID, use app.NewWithID() or the FyneApp.toml ID field", nil) a.uniqueID = "missing-id-" + strconv.FormatInt(time.Now().Unix(), 10) // This is a fake unique - it just has to not be reused... return a.uniqueID } @@ -94,8 +94,8 @@ func (a *fyneApp) Storage() fyne.Storage { } func (a *fyneApp) Preferences() fyne.Preferences { - if a.uniqueID == "" { - fyne.LogError("Preferences API requires a unique ID, use app.NewWithID()", nil) + if a.UniqueID() == "" { + fyne.LogError("Preferences API requires a unique ID, use app.NewWithID() or the FyneApp.toml ID field", nil) } return a.prefs } @@ -104,10 +104,12 @@ func (a *fyneApp) Lifecycle() fyne.Lifecycle { return a.lifecycle } -// New returns a new application instance with the default driver and no unique ID +// New returns a new application instance with the default driver and no unique ID (unless specified in FyneApp.toml) func New() fyne.App { - internal.LogHint("Applications should be created with a unique ID using app.NewWithID()") - return NewWithID("") + if meta.ID == "" { + internal.LogHint("Applications should be created with a unique ID using app.NewWithID()") + } + return NewWithID(meta.ID) } func newAppWithDriver(d fyne.Driver, id string) fyne.App { diff --git a/app/app_test.go b/app/app_test.go index df31672785..d87c0e1264 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -29,6 +29,11 @@ func TestFyneApp_UniqueID(t *testing.T) { app := NewWithID(appID) assert.Equal(t, appID, app.UniqueID()) + + meta.ID = "fakedInject" + app = New() + + assert.Equal(t, meta.ID, app.UniqueID()) } func TestFyneApp_OpenURL(t *testing.T) { diff --git a/app/preferences.go b/app/preferences.go index c41617797c..ac3258126c 100644 --- a/app/preferences.go +++ b/app/preferences.go @@ -124,7 +124,7 @@ func newPreferences(app *fyneApp) *preferences { p.InMemoryPreferences = internal.NewInMemoryPreferences() // don't load or watch if not setup - if app.uniqueID == "" { + if app.UniqueID() == "" { return p } diff --git a/app/storage.go b/app/storage.go index ac5aa034fc..1df2267949 100644 --- a/app/storage.go +++ b/app/storage.go @@ -14,7 +14,7 @@ type store struct { } func (s *store) RootURI() fyne.URI { - if s.a.uniqueID == "" { + if s.a.UniqueID() == "" { fyne.LogError("Storage API requires a unique ID, use app.NewWithID()", nil) return storage.NewFileURI(os.TempDir()) } From 5218469f83e53609c79869d3a4a0277656f1d703 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 27 Jun 2022 19:53:57 +0100 Subject: [PATCH 24/29] We need better fallback metadata to do this right --- app/meta.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/meta.go b/app/meta.go index cdb844a701..99cbdab1ea 100644 --- a/app/meta.go +++ b/app/meta.go @@ -5,9 +5,9 @@ import ( ) var meta = fyne.AppMetadata{ - ID: "com.example", - Name: "Fyne App", - Version: "1.0.0", + ID: "", + Name: "", + Version: "0.0.1", Build: 1, } From 0cfda7a5a8cdfad9610207589bc3b45569206930 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 27 Jun 2022 19:26:56 +0100 Subject: [PATCH 25/29] Fix regression where OriginalFill images would never show Fixes #3102 --- CHANGELOG.md | 1 + internal/painter/image.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc0a84b85a..d6bbe9f504 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ More detailed release notes can be found on the [releases page](https://github.c * Emphasis in Markdown gives erroneous output in RichText (#2974) * When last visible window is closed, hidden window is set visible (#3059) * Do not close app when last window is closed but systrayMenu exists (#3092) +* Image with ImageFillOriginal not showing (#3102) ## 2.2.1 - 12 June 2022 diff --git a/internal/painter/image.go b/internal/painter/image.go index 3cf59c7673..93e453fa61 100644 --- a/internal/painter/image.go +++ b/internal/painter/image.go @@ -46,8 +46,8 @@ func PaintImage(img *canvas.Image, c fyne.Canvas, width, height int) image.Image var wantOrigW, wantOrigH int wantOrigSize := false if img.FillMode == canvas.ImageFillOriginal && c != nil { - wantOrigW = internal.ScaleInt(c, img.Size().Width) - wantOrigH = internal.ScaleInt(c, img.Size().Height) + wantOrigW = internal.ScaleInt(c, img.MinSize().Width) + wantOrigH = internal.ScaleInt(c, img.MinSize().Height) wantOrigSize = true } @@ -124,12 +124,14 @@ func paintImage(img *canvas.Image, width, height int, wantOrigSize bool, wantOri } origSize := pixels.Bounds().Size() + origW, origH = origSize.X, origSize.Y if checkSize(origSize.X, origSize.Y) { dst = scaleImage(pixels, width, height, img.ScaleMode) } } case img.Image != nil: origSize := img.Image.Bounds().Size() + origW, origH = origSize.X, origSize.Y if checkSize(origSize.X, origSize.Y) { dst = scaleImage(img.Image, width, height, img.ScaleMode) } From d55ffe3b313ba368406f247081b57cfd46bfdd7c Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Mon, 27 Jun 2022 21:33:06 +0100 Subject: [PATCH 26/29] Add min size check for original fill --- internal/painter/image_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/internal/painter/image_test.go b/internal/painter/image_test.go index ed0a0127ae..212c390fd6 100644 --- a/internal/painter/image_test.go +++ b/internal/painter/image_test.go @@ -5,10 +5,29 @@ import ( "fyne.io/fyne/v2" "fyne.io/fyne/v2/canvas" + "fyne.io/fyne/v2/internal/painter" "fyne.io/fyne/v2/internal/painter/software" "fyne.io/fyne/v2/test" + "github.com/stretchr/testify/assert" ) +func TestPaintImage_MinSize(t *testing.T) { + img := canvas.NewImageFromFile("testdata/svg-stroke-default.png") + img.FillMode = canvas.ImageFillOriginal + c := test.NewCanvasWithPainter(software.NewPainter()) + c.SetScale(1.0) + c.SetContent(img) + + // check fallback min + assert.Equal(t, float32(1), img.MinSize().Width) + assert.Equal(t, float32(1), img.MinSize().Height) + + // render it with original will set min + painter.PaintImage(img, c, 100, 100) + assert.Equal(t, float32(480), img.MinSize().Width) + assert.Equal(t, float32(240), img.MinSize().Height) +} + func TestPaintImage_SVG(t *testing.T) { test.NewApp() defer test.NewApp() From 5a5278e224af6495f2bbfa96c6e509d02ab69e2a Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 28 Jun 2022 23:15:17 +0100 Subject: [PATCH 27/29] avoid printing warning about app ID --- app/preferences.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/preferences.go b/app/preferences.go index ac3258126c..705e72c386 100644 --- a/app/preferences.go +++ b/app/preferences.go @@ -79,10 +79,10 @@ func (p *preferences) saveToFile(path string) error { } func (p *preferences) load() { - err := p.loadFromFile(p.storagePath()) - if err != nil { - fyne.LogError("Preferences load error:", err) - } + // err := p.loadFromFile(p.storagePath()) + // if err != nil { + // fyne.LogError("Preferences load error:", err) + // } } func (p *preferences) loadFromFile(path string) (err error) { @@ -124,7 +124,7 @@ func newPreferences(app *fyneApp) *preferences { p.InMemoryPreferences = internal.NewInMemoryPreferences() // don't load or watch if not setup - if app.UniqueID() == "" { + if app.uniqueID == "" && app.Metadata().ID == "" { return p } From 74c434b4ad2c918bc8470a4ebdcd2b3daea5b324 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Tue, 28 Jun 2022 23:54:33 +0100 Subject: [PATCH 28/29] Fix building for web on a darwin computer (#3107) --- app/app_darwin.go | 4 ++-- app/app_desktop_darwin.go | 4 ++-- app/app_notlegacy_darwin.go | 4 ++-- dialog/file_darwin.go | 4 ++-- internal/driver/glfw/menu_darwin.go | 4 ++-- internal/driver/glfw/menu_other.go | 4 ++-- internal/painter/gl/gl_core.go | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/app_darwin.go b/app/app_darwin.go index 37048031ae..1cb1eb202f 100644 --- a/app/app_darwin.go +++ b/app/app_darwin.go @@ -1,5 +1,5 @@ -//go:build !ci -// +build !ci +//go:build !ci && !js && !wasm && !test_web_driver +// +build !ci,!js,!wasm,!test_web_driver package app diff --git a/app/app_desktop_darwin.go b/app/app_desktop_darwin.go index 48200c99c8..e1d3eb9a74 100644 --- a/app/app_desktop_darwin.go +++ b/app/app_desktop_darwin.go @@ -1,5 +1,5 @@ -//go:build !ci && !ios -// +build !ci,!ios +//go:build !ci && !ios && !js && !wasm && !test_web_driver +// +build !ci,!ios,!js,!wasm,!test_web_driver package app diff --git a/app/app_notlegacy_darwin.go b/app/app_notlegacy_darwin.go index 59f741d9f4..7a72bb2aca 100644 --- a/app/app_notlegacy_darwin.go +++ b/app/app_notlegacy_darwin.go @@ -1,5 +1,5 @@ -//go:build !ci && !legacy -// +build !ci,!legacy +//go:build !ci && !legacy && !js && !wasm && !test_web_driver +// +build !ci,!legacy,!js,!wasm,!test_web_driver package app diff --git a/dialog/file_darwin.go b/dialog/file_darwin.go index dfa74764a3..9d7f756ca7 100644 --- a/dialog/file_darwin.go +++ b/dialog/file_darwin.go @@ -1,5 +1,5 @@ -//go:build !ios -// +build !ios +//go:build !ios && !android && !wasm && !js +// +build !ios,!android,!wasm,!js package dialog diff --git a/internal/driver/glfw/menu_darwin.go b/internal/driver/glfw/menu_darwin.go index 9ce598deda..c2fa76654a 100644 --- a/internal/driver/glfw/menu_darwin.go +++ b/internal/driver/glfw/menu_darwin.go @@ -1,5 +1,5 @@ -//go:build !no_native_menus -// +build !no_native_menus +//go:build !no_native_menus && !js && !wasm && !test_web_driver +// +build !no_native_menus,!js,!wasm,!test_web_driver package glfw diff --git a/internal/driver/glfw/menu_other.go b/internal/driver/glfw/menu_other.go index e6d717089a..260217e9ea 100644 --- a/internal/driver/glfw/menu_other.go +++ b/internal/driver/glfw/menu_other.go @@ -1,5 +1,5 @@ -//go:build !darwin || no_native_menus -// +build !darwin no_native_menus +//go:build !darwin || js || wasm || test_web_driver || no_native_menus +// +build !darwin js wasm test_web_driver no_native_menus package glfw diff --git a/internal/painter/gl/gl_core.go b/internal/painter/gl/gl_core.go index d858741015..f631b24883 100644 --- a/internal/painter/gl/gl_core.go +++ b/internal/painter/gl/gl_core.go @@ -1,5 +1,5 @@ -//go:build (!gles && !arm && !arm64 && !android && !ios && !mobile && !js && !test_web_driver && !wasm) || (darwin && !mobile && !ios) -// +build !gles,!arm,!arm64,!android,!ios,!mobile,!js,!test_web_driver,!wasm darwin,!mobile,!ios +//go:build (!gles && !arm && !arm64 && !android && !ios && !mobile && !js && !test_web_driver && !wasm) || (darwin && !mobile && !ios && !js && !wasm && !test_web_driver) +// +build !gles,!arm,!arm64,!android,!ios,!mobile,!js,!test_web_driver,!wasm darwin,!mobile,!ios,!js,!wasm,!test_web_driver package gl From 545dd6065517cb3ab530c2cb4f1844374c7c8e8f Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Thu, 30 Jun 2022 21:59:24 +0100 Subject: [PATCH 29/29] Fix release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6bbe9f504..4d89decd06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ 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.2.2 - 28 June 2022 +## 2.2.2 - 30 June 2022 ### Fixed