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. // maximizeWindow must be called from the main thread.
func (u *userInterfaceImpl) maximizeWindow() { func (u *userInterfaceImpl) maximizeWindow() {
// TODO: Can we remove this condition?
if u.isNativeFullscreen() { if u.isNativeFullscreen() {
return return
} }
@ -1482,7 +1483,10 @@ func (u *userInterfaceImpl) maximizeWindow() {
} }
u.window.Maximize() 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. // 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. // Do not check this in the fullscreen since apparently the condition can never be true.
for u.window.GetAttrib(glfw.Maximized) != glfw.True { for u.window.GetAttrib(glfw.Maximized) != glfw.True {
@ -1496,11 +1500,11 @@ func (u *userInterfaceImpl) maximizeWindow() {
ww := int(u.dipFromGLFWPixel(float64(w), u.currentMonitor())) ww := int(u.dipFromGLFWPixel(float64(w), u.currentMonitor()))
wh := int(u.dipFromGLFWPixel(float64(h), u.currentMonitor())) wh := int(u.dipFromGLFWPixel(float64(h), u.currentMonitor()))
u.setWindowSizeInDIP(ww, wh, u.isFullscreen()) u.setWindowSizeInDIP(ww, wh, u.isFullscreen())
}
} }
// iconifyWindow must be called from the main thread. // iconifyWindow must be called from the main thread.
func (u *userInterfaceImpl) iconifyWindow() { func (u *userInterfaceImpl) iconifyWindow() {
// Iconifying a native fullscreen window on macOS is forbidden.
if u.isNativeFullscreen() { if u.isNativeFullscreen() {
return return
} }