ui: Bug fix: SetCursorVisible before Run didn't work

Fixes #754
This commit is contained in:
Hajime Hoshi 2018-12-18 03:07:13 +09:00
parent 9142a077cf
commit eac00c3d83

View File

@ -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: