From eac00c3d8325ff7075addf2b3f101d02bca6f3ac Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 18 Dec 2018 03:07:13 +0900 Subject: [PATCH] ui: Bug fix: SetCursorVisible before Run didn't work Fixes #754 --- internal/ui/ui_glfw.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/ui/ui_glfw.go b/internal/ui/ui_glfw.go index e62ab93d4..e45f3de67 100644 --- a/internal/ui/ui_glfw.go +++ b/internal/ui/ui_glfw.go @@ -107,14 +107,9 @@ func initialize() error { currentUI.window.MakeContextCurrent() - mode := glfw.CursorNormal - if !currentUI.isInitCursorVisible() { - mode = glfw.CursorHidden - } if i := currentUI.getInitIconImages(); i != nil { currentUI.window.SetIcon(i) } - currentUI.window.SetInputMode(glfw.CursorMode, mode) currentUI.window.SetInputMode(glfw.StickyMouseButtonsMode, glfw.True) currentUI.window.SetInputMode(glfw.StickyKeysMode, glfw.True) @@ -535,6 +530,13 @@ func DeviceScaleFactor() float64 { func Run(width, height int, scale float64, title string, g GraphicsContext, mainloop bool) error { u := currentUI _ = mainthread.Run(func() error { + // Solve the initial properties of the window. + mode := glfw.CursorNormal + if !currentUI.isInitCursorVisible() { + mode = glfw.CursorHidden + } + u.window.SetInputMode(glfw.CursorMode, mode) + // Get the monitor before showing the window. // // On Windows, there are two types of windows: