add retrying to Fyne window misdraw workaround on Linux
This commit is contained in:
@@ -69,7 +69,16 @@ func main() {
|
||||
if !inDelta(size, desired, 1) {
|
||||
// window drawn at incorrect size on startup
|
||||
scale := canvas.Scale()
|
||||
SendResizeToPID(os.Getpid(), int(desired.Width*scale), int(desired.Height*scale))
|
||||
for i := 0; i < 3 && !inDelta(size, desired, 1); i++ {
|
||||
if i > 0 {
|
||||
// if resize didn't work the first time, try again with slightly
|
||||
// different desired size
|
||||
desired.Subtract(fyne.NewSize(2, 2))
|
||||
}
|
||||
SendResizeToPID(os.Getpid(), int(desired.Width*scale), int(desired.Height*scale))
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
size = canvas.Size()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user