internal/ui: refactoring

This commit is contained in:
Hajime Hoshi 2022-08-10 21:34:39 +09:00
parent b5196a5a7c
commit 4104abdf77

View File

@ -1470,6 +1470,7 @@ func (u *userInterfaceImpl) Window() Window {
// maximizeWindow must be called from the main thread.
func (u *userInterfaceImpl) maximizeWindow() {
// TODO: Can we remove this condition?
if u.isNativeFullscreen() {
return
}
@ -1482,7 +1483,10 @@ func (u *userInterfaceImpl) maximizeWindow() {
}
u.window.Maximize()
if !u.isFullscreen() {
if u.isFullscreen() {
return
}
// On Linux/UNIX, maximizing might not finish even though Maximize returns. Just wait for its finish.
// Do not check this in the fullscreen since apparently the condition can never be true.
for u.window.GetAttrib(glfw.Maximized) != glfw.True {
@ -1497,10 +1501,10 @@ func (u *userInterfaceImpl) maximizeWindow() {
wh := int(u.dipFromGLFWPixel(float64(h), u.currentMonitor()))
u.setWindowSizeInDIP(ww, wh, u.isFullscreen())
}
}
// iconifyWindow must be called from the main thread.
func (u *userInterfaceImpl) iconifyWindow() {
// Iconifying a native fullscreen window on macOS is forbidden.
if u.isNativeFullscreen() {
return
}