Magic Mouse Developer Release Notes

Opting Out of Momentum Scroll Events

After the user physically stops scrolling a view, the device can synthesize and generate momentum scroll events to simulate the scrolling motion slowly coming to a stop. These events are dispatched via the usual delivery mechanism to the view that is under the mouse pointer when the user last scrolled.

Some applications do not work well with momentum scroll events because of the quantity and magnitude of these events. These applications can opt out of this feature by turning off the AppleMomentumScrollSupported default in the user defaults system. The application should disable this feature immediately after it launches.

In a Cocoa application, for example, you could add the following code to an initialize class method in the class that handles scroll events:

+ (void)initialize {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO"
       forKey:@"AppleMomentumScrollSupported"];
    [defaults registerDefaults:appDefaults];
}

Carbon applications can include the same user-defaults code but should put it in early initialization routines such as the main function, as in this example:

#import <Foundation/Foundation.h>
 
int main(int argc, char *argv[])
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO"
       forKey:@"AppleMomentumScrollSupported"];
    [defaults registerDefaults:appDefaults];
 
    // other code goes here
}