mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
uidriver/glfw: Bug fix: Initilizing the window position and the size in this order on Windows
It looks like the order is different on Windows from Linux. We are not sure why. Updates #1118
This commit is contained in:
parent
b7ab3d2df4
commit
9d5c35f029
@ -681,13 +681,25 @@ func (u *UserInterface) run(context driver.UIContext) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the window size and the window position in this order.
|
setPosition := func() {
|
||||||
// This is necessary especially on Linux (#1118).
|
u.iwindow.SetPosition(u.getInitWindowPosition())
|
||||||
ww, wh := u.getInitWindowSize()
|
}
|
||||||
ww = int(u.toDeviceDependentPixel(float64(ww)))
|
setSize := func() {
|
||||||
wh = int(u.toDeviceDependentPixel(float64(wh)))
|
ww, wh := u.getInitWindowSize()
|
||||||
u.setWindowSize(ww, wh, u.isFullscreen(), u.vsync)
|
ww = int(u.toDeviceDependentPixel(float64(ww)))
|
||||||
u.iwindow.SetPosition(u.getInitWindowPosition())
|
wh = int(u.toDeviceDependentPixel(float64(wh)))
|
||||||
|
u.setWindowSize(ww, wh, u.isFullscreen(), u.vsync)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the window size and the window position in this order on Linux (X) (#1118),
|
||||||
|
// but this is inverted on Windows. This is very tricky, but there is no obvious way to solve this.
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
setPosition()
|
||||||
|
setSize()
|
||||||
|
} else {
|
||||||
|
setSize()
|
||||||
|
setPosition()
|
||||||
|
}
|
||||||
|
|
||||||
// Maximizing a window requires a proper size and position. Call Maximize here (#1117).
|
// Maximizing a window requires a proper size and position. Call Maximize here (#1117).
|
||||||
if u.isInitWindowMaximized() {
|
if u.isInitWindowMaximized() {
|
||||||
|
Loading…
Reference in New Issue
Block a user