From ff686660cbadb901b9508df16a07e9e0fa92021f Mon Sep 17 00:00:00 2001 From: Ben Perry Date: Fri, 23 Aug 2024 01:58:47 -0500 Subject: [PATCH] Set cursor on entered instead of every update --- backends/opengl/input.go | 3 +++ backends/opengl/window.go | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/backends/opengl/input.go b/backends/opengl/input.go index 06b425d..dffd95d 100644 --- a/backends/opengl/input.go +++ b/backends/opengl/input.go @@ -262,6 +262,9 @@ func (w *Window) initInput() { }) w.window.SetCursorEnterCallback(func(_ *glfw.Window, entered bool) { + if entered && w.cursor != nil { + w.window.SetCursor(w.cursor) + } w.input.MouseEnteredEvent(entered) if w.mouseEnteredCallback != nil { w.mouseEnteredCallback(w, entered) diff --git a/backends/opengl/window.go b/backends/opengl/window.go index 1e023fa..efa0108 100644 --- a/backends/opengl/window.go +++ b/backends/opengl/window.go @@ -230,7 +230,6 @@ func (w *Window) Destroy() { // Update swaps buffers and polls events. Call this method at the end of each frame. func (w *Window) Update() { - w.SetCursor(w.cursor) w.SwapBuffers() w.UpdateInput() }