Skip to content

Commit

Permalink
Fix certain issues with Resize and FixedSize windows
Browse files Browse the repository at this point in the history
This is pretty much Linux specific due to the order of
resize operations and scale detection.

Fixes fyne-io#1105
  • Loading branch information
andydotxyz committed Jun 26, 2020
1 parent 3d6571a commit 6ec6e38
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions internal/driver/glfw/window.go
Expand Up @@ -157,15 +157,19 @@ func (w *window) RequestFocus() {
}

func (w *window) Resize(size fyne.Size) {
w.canvas.Resize(size)
w.viewLock.Lock()
if w.fixedSize || !w.visible { // fixed size ignores future `resized` and if not visible we may not get the event
w.width, w.height = internal.ScaleInt(w.canvas, size.Width), internal.ScaleInt(w.canvas, size.Height)
}
w.viewLock.Unlock()
// we cannot perform this until window is prepared as we don't know it's scale!

w.runOnMainWhenCreated(func() {
w.viewport.SetSize(w.width, w.height)
w.canvas.Resize(size)
w.viewLock.Lock()

width, height := internal.ScaleInt(w.canvas, size.Width), internal.ScaleInt(w.canvas, size.Height)
if w.fixedSize || !w.visible { // fixed size ignores future `resized` and if not visible we may not get the event
w.width, w.height = width, height
}
w.viewLock.Unlock()

w.viewport.SetSize(width, height)
w.fitContent()
})
}
Expand Down

0 comments on commit 6ec6e38

Please sign in to comment.