uidriver/glfw: Bug fix: Initializing order mattered

Especially on Linux, the window size and the window position must
be initialized in this order.

Fixes #1118
This commit is contained in:
Hajime Hoshi 2020-03-28 23:36:48 +09:00
parent 34acf788d2
commit e628350d4e

View File

@ -679,11 +679,13 @@ func (u *UserInterface) run(context driver.UIContext) error {
return err return err
} }
u.iwindow.SetPosition(u.getInitWindowPosition()) // Set the window size and the window position in this order.
// This is necessary especially on Linux (#1118).
ww, wh := u.getInitWindowSize() ww, wh := u.getInitWindowSize()
ww = int(u.toDeviceDependentPixel(float64(ww))) ww = int(u.toDeviceDependentPixel(float64(ww)))
wh = int(u.toDeviceDependentPixel(float64(wh))) wh = int(u.toDeviceDependentPixel(float64(wh)))
u.setWindowSize(ww, wh, u.isFullscreen(), u.vsync) u.setWindowSize(ww, wh, u.isFullscreen(), u.vsync)
u.iwindow.SetPosition(u.getInitWindowPosition())
// 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() {