mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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
|
||||
}
|
||||
|
||||
func adjustWindowPosition(x, y int) (int, int) {
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||
return x, y
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ func (u *UserInterface) glfwScale() float64 {
|
||||
return u.deviceScaleFactor()
|
||||
}
|
||||
|
||||
func adjustWindowPosition(x, y int) (int, int) {
|
||||
func (u *UserInterface) adjustWindowPosition(x, y int) (int, int) {
|
||||
return x, y
|
||||
}
|
||||
|
||||
|
@ -103,18 +103,19 @@ func (u *UserInterface) glfwScale() float64 {
|
||||
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,
|
||||
// adjust x/y at least to enable to handle the window (#328)
|
||||
if x < 0 {
|
||||
x = 0
|
||||
if x < mx {
|
||||
x = mx
|
||||
}
|
||||
t, err := getSystemMetrics(smCyCaption)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if y < t {
|
||||
y = t
|
||||
if y < my + t {
|
||||
y = my + t
|
||||
}
|
||||
return x, y
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ func (w *window) SetPosition(x, y int) {
|
||||
mx, my := w.ui.currentMonitor().GetPos()
|
||||
xf := w.ui.toDeviceDependentPixel(float64(x))
|
||||
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() {
|
||||
w.ui.origPosX, w.ui.origPosY = x, y
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user