Mac鼠标/触控板的编程速度 [英] Mac Mouse/Trackpad Speed Programmatically

查看:230
本文介绍了Mac鼠标/触控板的编程速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更改我正在处理的应用程序的鼠标跟踪速度(注意:不是加速).我到处搜索了一种方法来执行此操作,但是找不到任何东西. 我怀疑这与我在IOKit/hidsystem Framework上的此函数中提供的值有关:

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);

由于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?

预先感谢

推荐答案

迅捷的工作示例:

func getAcceleration() -> Double {
    var speed:Double = 0
    IOHIDGetAccelerationWithKey(NXOpenEventStatus(), kIOHIDTrackpadAccelerationType, &speed)
    return speed
}

func setAcceleration(_ speed: Double) {
    IOHIDSetAccelerationWithKey(NXOpenEventStatus(), kIOHIDTrackpadAccelerationType, speed)
}

来源: http://lists.apple.com/archives/usb/2004/Aug/msg00056.html

这篇关于Mac鼠标/触控板的编程速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆