fix content not loading on startup until window focused
This commit is contained in:
@@ -111,15 +111,8 @@ func main() {
|
|||||||
myApp.OnReactivate = util.FyneDoFunc(mainWindow.Show)
|
myApp.OnReactivate = util.FyneDoFunc(mainWindow.Show)
|
||||||
myApp.OnExit = util.FyneDoFunc(mainWindow.Quit)
|
myApp.OnExit = util.FyneDoFunc(mainWindow.Quit)
|
||||||
|
|
||||||
windowStartupTasks := sync.OnceFunc(func() {
|
|
||||||
defaultServer := myApp.ServerManager.GetDefaultServer()
|
|
||||||
if defaultServer == nil {
|
|
||||||
mainWindow.Controller.PromptForFirstServer()
|
|
||||||
} else if !*backend.FlagStartMinimized { // If the minimized start flag was passed, the connection is already established.
|
|
||||||
mainWindow.Controller.DoConnectToServerWorkflow(defaultServer)
|
|
||||||
}
|
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
|
windowStartupTasks := sync.OnceFunc(func() {
|
||||||
mainWindow.Window.(driver.NativeWindow).RunNative(func(ctx any) {
|
mainWindow.Window.(driver.NativeWindow).RunNative(func(ctx any) {
|
||||||
hwnd := ctx.(driver.WindowsWindowContext).HWND
|
hwnd := ctx.(driver.WindowsWindowContext).HWND
|
||||||
if myApp.Config.Application.EnableOSMediaPlayerAPIs {
|
if myApp.Config.Application.EnableOSMediaPlayerAPIs {
|
||||||
@@ -127,9 +120,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
myApp.SetupWindowsTaskbarButtons(hwnd)
|
myApp.SetupWindowsTaskbarButtons(hwnd)
|
||||||
})
|
})
|
||||||
}
|
|
||||||
})
|
})
|
||||||
fyneApp.Lifecycle().SetOnEnteredForeground(windowStartupTasks)
|
fyneApp.Lifecycle().SetOnEnteredForeground(windowStartupTasks)
|
||||||
|
}
|
||||||
|
|
||||||
if *backend.FlagStartMinimized {
|
if *backend.FlagStartMinimized {
|
||||||
if err = myApp.LoginToDefaultServer(); err != nil {
|
if err = myApp.LoginToDefaultServer(); err != nil {
|
||||||
@@ -138,6 +131,15 @@ func main() {
|
|||||||
}
|
}
|
||||||
fyneApp.Run()
|
fyneApp.Run()
|
||||||
} else {
|
} else {
|
||||||
|
fyneApp.Lifecycle().SetOnStarted(func() {
|
||||||
|
defaultServer := myApp.ServerManager.GetDefaultServer()
|
||||||
|
if defaultServer == nil {
|
||||||
|
mainWindow.Controller.PromptForFirstServer()
|
||||||
|
} else if !*backend.FlagStartMinimized { // If the minimized start flag was passed, the connection is already established.
|
||||||
|
mainWindow.Controller.DoConnectToServerWorkflow(defaultServer)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
mainWindow.ShowAndRun()
|
mainWindow.ShowAndRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user