diff options
Diffstat (limited to 'AppKit/GTMNSAnimation+Duration.m')
-rw-r--r-- | AppKit/GTMNSAnimation+Duration.m | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/AppKit/GTMNSAnimation+Duration.m b/AppKit/GTMNSAnimation+Duration.m index 5155c38..18ebf80 100644 --- a/AppKit/GTMNSAnimation+Duration.m +++ b/AppKit/GTMNSAnimation+Duration.m @@ -23,21 +23,22 @@ const NSUInteger kGTMLeftMouseDownAndKeyDownMask NSTimeInterval GTMModifyDurationBasedOnCurrentState(NSTimeInterval duration, NSUInteger eventMask) { - NSEvent *event = [NSApp currentEvent]; - if (eventMask & NSEventMaskFromType([event type])) { - NSUInteger modifiers = [event modifierFlags]; + NSEvent *currentEvent = [NSApp currentEvent]; + NSUInteger currentEventMask = NSEventMaskFromType([currentEvent type]); + if (eventMask & currentEventMask) { + NSUInteger modifiers = [currentEvent modifierFlags]; if (!(modifiers & (NSAlternateKeyMask | NSCommandKeyMask))) { if (modifiers & NSShiftKeyMask) { // 25 is the ascii code generated for a shift-tab (End-of-message) - // The shift modifier is ignored if it is applied to a Tab key down. + // The shift modifier is ignored if it is applied to a Tab key down/up. // Tab and shift-tab are often used for navigating around UI elements, // and in the majority of cases slowing down the animations while // navigating around UI elements is not desired. - if ((eventMask & NSKeyDownMask) + if ((currentEventMask & (NSKeyDownMask | NSKeyUpMask)) && !(modifiers & NSControlKeyMask) - && ([[event characters] length] == 1) - && ([[event characters] characterAtIndex:0] == 25)) { + && ([[currentEvent characters] length] == 1) + && ([[currentEvent characters] characterAtIndex:0] == 25)) { duration = duration; } else { duration *= 5.0; |