Skip to content

Commit

Permalink
Fix issue where some threading models could get stuck
Browse files Browse the repository at this point in the history
Internal content expanding triggered this on Windows
Fixes #1189
  • Loading branch information
andydotxyz committed Jul 20, 2020
1 parent f9eab2b commit 91bd741
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions internal/driver/glfw/window.go
Expand Up @@ -264,24 +264,27 @@ func (w *window) fitContent() {
}

minWidth, minHeight := w.minSizeOnScreen()
w.viewLock.Lock()
defer w.viewLock.Unlock()
w.viewLock.RLock()
view := w.viewport
w.viewLock.RUnlock()
if w.width < minWidth || w.height < minHeight {
if w.width < minWidth {
w.width = minWidth
}
if w.height < minHeight {
w.height = minHeight
}
w.viewLock.Lock()
w.shouldExpand = true // queue the resize to happen on main
w.viewLock.Unlock()
}
if w.fixedSize {
w.width = internal.ScaleInt(w.canvas, w.Canvas().Size().Width)
w.height = internal.ScaleInt(w.canvas, w.Canvas().Size().Height)

w.viewport.SetSizeLimits(w.width, w.height, w.width, w.height)
view.SetSizeLimits(w.width, w.height, w.width, w.height)
} else {
w.viewport.SetSizeLimits(minWidth, minHeight, glfw.DontCare, glfw.DontCare)
view.SetSizeLimits(minWidth, minHeight, glfw.DontCare, glfw.DontCare)
}
}

Expand Down

0 comments on commit 91bd741

Please sign in to comment.