mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/ui: bug fix: adjust the window position correctly
Updates #1982
This commit is contained in:
parent
ed04021151
commit
cb4085277b
@ -1603,7 +1603,7 @@ func (u *UserInterface) setWindowPositionInDIP(x, y int, monitor *glfw.Monitor)
|
||||
mx, my := monitor.GetPos()
|
||||
xf := u.dipToGLFWPixel(float64(x), monitor)
|
||||
yf := u.dipToGLFWPixel(float64(y), monitor)
|
||||
if x, y := u.adjustWindowPosition(mx+int(xf), my+int(yf)); u.isFullscreen() {
|
||||
if x, y := u.adjustWindowPosition(mx+int(xf), my+int(yf), monitor); u.isFullscreen() {
|
||||
u.setOrigPos(x, y)
|
||||
} else {
|
||||
u.window.SetPos(x, y)
|
||||
|
@ -154,7 +154,7 @@ func (u *UserInterface) dipToGLFWPixel(x float64, monitor *glfw.Monitor) float64
|
||||
return x
|
||||
}
|
||||
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int, monitor *glfw.Monitor) (int, int) {
|
||||
return x, y
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ func (u *UserInterface) dipToGLFWPixel(x float64, monitor *glfw.Monitor) float64
|
||||
return x * u.deviceScaleFactor(monitor)
|
||||
}
|
||||
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int, monitor *glfw.Monitor) (int, int) {
|
||||
return x, y
|
||||
}
|
||||
|
||||
|
@ -115,8 +115,8 @@ func (u *UserInterface) dipToGLFWPixel(x float64, monitor *glfw.Monitor) float64
|
||||
return x * u.deviceScaleFactor(monitor)
|
||||
}
|
||||
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||
mx, my := u.currentMonitor().GetPos()
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int, monitor *glfw.Monitor) (int, int) {
|
||||
mx, my := monitor.GetPos()
|
||||
// As the video width/height might be wrong,
|
||||
// adjust x/y at least to enable to handle the window (#328)
|
||||
if x < mx {
|
||||
|
Loading…
Reference in New Issue
Block a user