Merge pull request #4 from dweymouth/develop
hacky solution to avoid occasional window misdrawing on startup
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"path"
|
||||
"supersonic/backend"
|
||||
"supersonic/ui"
|
||||
"time"
|
||||
|
||||
"fyne.io/fyne/v2/app"
|
||||
"github.com/20after4/configdir"
|
||||
@@ -28,6 +29,14 @@ func main() {
|
||||
|
||||
fyneApp := app.New()
|
||||
mainWindow := ui.NewMainWindow(fyneApp, appname, myApp)
|
||||
|
||||
// TODO: There is some race condition with running this initial startup
|
||||
// task immediately before showing and running the window/Fyne main loop where
|
||||
// the window can occasionally get misdrawn on startup. (Only seen on Ubuntu so far).
|
||||
// This makes it much less likely to occur (not seen on dozens of startups)
|
||||
// but is a hacky "solution"!
|
||||
go func() {
|
||||
time.Sleep(75 * time.Millisecond)
|
||||
defaultServer := myApp.Config.GetDefaultServer()
|
||||
if defaultServer == nil {
|
||||
mainWindow.PromptForFirstServer(func(nick, host, user, pass string) {
|
||||
@@ -42,10 +51,10 @@ func main() {
|
||||
} else {
|
||||
setupServer(myApp, defaultServer)
|
||||
}
|
||||
}()
|
||||
|
||||
mainWindow.Show()
|
||||
fyneApp.Run()
|
||||
|
||||
myApp.Config.WriteConfigFile(configPath())
|
||||
myApp.Shutdown()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user