internal/ui: remove an unnecessary hack for macOS

Now macOS always uses the native fullscreen even for a transparent
window, we no longer need a hack to call SwapBuffers explicitly.

Updates #1004
This commit is contained in:
Hajime Hoshi 2022-12-30 16:25:01 +09:00
parent 0a03df297b
commit b9fb4e9f50

View File

@ -1199,13 +1199,6 @@ func (u *userInterfaceImpl) setFullscreen(fullscreen bool) {
v := m.GetVideoMode() v := m.GetVideoMode()
u.window.SetMonitor(m, 0, 0, v.Width, v.Height, v.RefreshRate) u.window.SetMonitor(m, 0, 0, v.Width, v.Height, v.RefreshRate)
// Swapping buffer is necessary to prevent the image lag (#1004).
// TODO: This might not work when vsync is disabled.
if u.graphicsDriver.IsGL() {
glfw.PollEvents()
u.swapBuffers()
}
} }
u.adjustViewSizeAfterFullscreen() u.adjustViewSizeAfterFullscreen()
return return
@ -1224,10 +1217,6 @@ func (u *userInterfaceImpl) setFullscreen(fullscreen bool) {
// Adjust the window size later (after adjusting the position). // Adjust the window size later (after adjusting the position).
} else if !u.isNativeFullscreenAvailable() && u.window.GetMonitor() != nil { } else if !u.isNativeFullscreenAvailable() && u.window.GetMonitor() != nil {
u.window.SetMonitor(nil, 0, 0, ww, wh, 0) u.window.SetMonitor(nil, 0, 0, ww, wh, 0)
if u.graphicsDriver.IsGL() {
glfw.PollEvents()
u.swapBuffers()
}
} }
// glfw.PollEvents is necessary for macOS to enable (*glfw.Window).SetPos and SetSize (#2296). // glfw.PollEvents is necessary for macOS to enable (*glfw.Window).SetPos and SetSize (#2296).