only use window size workaround on linux where needed
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -62,16 +63,18 @@ 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
|
||||||
workaroundWindowSize := sync.OnceFunc(func() {
|
if runtime.GOOS == "linux" {
|
||||||
time.Sleep(50 * time.Millisecond)
|
workaroundWindowSize := sync.OnceFunc(func() {
|
||||||
s := mainWindow.DesiredSize()
|
time.Sleep(50 * time.Millisecond)
|
||||||
mainWindow.Window.Resize(s.Subtract(fyne.NewSize(4, 0)))
|
s := mainWindow.DesiredSize()
|
||||||
time.Sleep(50 * time.Millisecond)
|
mainWindow.Window.Resize(s.Subtract(fyne.NewSize(4, 0)))
|
||||||
mainWindow.Window.Resize(s) // back to desired size
|
time.Sleep(50 * time.Millisecond)
|
||||||
})
|
mainWindow.Window.Resize(s) // back to desired size
|
||||||
fyneApp.Lifecycle().SetOnEnteredForeground(func() {
|
})
|
||||||
workaroundWindowSize()
|
fyneApp.Lifecycle().SetOnEnteredForeground(func() {
|
||||||
})
|
workaroundWindowSize()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
mainWindow.ShowAndRun()
|
mainWindow.ShowAndRun()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user