From 1013ca9c662ac4acc18c3eeea07650c74a502d16 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 21 Apr 2021 22:25:10 +0900 Subject: [PATCH] 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. --- internal/uidriver/glfw/ui.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index 4de78cf42..95ac65fa2 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -1364,15 +1364,16 @@ func (u *UserInterface) maximizeWindow() { } u.window.Maximize() - // On Linux/UNIX, maximizing might not finish even though Maximize returns. Just wait for its finish. - for u.window.GetAttrib(glfw.Maximized) != glfw.True { - glfw.PollEvents() - } - - // 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 - // before the fullscreen, while window.GetSize() returns the desktop screen size on the fullscreen mode. if !u.isFullscreen() { + // 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 { + glfw.PollEvents() + } + + // 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 + // before the fullscreen, while window.GetSize() returns the desktop screen size on the fullscreen mode. w, h := u.window.GetSize() u.setWindowSize(w, h, u.isFullscreen()) }