diff --git a/CHANGELOG.md b/CHANGELOG.md index 4af3099309..19d973da40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,12 +16,28 @@ More detailed release notes can be found on the [releases page](https://github.c * Odd looking SelectEntry with long PlaceHolder (#4430) -## 2.5.1 - Ongoing +## 2.5.1 - 24 August 2024 ### Fixed * Apps with translations in new languages would not be recognised (#5015) * App ID can be ignored from metadata file with go build/run + * Typing Chinese characters in widget.Entry and perform undo/redo crashes the app (#5001) + * Assets would render Low-DPI before attaching to a canvas + * Single click in file dialog enters two directories (#5053) + * Light/Dark mode detection no longer works on Ubuntu with Fyne 2.5 (#5029) + * Scroll acceleration logic causes scrolling to "jump" suddenly on macOS (#5067) + * SetSystemTrayMenu doesn't work when run in goroutine (#5039) + * stack overflow when calling SetRowHeight in table UpdateCell callback (#5007) + * Resizing List causes visible items to refresh instead of resize (#4080) + * Child widget with Hoverable() interface keeps parent widget's Tapped() function from being called. (#3906) + * App Translation file is ignored / tries to load BR (#5015, #5040) + * Missing theme variant auto-switching (dark/light) for Windows (#4537) + * Get DoubleTapDelay from the OS if an API is available (#4448) + * Entry cursor is not visible with animations off (#4508) + * Redundant justify-content properties in CSS for centered-container class (#5045) + * Update go-text/render to avoid crashing when rendering certain bitmap fonts (#5042) + * Using container.NewThemeOverride leaks memory until window closing (#5000) ## 2.5.0 - 14 July 2024 @@ -91,6 +107,7 @@ More detailed release notes can be found on the [releases page](https://github.c * Add missed truncation mode for hyperlink (#4335) * AppTab does not display blue indicator line if you create it empty and then Append items to it later. * Many optimisations in animation, draw speed, layout and widget size calculations + * DocTabItem update text doesn't update the underline select bar (graphic glitch) (#3106) ## 2.4.5 - 15 April 2024 diff --git a/README.md b/README.md index 67582641d0..a1b85d2345 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,6 @@ It is designed to build applications that run on desktop and mobile devices with a single codebase. -Version 2.4 is the current release of the Fyne API, it added rounded corners, emoji, -layout debug support and table headers, along with a large number of -smaller feature additions. -We are now working towards the next big release, codenamed -[Elgin](https://github.com/fyne-io/fyne/milestone/21) -and more news will follow in our news feeds and GitHub project. - # Prerequisites To develop apps using Fyne you will need Go version 1.17 or later, a C compiler and your system's development tools. diff --git a/canvas/image.go b/canvas/image.go index f4d512c849..074bb6574d 100644 --- a/canvas/image.go +++ b/canvas/image.go @@ -353,6 +353,9 @@ func (i *Image) renderSVG(width, height float32) (image.Image, error) { if c != nil { // We want real output pixel count not just the screen coordinate space (i.e. macOS Retina) screenWidth, screenHeight = c.PixelCoordinateForPosition(fyne.Position{X: width, Y: height}) + } else { // no canvas info, assume HiDPI + screenWidth *= 2 + screenHeight *= 2 } tex := cache.GetSvg(i.name(), i, screenWidth, screenHeight) diff --git a/dialog/file.go b/dialog/file.go index 25856584a0..419fd73b05 100644 --- a/dialog/file.go +++ b/dialog/file.go @@ -535,7 +535,6 @@ func (f *fileDialog) setView(view ViewLayout) { fyne.CurrentApp().Preferences().SetInt(viewLayoutKey, int(view)) var selectF func(id int) choose := func(id int) { - selectF(id) if file, ok := f.getDataItem(id); ok { f.selectedID = id f.setSelected(file, id) @@ -555,7 +554,7 @@ func (f *fileDialog) setView(view ViewLayout) { parent := id == 0 && len(dir.Path()) < len(f.dir.Path()) _, isDir := dir.(fyne.ListableURI) o.(*fileDialogItem).setLocation(dir, isDir || parent, parent) - o.(*fileDialogItem).choose = choose + o.(*fileDialogItem).choose = selectF o.(*fileDialogItem).id = id o.(*fileDialogItem).open = f.open.OnTapped } diff --git a/dialog/file_test.go b/dialog/file_test.go index 36954edf87..3c0ae0e323 100644 --- a/dialog/file_test.go +++ b/dialog/file_test.go @@ -7,6 +7,7 @@ import ( "strings" "testing" + intWidget "fyne.io/fyne/v2/internal/widget" "github.com/stretchr/testify/assert" "fyne.io/fyne/v2" @@ -689,11 +690,9 @@ func TestSetFileNameBeforeShow(t *testing.T) { dOpen.Show() assert.NotEqual(t, "testfile.zip", dOpen.dialog.fileName.(*widget.Label).Text) - } func TestSetFileNameAfterShow(t *testing.T) { - win := test.NewTempWindow(t, widget.NewLabel("Content")) dSave := NewFileSave(func(fyne.URIWriteCloser, error) {}, win) dSave.Show() @@ -707,7 +706,25 @@ func TestSetFileNameAfterShow(t *testing.T) { dOpen.SetFileName("testfile.zip") assert.NotEqual(t, "testfile.zip", dOpen.dialog.fileName.(*widget.Label).Text) +} + +func TestTapParent_GoesUpOne(t *testing.T) { + win := test.NewTempWindow(t, widget.NewLabel("Content")) + d := NewFileOpen(func(fyne.URIReadCloser, error) {}, win) + home, _ := os.UserHomeDir() + homeURI, _ := storage.ListerForURI(storage.NewFileURI(home)) + parentURI, _ := storage.Parent(homeURI) + + d.SetView(GridView) + d.SetLocation(homeURI) + d.Show() + + items := test.WidgetRenderer(d.dialog.files) + item := items.Objects()[0].(*intWidget.Scroll).Content.(*fyne.Container).Objects[0] + parent := test.WidgetRenderer(item.(fyne.Widget)).Objects()[1].(*fileDialogItem) + test.Tap(parent) + assert.Equal(t, d.dialog.dir.String(), parentURI.String()) } func TestCreateNewFolderInDir(t *testing.T) { diff --git a/dialog/information.go b/dialog/information.go index 0deb27c1b9..6e52ca3b00 100644 --- a/dialog/information.go +++ b/dialog/information.go @@ -1,6 +1,9 @@ package dialog import ( + "unicode" + "unicode/utf8" + "fyne.io/fyne/v2" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/lang" @@ -35,7 +38,12 @@ func ShowInformation(title, message string, parent fyne.Window) { // The message is extracted from the provided error (should not be nil). // After creation you should call Show(). func NewError(err error, parent fyne.Window) Dialog { - return createInformationDialog(lang.L("Error"), err.Error(), theme.ErrorIcon(), parent) + dialogText := err.Error() + r, size := utf8.DecodeRuneInString(dialogText) + if r != utf8.RuneError { + dialogText = string(unicode.ToUpper(r)) + dialogText[size:] + } + return createInformationDialog(lang.L("Error"), dialogText, theme.ErrorIcon(), parent) } // ShowError shows a dialog over the specified window for an application error. diff --git a/dialog/information_test.go b/dialog/information_test.go index 285e4c187b..d82d048417 100644 --- a/dialog/information_test.go +++ b/dialog/information_test.go @@ -7,6 +7,7 @@ import ( "fyne.io/fyne/v2" "fyne.io/fyne/v2/test" "fyne.io/fyne/v2/theme" + "fyne.io/fyne/v2/widget" "github.com/stretchr/testify/assert" ) @@ -109,3 +110,20 @@ func TestDialog_ErrorCallback(t *testing.T) { assert.True(t, tapped) assert.True(t, information.win.Hidden) } + +func TestDialog_ErrorCapitalize(t *testing.T) { + err := errors.New("here is an error msg") + d := NewError(err, test.NewTempWindow(t, nil)) + assert.Equal(t, d.(*dialog).content.(*widget.Label).Text, + "Here is an error msg") + + err = errors.New("這是一條錯誤訊息") + d = NewError(err, test.NewTempWindow(t, nil)) + assert.Equal(t, d.(*dialog).content.(*widget.Label).Text, + "這是一條錯誤訊息") + + err = errors.New("") + d = NewError(err, test.NewTempWindow(t, nil)) + assert.Equal(t, d.(*dialog).content.(*widget.Label).Text, + "") +} diff --git a/internal/driver/glfw/scroll_speed_darwin.go b/internal/driver/glfw/scroll_speed_darwin.go index 4434a717c1..dcc985de93 100644 --- a/internal/driver/glfw/scroll_speed_darwin.go +++ b/internal/driver/glfw/scroll_speed_darwin.go @@ -3,7 +3,9 @@ package glfw const ( - scrollAccelerateRate = float64(5) + // MacOS applies its own scroll accelerate curve, so set + // scrollAccelerateRate to 1 for no acceleration effect + scrollAccelerateRate = float64(1) scrollAccelerateCutoff = float64(5) scrollSpeed = float32(10) ) diff --git a/internal/driver/glfw/window.go b/internal/driver/glfw/window.go index b5bcf5eea0..52cdfe6c2d 100644 --- a/internal/driver/glfw/window.go +++ b/internal/driver/glfw/window.go @@ -809,9 +809,9 @@ func (w *window) processFocused(focus bool) { } } curWindow = w - w.canvas.FocusGained() + w.QueueEvent(w.canvas.FocusGained) } else { - w.canvas.FocusLost() + w.QueueEvent(w.canvas.FocusLost) w.mouseLock.Lock() w.mousePos = fyne.Position{} w.mouseLock.Unlock()