mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: prevent mouseEntered/Exited processing if already in that state
See the comment in the code. Fixes #494
This commit is contained in:
@ -491,6 +491,12 @@ extension Ghostty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func mouseEntered(with event: NSEvent) {
|
override func mouseEntered(with event: NSEvent) {
|
||||||
|
// For reasons unknown (Cocoaaaaaaaaa), mouseEntered is called
|
||||||
|
// multiple times in an unbalanced way with mouseExited when a new
|
||||||
|
// tab is created. In this scenario, we only want to process our
|
||||||
|
// callback once since this is stateful and we expect balancing.
|
||||||
|
if (mouseEntered) { return }
|
||||||
|
|
||||||
mouseEntered = true
|
mouseEntered = true
|
||||||
|
|
||||||
// If our cursor is hidden, we hide it on upon entry and we unhide
|
// If our cursor is hidden, we hide it on upon entry and we unhide
|
||||||
@ -501,6 +507,9 @@ extension Ghostty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func mouseExited(with event: NSEvent) {
|
override func mouseExited(with event: NSEvent) {
|
||||||
|
// See mouseEntered
|
||||||
|
if (!mouseEntered) { return }
|
||||||
|
|
||||||
mouseEntered = false
|
mouseEntered = false
|
||||||
|
|
||||||
if (cursorVisible == .hidden) {
|
if (cursorVisible == .hidden) {
|
||||||
|
Reference in New Issue
Block a user