mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
uidriver/glfw: Bug fix: adjustWindowPosition should consider the monitor position
This commit is contained in:
parent
0a5126f776
commit
8cca713d74
@ -51,7 +51,7 @@ func (u *UserInterface) glfwScale() float64 {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func adjustWindowPosition(x, y int) (int, int) {
|
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||||
return x, y
|
return x, y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ func (u *UserInterface) glfwScale() float64 {
|
|||||||
return u.deviceScaleFactor()
|
return u.deviceScaleFactor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func adjustWindowPosition(x, y int) (int, int) {
|
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||||
return x, y
|
return x, y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,18 +103,19 @@ func (u *UserInterface) glfwScale() float64 {
|
|||||||
return u.deviceScaleFactor()
|
return u.deviceScaleFactor()
|
||||||
}
|
}
|
||||||
|
|
||||||
func adjustWindowPosition(x, y int) (int, int) {
|
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||||
|
mx, my := u.currentMonitor().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 < 0 {
|
if x < mx {
|
||||||
x = 0
|
x = mx
|
||||||
}
|
}
|
||||||
t, err := getSystemMetrics(smCyCaption)
|
t, err := getSystemMetrics(smCyCaption)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if y < t {
|
if y < my + t {
|
||||||
y = t
|
y = my + t
|
||||||
}
|
}
|
||||||
return x, y
|
return x, y
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ func (w *window) SetPosition(x, y int) {
|
|||||||
mx, my := w.ui.currentMonitor().GetPos()
|
mx, my := w.ui.currentMonitor().GetPos()
|
||||||
xf := w.ui.toDeviceDependentPixel(float64(x))
|
xf := w.ui.toDeviceDependentPixel(float64(x))
|
||||||
yf := w.ui.toDeviceDependentPixel(float64(y))
|
yf := w.ui.toDeviceDependentPixel(float64(y))
|
||||||
x, y := adjustWindowPosition(mx+int(xf), my+int(yf))
|
x, y := w.ui.adjustWindowPosition(mx+int(xf), my+int(yf))
|
||||||
if w.ui.isFullscreen() {
|
if w.ui.isFullscreen() {
|
||||||
w.ui.origPosX, w.ui.origPosY = x, y
|
w.ui.origPosX, w.ui.origPosY = x, y
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user