2011年 09月 26日

OSX のマウスの加速度がムカつく

// #!gcc -framework Cocoa -framework IOKit mouse.c
// code from http://lists.apple.com/archives/usb/2004/aug/msg00057.html

#include <stdio.h>
#include <IOKit/IOKitLib.h>
#include <IOKit/hidsystem/IOHIDLib.h>
#include <IOKit/hidsystem/IOHIDParameter.h>
#include <IOKit/hidsystem/event_status_driver.h>

int main () {
	NXEventHandle h = NXOpenEventStatus();
	if (!h) return 1;
	IOHIDSetAccelerationWithKey( h, CFSTR(kIOHIDMouseAccelerationType), -1.0);
	return 0;
}

を実行すれば一応加速はきれる。けど速度が固定になってしまう (遅い…)

defaults write .GlobalPreferences com.apple.mouse.scaling -1

ってやればいいだけかもしれないけど、こっちは再起動がいる。(上のコードだと即時で反映される)