Skip to content

Commit

Permalink
Fix flicker, tear and other artefacts on resize
Browse files Browse the repository at this point in the history
This does add a little lag, especially on complex screens, but that is the tradeoff.
Resizing GL canvases is slow so unfortunately.

Fixes fyne-io#1114, fyne-io#1122, fyne-io#1140
  • Loading branch information
andydotxyz committed Jun 30, 2020
1 parent fce4b1f commit 2e97364
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion internal/driver/glfw/window.go
Expand Up @@ -501,7 +501,17 @@ func (w *window) resized(_ *glfw.Window, width, height int) {
w.width = internal.ScaleInt(w.canvas, canvasSize.Width)
w.height = internal.ScaleInt(w.canvas, canvasSize.Height)
}
w.canvas.Resize(canvasSize)

d, ok := fyne.CurrentApp().Driver().(*gLDriver)
if !ok { // don't wait to redraw in this way if we are running on test
w.canvas.Resize(canvasSize)
return
}

runOnDraw(w, func() {
w.canvas.Resize(canvasSize)
d.repaintWindow(w)
})
}

func (w *window) frameSized(viewport *glfw.Window, width, height int) {
Expand Down

0 comments on commit 2e97364

Please sign in to comment.