internal/ui: bug fix: initialize passthrough attrib after window creation

Closes #3222
This commit is contained in:
Hajime Hoshi
2025-09-23 19:18:20 +09:00
parent 7de26d3a30
commit 6752f85c2c

View File

@@ -1136,14 +1136,6 @@ func (u *UserInterface) initOnMainThread(options *RunOptions) error {
return err
}
mousePassthrough := glfw.False
if u.isInitWindowMousePassthrough() {
mousePassthrough = glfw.True
}
if err := glfw.WindowHint(glfw.MousePassthrough, mousePassthrough); err != nil {
return err
}
// Set the window visible explicitly or the application freezes on Wayland (#974).
if os.Getenv("WAYLAND_DISPLAY") != "" {
if err := glfw.WindowHint(glfw.Visible, glfw.True); err != nil {
@@ -1155,6 +1147,16 @@ func (u *UserInterface) initOnMainThread(options *RunOptions) error {
return err
}
// glfw.WindowHint(glfw.MousePassthrough, ...) doesn't work on some Linux machine (#3222).
// Set this attribute after creating a window.
mousePassthrough := glfw.False
if u.isInitWindowMousePassthrough() {
mousePassthrough = glfw.True
}
if err := u.window.SetAttrib(glfw.MousePassthrough, mousePassthrough); err != nil {
return err
}
// Maximizing a window requires a proper size and position. Call Maximize here (#1117).
if u.isInitWindowMaximized() {
if err := u.window.Maximize(); err != nil {