Created
September 28, 2011 18:43
-
-
Save twslankard/1248841 to your computer and use it in GitHub Desktop.
disable mouse acceleration on mac os x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* to build: gcc -o mousekiller mousekiller.c -framework CoreFoundation -framework IOKit | |
*/ | |
#include <stdio.h> | |
#include <IOKit/hidsystem/IOHIDLib.h> | |
#include <IOKit/hidsystem/IOHIDParameter.h> | |
int main(int argc, char **argv) | |
{ | |
const int32_t accel = -0x10000; // if this ever becomes a scale factor, we set it to one | |
if(argc < 2) { | |
fprintf(stderr, "Give me mouse and/or trackpad as arguments\n"); | |
return 1; | |
} | |
io_connect_t handle = NXOpenEventStatus(); | |
if(handle) { | |
int i; | |
for(i=1; i<argc; i++) { | |
CFStringRef type = 0; | |
if(strcmp(argv[i], "mouse") == 0) | |
type = CFSTR(kIOHIDMouseAccelerationType); | |
else if(strcmp(argv[i], "trackpad") == 0) | |
type = CFSTR(kIOHIDTrackpadAccelerationType); | |
if(type && IOHIDSetParameter(handle, type, &accel, sizeof accel) != KERN_SUCCESS) | |
fprintf(stderr, "Failed to kill %s accel\n", argv[i]); | |
} | |
NXCloseEventStatus(handle); | |
} else | |
fprintf(stderr, "No handle\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit to these guys:
http://forums.macrumors.com/showthread.php?t=361844