mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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()
|
mx, my := monitor.GetPos()
|
||||||
xf := u.dipToGLFWPixel(float64(x), monitor)
|
xf := u.dipToGLFWPixel(float64(x), monitor)
|
||||||
yf := u.dipToGLFWPixel(float64(y), 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)
|
u.setOrigPos(x, y)
|
||||||
} else {
|
} else {
|
||||||
u.window.SetPos(x, y)
|
u.window.SetPos(x, y)
|
||||||
|
@ -154,7 +154,7 @@ func (u *UserInterface) dipToGLFWPixel(x float64, monitor *glfw.Monitor) float64
|
|||||||
return x
|
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
|
return x, y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ func (u *UserInterface) dipToGLFWPixel(x float64, monitor *glfw.Monitor) float64
|
|||||||
return x * u.deviceScaleFactor(monitor)
|
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
|
return x, y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ func (u *UserInterface) dipToGLFWPixel(x float64, monitor *glfw.Monitor) float64
|
|||||||
return x * u.deviceScaleFactor(monitor)
|
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) {
|
||||||
mx, my := u.currentMonitor().GetPos()
|
mx, my := monitor.GetPos()
|
||||||
// As the video width/height might be wrong,
|
// As the video width/height might be wrong,
|
||||||
// adjust x/y at least to enable to handle the window (#328)
|
// adjust x/y at least to enable to handle the window (#328)
|
||||||
if x < mx {
|
if x < mx {
|
||||||
|
Loading…
Reference in New Issue
Block a user