From d6f7b50387d2488c84ee43c3e8c181b78a2f419e Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 6 Apr 2024 22:25:53 +0900 Subject: [PATCH] internal/ui: bug fix: setting a size failed for an invisible window Updates #2725 Closes #2951 --- internal/ui/ui_glfw.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index 74289026e..c23f1181f 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -1027,9 +1027,13 @@ func (u *UserInterface) initOnMainThread(options *RunOptions) error { return err } - // Window is shown after the first buffer swap. - if err := glfw.WindowHint(glfw.Visible, glfw.False); err != nil { - return err + // Window is shown after the first buffer swap (#2725). + // On Linux or UNIX, there is a problematic desktop environment like i3wm + // where an invisible window size cannot be initialized correctly (#2951). + if runtime.GOOS == "darwin" || runtime.GOOS == "windows" { + if err := glfw.WindowHint(glfw.Visible, glfw.False); err != nil { + return err + } } if err := glfw.WindowHintString(glfw.X11ClassName, options.X11ClassName); err != nil {