ui: Bug fix: (Set)WindowPosition didn't work well with fullscreen mode

This commit is contained in:
Hajime Hoshi 2019-12-01 00:39:04 +09:00
parent 6cd0b44baa
commit b8a099e354
2 changed files with 11 additions and 0 deletions

View File

@ -1026,6 +1026,9 @@ func (u *UserInterface) SetWindowPosition(x, y int) {
return return
} }
_ = u.t.Call(func() error { _ = u.t.Call(func() error {
if u.isFullscreen() {
return nil
}
u.window.SetPos(x, y) u.window.SetPos(x, y)
return nil return nil
}) })
@ -1037,6 +1040,10 @@ func (u *UserInterface) WindowPosition() (int, int) {
} }
x, y := 0, 0 x, y := 0, 0
_ = u.t.Call(func() error { _ = u.t.Call(func() error {
if u.isFullscreen() {
x, y = u.origPosX, u.origPosY
return nil
}
x, y = u.window.GetPos() x, y = u.window.GetPos()
return nil return nil
}) })

View File

@ -99,6 +99,8 @@ func SetWindowIcon(iconImages []image.Image) {
// //
// WindowPosition panics before Run is called. // WindowPosition panics before Run is called.
// //
// WindowPosition returns the last window position on fullscreen mode.
//
// WindowPosition returns (0, 0) on browsers and mobiles. // WindowPosition returns (0, 0) on browsers and mobiles.
// //
// WindowPosition is concurrent-safe. // WindowPosition is concurrent-safe.
@ -110,6 +112,8 @@ func WindowPosition() (x, y int) {
// //
// SetWindowPosition works before and after Run is called. // SetWindowPosition works before and after Run is called.
// //
// SetWindowPosition does nothing on fullscreen mode.
//
// SetWindowPosition does nothing on browsers and mobiles. // SetWindowPosition does nothing on browsers and mobiles.
// //
// SetWindowPosition is concurrent-safe. // SetWindowPosition is concurrent-safe.