mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
uidriver/glfw: Bug fix: Set the correct window size when going back from fullscreen
This commit is contained in:
parent
3fc328db8d
commit
ee52c88e98
@ -966,12 +966,23 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
|
||||
u.swapBuffers()
|
||||
}
|
||||
} else {
|
||||
// On Windows, giving a too small width doesn't call a callback (#165).
|
||||
// To prevent hanging up, return asap if the width is too small.
|
||||
// 126 is an arbitrary number and I guess this is small enough.
|
||||
minWindowWidth := int(u.toGLFWPixel(126))
|
||||
if u.window.GetAttrib(glfw.Decorated) == glfw.False {
|
||||
minWindowWidth = 1
|
||||
}
|
||||
if width < minWindowWidth {
|
||||
width = minWindowWidth
|
||||
}
|
||||
|
||||
if u.window.GetMonitor() != nil {
|
||||
if u.Graphics().IsGL() {
|
||||
// When OpenGL is used, swapping buffer is enough to solve the image-lag
|
||||
// issue (#1004). Rather, recreating window destroys GPU resources.
|
||||
// TODO: This might not work when vsync is disabled.
|
||||
u.window.SetMonitor(nil, 0, 0, 16, 16, 0)
|
||||
u.window.SetMonitor(nil, 0, 0, width, height, 0)
|
||||
glfw.PollEvents()
|
||||
u.swapBuffers()
|
||||
} else {
|
||||
@ -990,17 +1001,6 @@ func (u *UserInterface) setWindowSize(width, height int, fullscreen bool) {
|
||||
}
|
||||
}
|
||||
|
||||
// On Windows, giving a too small width doesn't call a callback (#165).
|
||||
// To prevent hanging up, return asap if the width is too small.
|
||||
// 126 is an arbitrary number and I guess this is small enough.
|
||||
minWindowWidth := int(u.toGLFWPixel(126))
|
||||
if u.window.GetAttrib(glfw.Decorated) == glfw.False {
|
||||
minWindowWidth = 1
|
||||
}
|
||||
if width < minWindowWidth {
|
||||
width = minWindowWidth
|
||||
}
|
||||
|
||||
if u.origPosX != invalidPos && u.origPosY != invalidPos {
|
||||
x := u.origPosX
|
||||
y := u.origPosY
|
||||
|
Loading…
Reference in New Issue
Block a user