I'm trying to change the mouse tracking speed (Notice: Not acceleration) for an application I'm working on. I've searched everywhere for a way to do this, but couldn't find anything. I suspect that has to do with the value I give in this function on the IOKit/hidsystem Framework:
IOHIDSetAccelerationWithKey(handle, CFSTR(kIOHIDMouseAccelerationType), mouseAcceleration);
Being mouseAcceleration the value, I suspect there is a hex value that defines both acceleration and speed.
Does anyone came across this problem and could help me?
Thanks in advance
Working example in swift:
func getAcceleration() -> Double {
var speed:Double = 0
IOHIDGetAccelerationWithKey(NXOpenEventStatus(), kIOHIDTrackpadAccelerationType, &speed)
return speed
}
func setAcceleration(_ speed: Double) {
IOHIDSetAccelerationWithKey(NXOpenEventStatus(), kIOHIDTrackpadAccelerationType, speed)
}
Source: http://lists.apple.com/archives/usb/2004/Aug/msg00056.html
You can try to make NSTrackingArea and change mouse position after you get new mouse position.
来源:https://stackoverflow.com/questions/10448843/mac-mouse-trackpad-speed-programmatically