internal/uidriver/glfw: Bug fix: A window can never be 'maximized' on fullscreen

When the window is fullscreen, calling MaximizeWindow never returned.
Apparently the attribute glfw.Maximized can never be true on the
fullscreen mode.

This change fixes the issue by checking the fullscreen state.
This commit is contained in:
Hajime Hoshi 2021-04-21 22:25:10 +09:00
parent d24313e236
commit 1013ca9c66

View File

@ -1364,7 +1364,9 @@ func (u *UserInterface) maximizeWindow() {
} }
u.window.Maximize() u.window.Maximize()
if !u.isFullscreen() {
// On Linux/UNIX, maximizing might not finish even though Maximize returns. Just wait for its finish. // On Linux/UNIX, maximizing might not finish even though Maximize returns. Just wait for its finish.
// Do not check this on the fullscreen since apparently the condition never be true.
for u.window.GetAttrib(glfw.Maximized) != glfw.True { for u.window.GetAttrib(glfw.Maximized) != glfw.True {
glfw.PollEvents() glfw.PollEvents()
} }
@ -1372,7 +1374,6 @@ func (u *UserInterface) maximizeWindow() {
// Call setWindowSize explicitly in order to update the rendering since the callback is disabled now. // Call setWindowSize explicitly in order to update the rendering since the callback is disabled now.
// Do not call setWindowSize on the fullscreen mode since setWindowSize requires the window size // Do not call setWindowSize on the fullscreen mode since setWindowSize requires the window size
// before the fullscreen, while window.GetSize() returns the desktop screen size on the fullscreen mode. // before the fullscreen, while window.GetSize() returns the desktop screen size on the fullscreen mode.
if !u.isFullscreen() {
w, h := u.window.GetSize() w, h := u.window.GetSize()
u.setWindowSize(w, h, u.isFullscreen()) u.setWindowSize(w, h, u.isFullscreen())
} }