try a better way to work around initial occasional window misdrawing on Linux

This commit is contained in:
Drew Weymouth
2024-06-23 08:28:27 -07:00
parent 96cbbf0e15
commit 16fd76f0aa
2 changed files with 21 additions and 17 deletions
+8 -7
View File
@@ -50,19 +50,20 @@ func main() {
myApp.OnExit = mainWindow.Quit
go func() {
defaultServer := myApp.ServerManager.GetDefaultServer()
if defaultServer == nil {
mainWindow.Controller.PromptForFirstServer()
} else {
mainWindow.Controller.DoConnectToServerWorkflow(defaultServer)
}
// TODO: There is a race condition with laying out the window before the
// window creation animation on Ubuntu (and other DEs?) finishes, where
// the window will be misdrawn into a smaller area if the animation hasn't finished.
// This makes it much less likely to occur (not seen on dozens of startups)
// but is a hacky "solution"!
if runtime.GOOS == "linux" {
time.Sleep(250 * time.Millisecond)
}
defaultServer := myApp.ServerManager.GetDefaultServer()
if defaultServer == nil {
mainWindow.Controller.PromptForFirstServer()
} else {
mainWindow.Controller.DoConnectToServerWorkflow(defaultServer)
time.Sleep(350 * time.Millisecond)
mainWindow.ForceResize()
}
}()