diff options
author | James Ross-Gowan <rossy@jrg.systems> | 2017-09-03 00:00:52 +1000 |
---|---|---|
committer | James Ross-Gowan <rossy@jrg.systems> | 2017-09-03 20:31:44 +1000 |
commit | 7897f79217af1e04e6e65bd72e938058e84c451a (patch) | |
tree | 0a0a6434ddcf5f97b3eebfd159d01647ee1f3ffa /video/out/cocoa | |
parent | 8fe4aa94ee7e5400450c124397c8edabfd6d726b (diff) | |
download | mpv-7897f79217af1e04e6e65bd72e938058e84c451a.tar.bz2 mpv-7897f79217af1e04e6e65bd72e938058e84c451a.tar.xz |
input: merge mouse wheel and axis keycodes
Mouse wheel bindings have always been a cause of user confusion.
Previously, on Wayland and macOS, precise touchpads would generate AXIS
keycodes and notched mouse wheels would generate mouse button keycodes.
On Windows, both types of device would generate AXIS keycodes and on
X11, both types of device would generate mouse button keycodes. This
made it pretty difficult for users to modify their mouse-wheel bindings,
since it differed between platforms and in some cases, between devices.
To make it more confusing, the keycodes used on Windows were changed in
18a45a42d524 without a deprecation period or adequate communication to
users.
This change aims to make mouse wheel binds less confusing. Both the
mouse button and AXIS keycodes are now deprecated aliases of the new
WHEEL keycodes. This will technically break input configs on Wayland and
macOS that assign different commands to precise and non-precise scroll
events, but this is probably uncommon (if anyone does it at all) and I
think it's a fair tradeoff for finally fixing mouse wheel-related
confusion on other platforms.
Diffstat (limited to 'video/out/cocoa')
-rw-r--r-- | video/out/cocoa/events_view.m | 6 | ||||
-rw-r--r-- | video/out/cocoa/mpvadapter.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/video/out/cocoa/events_view.m b/video/out/cocoa/events_view.m index 0bf434caf3..4a839b727e 100644 --- a/video/out/cocoa/events_view.m +++ b/video/out/cocoa/events_view.m @@ -239,13 +239,13 @@ if (fabs([event deltaY]) >= fabs([event deltaX])) { delta = [event deltaY] * 0.1; - cmd = delta > 0 ? MP_AXIS_UP : MP_AXIS_DOWN; + cmd = delta > 0 ? MP_WHEEL_UP : MP_WHEEL_DOWN; } else { delta = [event deltaX] * 0.1; - cmd = delta > 0 ? MP_AXIS_RIGHT : MP_AXIS_LEFT; + cmd = delta > 0 ? MP_WHEEL_RIGHT : MP_WHEEL_LEFT; } - [self.adapter putAxis:cmd delta:fabs(delta)]; + [self.adapter putWheel:cmd delta:fabs(delta)]; } - (void)scrollWheel:(NSEvent *)event diff --git a/video/out/cocoa/mpvadapter.h b/video/out/cocoa/mpvadapter.h index 7a858f56ab..69b3b1ad66 100644 --- a/video/out/cocoa/mpvadapter.h +++ b/video/out/cocoa/mpvadapter.h @@ -22,7 +22,7 @@ - (void)setNeedsResize; - (void)signalMouseMovement:(NSPoint)point; - (void)putKey:(int)mpkey withModifiers:(int)modifiers; -- (void)putAxis:(int)mpkey delta:(float)delta; +- (void)putWheel:(int)mpkey delta:(float)delta; - (void)putCommand:(char*)cmd; - (void)handleFilesArray:(NSArray *)files; - (void)didChangeWindowedScreenProfile:(NSNotification *)notification; |