summaryrefslogtreecommitdiffstats
path: root/video/out/cocoa/view.m
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-10-12 16:03:41 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-10-12 16:26:53 +0200
commit57c3fca7a8f6700b3c35acda290af7133f277c13 (patch)
tree554eb316bf66689a7b54dd82d9cfbd792e8ba433 /video/out/cocoa/view.m
parent42189ada97192e25539bd1bed311a370f25744fe (diff)
downloadmpv-57c3fca7a8f6700b3c35acda290af7133f277c13.tar.bz2
mpv-57c3fca7a8f6700b3c35acda290af7133f277c13.tar.xz
cocoa: refactor precise scrolling to a separate method
Diffstat (limited to 'video/out/cocoa/view.m')
-rw-r--r--video/out/cocoa/view.m11
1 files changed, 7 insertions, 4 deletions
diff --git a/video/out/cocoa/view.m b/video/out/cocoa/view.m
index e2891ffd3d..b5049e28c9 100644
--- a/video/out/cocoa/view.m
+++ b/video/out/cocoa/view.m
@@ -171,7 +171,7 @@
- (void)otherMouseDown:(NSEvent *)evt { [self mouseDownEvent:evt]; }
- (void)otherMouseUp:(NSEvent *)evt { [self mouseUpEvent:evt]; }
-- (void)scrollWheel:(NSEvent *)event
+- (void)preciseScroll:(NSEvent *)event
{
CGFloat delta;
int cmd;
@@ -179,15 +179,18 @@
if (FFABS([event deltaY]) >= FFABS([event deltaX])) {
delta = [event deltaY] * 0.1;
cmd = delta > 0 ? MP_AXIS_UP : MP_AXIS_DOWN;
- delta = FFABS(delta);
} else {
delta = [event deltaX] * 0.1;
cmd = delta > 0 ? MP_AXIS_RIGHT : MP_AXIS_LEFT;
- delta = FFABS(delta);
}
+ [self.adapter putAxis:cmd delta:FFABS(delta)];
+}
+
+- (void)scrollWheel:(NSEvent *)event
+{
if ([event hasPreciseScrollingDeltas]) {
- [self.adapter putAxis:cmd delta:delta];
+ [self preciseScroll:event];
} else {
const int modifiers = [event modifierFlags];
const int mpkey = [event deltaY] > 0 ? MP_MOUSE_BTN3 : MP_MOUSE_BTN4;