Permalink
Browse files

Fix for exception raised when scrolling with wheel mouse that lacks p…

…recise scroll
  • Loading branch information...
1 parent ebb1f58 commit 629c03ff8bbc40e2d00c6bc5cb440c297b597288 @ridiculousfish committed Dec 22, 2011
Showing with 12 additions and 7 deletions.
  1. +12 −7 framework/sources/HFController.m
@@ -1127,20 +1127,25 @@ - (void)scrollWithScrollEvent:(NSEvent *)scrollEvent {
BOOL hasPreciseScroll;
/* Prefer precise deltas */
- if ([scrollEvent respondsToSelector:@selector(hasPreciseScrollingDeltas)] && [scrollEvent hasPreciseScrollingDeltas]) {
- /* In this case, we're going to scroll by a certain number of points */
- preciseScroll = [scrollEvent scrollingDeltaY];
- hasPreciseScroll = YES;
+ if ([scrollEvent respondsToSelector:@selector(hasPreciseScrollingDeltas)]) {
+ hasPreciseScroll = [scrollEvent hasPreciseScrollingDeltas];
+ if (hasPreciseScroll) {
+ /* In this case, we're going to scroll by a certain number of points */
+ preciseScroll = [scrollEvent scrollingDeltaY];
+ }
} else if ([scrollEvent respondsToSelector:@selector(deviceDeltaY)]) {
- preciseScroll = [scrollEvent deviceDeltaY];
- hasPreciseScroll = YES;
+ /* Legacy (SnowLeopard) support */
+ hasPreciseScroll = ([scrollEvent subtype] == 1);
+ if (hasPreciseScroll) {
+ preciseScroll = [scrollEvent deviceDeltaY];
+ }
} else {
hasPreciseScroll = NO;
}
long double scrollY = 0;
if (! hasPreciseScroll) {
- scrollY = -kScrollMultiplier * [scrollEvent scrollingDeltaY];
+ scrollY = -kScrollMultiplier * [scrollEvent deltaY];
} else {
scrollY = -preciseScroll / [self lineHeight];
}

0 comments on commit 629c03f

Please sign in to comment.