mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
internal/uidriver/glfw: Bug fix: FramebufferSize callback was not called when the window size was not changed
Closes #1580
This commit is contained in:
parent
75b0e91228
commit
16d3085884
@ -1032,12 +1032,12 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
|
|||||||
newW := width
|
newW := width
|
||||||
newH := height
|
newH := height
|
||||||
if oldW != newW || oldH != newH {
|
if oldW != newW || oldH != newH {
|
||||||
ch := make(chan struct{})
|
ch := make(chan struct{}, 1)
|
||||||
u.window.SetFramebufferSizeCallback(func(_ *glfw.Window, _, _ int) {
|
u.window.SetFramebufferSizeCallback(func(_ *glfw.Window, _, _ int) {
|
||||||
u.window.SetFramebufferSizeCallback(nil)
|
ch <- struct{}{}
|
||||||
close(ch)
|
|
||||||
})
|
})
|
||||||
u.window.SetSize(newW, newH)
|
u.window.SetSize(newW, newH)
|
||||||
|
if w, h := u.window.GetSize(); w != oldW || h != oldH {
|
||||||
event:
|
event:
|
||||||
for {
|
for {
|
||||||
glfw.PollEvents()
|
glfw.PollEvents()
|
||||||
@ -1048,6 +1048,9 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
u.window.SetFramebufferSizeCallback(nil)
|
||||||
|
close(ch)
|
||||||
|
}
|
||||||
|
|
||||||
// Window title might be lost on macOS after coming back from fullscreen.
|
// Window title might be lost on macOS after coming back from fullscreen.
|
||||||
u.window.SetTitle(u.title)
|
u.window.SetTitle(u.title)
|
||||||
|
Loading…
Reference in New Issue
Block a user