From 34acf788d25a694ecd4fc3a0fb0af235a4fc5fb0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 28 Mar 2020 22:33:58 +0900 Subject: [PATCH] uidriver/glfw: Bug fix: Call Maximize explictly instead of the hint Fixes #1117 --- internal/uidriver/glfw/ui.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index aa814c13d..ca332d17f 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -662,12 +662,6 @@ func (u *UserInterface) run(context driver.UIContext) error { } glfw.WindowHint(glfw.Floating, floating) - maximized := glfw.False - if u.isInitWindowMaximized() { - maximized = glfw.True - } - glfw.WindowHint(glfw.Maximized, maximized) - // Set the window visible explicitly or the application freezes on Wayland (#974). if os.Getenv("WAYLAND_DISPLAY") != "" { glfw.WindowHint(glfw.Visible, glfw.True) @@ -691,6 +685,14 @@ func (u *UserInterface) run(context driver.UIContext) error { wh = int(u.toDeviceDependentPixel(float64(wh))) u.setWindowSize(ww, wh, u.isFullscreen(), u.vsync) + // Maximizing a window requires a proper size and position. Call Maximize here (#1117). + if u.isInitWindowMaximized() { + _ = u.t.Call(func() error { + u.window.Maximize() + return nil + }) + } + _ = u.t.Call(func() error { u.title = u.getInitTitle() u.window.SetTitle(u.title)