summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2017-08-08 21:34:47 +1000
committerJames Ross-Gowan <rossy@jrg.systems>2017-09-03 20:31:44 +1000
commit8fe4aa94ee7e5400450c124397c8edabfd6d726b (patch)
tree63447b9fd2f69f9432401c31ac3a95f3122f8d61
parent957e9a37db6611fe0879bd2097131df5e09afd47 (diff)
downloadmpv-8fe4aa94ee7e5400450c124397c8edabfd6d726b.tar.bz2
mpv-8fe4aa94ee7e5400450c124397c8edabfd6d726b.tar.xz
cocoa: fix button numbering for back/forward
It seems like the Cocoa backend used to return the same mpv keycodes for mouse back/forward as it did for scrolling up and down. Fix this by explicitly mapping all Cocoa button numbers to the right mpv keycodes.
-rw-r--r--video/out/cocoa/events_view.m11
1 files changed, 7 insertions, 4 deletions
diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m
index 7a95bb9442..0bf434caf3 100644
--- a/video/out/cocoa/events_view.m
+++ b/video/out/cocoa/events_view.m
@@ -291,7 +291,7 @@
- (void)putMouseEvent:(NSEvent *)event withState:(int)state
{
self.hasMouseDown = (state == MP_KEY_STATE_DOWN);
- int mpkey = (MP_MOUSE_BASE + [self mpvButtonNumber:event]);
+ int mpkey = [self mpvButtonNumber:event];
[self.adapter putKey:(mpkey | state) withModifiers:[event modifierFlags]];
}
@@ -326,9 +326,12 @@
{
int buttonNumber = [event buttonNumber];
switch (buttonNumber) {
- case 1: return 2;
- case 2: return 1;
- default: return buttonNumber;
+ case 0: return MP_MBTN_LEFT;
+ case 1: return MP_MBTN_RIGHT;
+ case 2: return MP_MBTN_MID;
+ case 3: return MP_MBTN_BACK;
+ case 4: return MP_MBTN_FORWARD;
+ default: return MP_MBTN9 - 5 + buttonNumber;
}
}
@end