mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
ui: Bug fix: Set the proper window position when coming back from fullscreen
This commit is contained in:
parent
7c35ce4bbb
commit
ca2fe22e4a
@ -713,12 +713,10 @@ func (u *userInterface) forceSetScreenSize(width, height int, scale float64, ful
|
|||||||
v := m.GetVideoMode()
|
v := m.GetVideoMode()
|
||||||
u.window.SetMonitor(m, 0, 0, v.Width, v.Height, v.RefreshRate)
|
u.window.SetMonitor(m, 0, 0, v.Width, v.Height, v.RefreshRate)
|
||||||
} else {
|
} else {
|
||||||
if u.origPosX >= 0 && u.origPosY >= 0 {
|
if u.window.GetMonitor() != nil {
|
||||||
x := u.origPosX
|
// Give dummy values as the window position and size.
|
||||||
y := u.origPosY
|
// The new window position should be specifying after SetSize.
|
||||||
u.window.SetMonitor(nil, x, y, 16, 16, 0)
|
u.window.SetMonitor(nil, 0, 0, 16, 16, 0)
|
||||||
u.origPosX = -1
|
|
||||||
u.origPosY = -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
oldW, oldH := u.window.GetSize()
|
oldW, oldH := u.window.GetSize()
|
||||||
@ -740,6 +738,15 @@ func (u *userInterface) forceSetScreenSize(width, height int, scale float64, ful
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if u.origPosX >= 0 && u.origPosY >= 0 {
|
||||||
|
x := u.origPosX
|
||||||
|
y := u.origPosY
|
||||||
|
u.window.SetPos(x, y)
|
||||||
|
u.origPosX = -1
|
||||||
|
u.origPosY = -1
|
||||||
|
}
|
||||||
|
|
||||||
// Window title might be lost on macOS after coming back from fullscreen.
|
// Window title might be lost on macOS after coming back from fullscreen.
|
||||||
u.window.SetTitle(u.title)
|
u.window.SetTitle(u.title)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user