mirror of https://github.com/liamg/aminal.git
Bug: mouse cursors leaks (#136)
This commit is contained in:
parent
84c0069785
commit
89eea0921d
|
@ -36,6 +36,8 @@ type GUI struct {
|
|||
showDebugInfo bool
|
||||
keyboardShortcuts map[config.UserAction]*config.KeyCombination
|
||||
resizeLock *sync.Mutex
|
||||
handCursor *glfw.Cursor
|
||||
arrowCursor *glfw.Cursor
|
||||
}
|
||||
|
||||
func Min(x, y int) int {
|
||||
|
|
20
gui/mouse.go
20
gui/mouse.go
|
@ -17,6 +17,22 @@ func (gui *GUI) glfwScrollCallback(w *glfw.Window, xoff float64, yoff float64) {
|
|||
}
|
||||
}
|
||||
|
||||
func (gui *GUI) getHandCursor() *glfw.Cursor {
|
||||
if gui.handCursor == nil {
|
||||
gui.handCursor = glfw.CreateStandardCursor(glfw.HandCursor)
|
||||
}
|
||||
|
||||
return gui.handCursor
|
||||
}
|
||||
|
||||
func (gui *GUI) getArrowCursor() *glfw.Cursor {
|
||||
if gui.arrowCursor == nil {
|
||||
gui.arrowCursor = glfw.CreateStandardCursor(glfw.ArrowCursor)
|
||||
}
|
||||
|
||||
return gui.arrowCursor
|
||||
}
|
||||
|
||||
func (gui *GUI) mouseMoveCallback(w *glfw.Window, px float64, py float64) {
|
||||
|
||||
scale := gui.scale()
|
||||
|
@ -40,9 +56,9 @@ func (gui *GUI) mouseMoveCallback(w *glfw.Window, px float64, py float64) {
|
|||
}
|
||||
|
||||
if url := gui.terminal.ActiveBuffer().GetURLAtPosition(x, y); url != "" {
|
||||
w.SetCursor(glfw.CreateStandardCursor(glfw.HandCursor))
|
||||
w.SetCursor(gui.getHandCursor())
|
||||
} else {
|
||||
w.SetCursor(glfw.CreateStandardCursor(glfw.ArrowCursor))
|
||||
w.SetCursor(gui.getArrowCursor())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue