only use window size workaround on linux where needed

This commit is contained in:
Drew Weymouth
2024-08-15 08:17:42 -07:00
parent 40c730d4c0
commit b44fab22b2
+3
View File
@@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"log" "log"
"os" "os"
"runtime"
"sync" "sync"
"time" "time"
@@ -62,6 +63,7 @@ func main() {
}() }()
// slightly hacky workaround for https://github.com/fyne-io/fyne/issues/4964 // slightly hacky workaround for https://github.com/fyne-io/fyne/issues/4964
if runtime.GOOS == "linux" {
workaroundWindowSize := sync.OnceFunc(func() { workaroundWindowSize := sync.OnceFunc(func() {
time.Sleep(50 * time.Millisecond) time.Sleep(50 * time.Millisecond)
s := mainWindow.DesiredSize() s := mainWindow.DesiredSize()
@@ -72,6 +74,7 @@ func main() {
fyneApp.Lifecycle().SetOnEnteredForeground(func() { fyneApp.Lifecycle().SetOnEnteredForeground(func() {
workaroundWindowSize() workaroundWindowSize()
}) })
}
mainWindow.ShowAndRun() mainWindow.ShowAndRun()