Address review comments

This commit is contained in:
Ousmane Traore 2017-04-30 12:33:27 -04:00
parent 2fa80f7d42
commit b6620c9775
1 changed files with 4 additions and 5 deletions

View File

@ -292,20 +292,19 @@ func (w *Window) VSync() bool {
return w.vsync return w.vsync
} }
// SetCursorVisible sets the visibility of the mouse cursor inside the window client area // SetCursorVisible sets the visibility of the mouse cursor inside the Window client area.
func (w *Window) SetCursorVisible(visible bool) { func (w *Window) SetCursorVisible(visible bool) {
w.cursorVisible = visible w.cursorVisible = visible
mainthread.Call(func() { mainthread.Call(func() {
if visible && w.window.GetInputMode(glfw.CursorMode) != glfw.CursorNormal { if visible {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal) w.window.SetInputMode(glfw.CursorMode, glfw.CursorNormal)
} } else {
if !visible && w.window.GetInputMode(glfw.CursorMode) != glfw.CursorHidden {
w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden) w.window.SetInputMode(glfw.CursorMode, glfw.CursorHidden)
} }
}) })
} }
// CursorVisible returns the visibility status of the mouse cursor // CursorVisible returns the visibility status of the mouse cursor.
func (w *Window) CursorVisible() bool { func (w *Window) CursorVisible() bool {
return w.cursorVisible return w.cursorVisible
} }