Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Can mouse tracking speed be changed programmatically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can mouse tracking speed be changed programmatically?



At 7:31 PM +0200 8/25/04, David Niemeijer wrote:
Is there a way to change the system-wide mouse tracking speed programmatically for the standard mouse driver using either cocoa, carbon or HID? The mouse system Preferences provide too little control in this case.

thanks,


try the following

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

int
main()
{
    kern_return_t kr;
    double trackpadAcceleration, mouseAcceleration;
	NXEventHandle h = 0;

	h = NXOpenEventStatus();
	if (h == nil)
		return -1;

// Get the current "Tracking Speed". kr = IOHIDGetAccelerationWithKey( h, CFSTR(kIOHIDTrackpadAccelerationType), &trackpadAcceleration);
kr = IOHIDGetAccelerationWithKey( h, CFSTR(kIOHIDMouseAccelerationType), &mouseAcceleration);



// Set the "Tracking Speed" to 1.0. Possible values are 0.0, 0.125, 0.3125, 0.5, 0.6875, 0.875, 1.0, 1.7.
IOHIDSetAccelerationWithKey( h, CFSTR(kIOHIDTrackpadAccelerationType), 0.0);
// Set the "Tracking Speed" to 1.0. Possible values are 0.0, 0.125, 0.3125, 0.5, 0.6875, 0.875, 1.0, 1.7.
IOHIDSetAccelerationWithKey( h, CFSTR(kIOHIDMouseAccelerationType), 0.0);


	sleep(5); // wave the mouse/trackpad around

	// restore the acceleration

IOHIDSetAccelerationWithKey( h, CFSTR(kIOHIDTrackpadAccelerationType), trackpadAcceleration);
IOHIDSetAccelerationWithKey( h, CFSTR(kIOHIDMouseAccelerationType), mouseAcceleration);


return (0); }

--
Sincerely,
Rich Kubota
email@hidden
(408) 974-6212
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.


References: 
 >Can mouse tracking speed be changed programmatically? (From: David Niemeijer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.