workaround for occasional linux window misdraw

This commit is contained in:
Drew Weymouth
2024-06-23 10:56:28 -07:00
parent 16fd76f0aa
commit 2736fe9955
6 changed files with 107 additions and 11 deletions
+7 -7
View File
@@ -56,15 +56,15 @@ func main() {
} 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"!
// hacky workaround for https://github.com/fyne-io/fyne/issues/4964
if runtime.GOOS == "linux" {
time.Sleep(350 * time.Millisecond)
mainWindow.ForceResize()
time.Sleep(100 * time.Millisecond)
w, h := mainWindow.DesiredSize()
scale := mainWindow.Window.Canvas().Scale()
SendResizeToPID(os.Getpid(), int(w*scale), int(h*scale))
}
}()
mainWindow.Show()