internal/ui: bug fix: call setOrigWindowPos on entering fullscreen

Closes #2757
This commit is contained in:
Hajime Hoshi 2023-09-15 02:53:35 +09:00
parent f7a801d591
commit 568e98ef1c
2 changed files with 8 additions and 0 deletions

View File

@ -1461,6 +1461,13 @@ func (u *userInterfaceImpl) setWindowSizeInDIP(width, height int, callSetSize bo
u.updateWindowSizeLimits()
}
// setOrigWindowPosWithCurrentPos must be called from the main thread.
func (u *userInterfaceImpl) setOrigWindowPosWithCurrentPos() {
if x, y := u.origWindowPos(); x == invalidPos || y == invalidPos {
u.setOrigWindowPos(u.window.GetPos())
}
}
// setFullscreen must be called from the main thread.
func (u *userInterfaceImpl) setFullscreen(fullscreen bool) {
if u.isFullscreen() == fullscreen {

View File

@ -123,6 +123,7 @@ func init() {
Cmd: sel_windowWillEnterFullScreen,
Fn: func(id objc.ID, cmd objc.SEL, notification objc.ID) {
theUI.disableWindowSizeLimits()
theUI.setOrigWindowPosWithCurrentPos()
pushResizableState(id, cocoa.NSNotification{ID: notification}.Object())
},
},