mac/input: optimise mouse movement enabled check

This commit is contained in:
der richter 2024-03-14 00:36:05 +01:00
parent 53722a4082
commit 9a4c673dd7
2 changed files with 5 additions and 8 deletions

View File

@ -139,10 +139,11 @@ class InputHelper: NSObject {
} }
} }
func setMouse(position pos: NSPoint) { func setMouse(position: NSPoint) {
if !mouseEnabled() { return }
lock.withLock { lock.withLock {
guard let input = input else { return } guard let input = input else { return }
mp_input_set_mouse_pos(input, Int32(pos.x), Int32(pos.y)) mp_input_set_mouse_pos(input, Int32(position.x), Int32(position.y))
} }
} }

View File

@ -132,16 +132,12 @@ class View: NSView, CALayerDelegate {
} }
override func mouseMoved(with event: NSEvent) { override func mouseMoved(with event: NSEvent) {
if input?.mouseEnabled() ?? true { signalMouseMovement(event)
signalMouseMovement(event)
}
common.titleBar?.show() common.titleBar?.show()
} }
override func mouseDragged(with event: NSEvent) { override func mouseDragged(with event: NSEvent) {
if input?.mouseEnabled() ?? true { signalMouseMovement(event)
signalMouseMovement(event)
}
} }
override func mouseDown(with event: NSEvent) { override func mouseDown(with event: NSEvent) {