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.
This commit is contained in:
James Ross-Gowan
2017-08-08 21:34:47 +10:00
parent 957e9a37db
commit 8fe4aa94ee

View File

@@ -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