internal/ui: bug fix: adjust the window position correctly

Updates #1982
This commit is contained in:
Hajime Hoshi 2022-02-07 23:51:40 +09:00
parent ed04021151
commit cb4085277b
4 changed files with 5 additions and 5 deletions

View File

@ -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)

View File

@ -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
}

View File

@ -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
}

View File

@ -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 {