summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2017-09-03 00:00:52 +1000
committerJames Ross-Gowan <rossy@jrg.systems>2017-09-03 20:31:44 +1000
commit7897f79217af1e04e6e65bd72e938058e84c451a (patch)
tree0a0a6434ddcf5f97b3eebfd159d01647ee1f3ffa /video
parent8fe4aa94ee7e5400450c124397c8edabfd6d726b (diff)
downloadmpv-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')
-rw-r--r--video/out/cocoa/events_view.m6
-rw-r--r--video/out/cocoa/mpvadapter.h2
-rw-r--r--video/out/cocoa_common.m4
-rw-r--r--video/out/vo_caca.c4
-rw-r--r--video/out/vo_sdl.c4
-rw-r--r--video/out/w32_common.c6
-rw-r--r--video/out/wayland_common.c8
-rw-r--r--video/out/x11_common.c4
8 files changed, 19 insertions, 19 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;
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index e0f0f785e0..abead0fb53 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -994,9 +994,9 @@ int vo_cocoa_control(struct vo *vo, int *events, int request, void *arg)
cocoa_put_key_with_modifiers(mpkey, modifiers);
}
-- (void)putAxis:(int)mpkey delta:(float)delta;
+- (void)putWheel:(int)mpkey delta:(float)delta;
{
- mp_input_put_axis(self.vout->input_ctx, mpkey, delta);
+ mp_input_put_wheel(self.vout->input_ctx, mpkey, delta);
}
- (void)putCommand:(char*)cmd
diff --git a/video/out/vo_caca.c b/video/out/vo_caca.c
index 942c0aa37d..46090afc4a 100644
--- a/video/out/vo_caca.c
+++ b/video/out/vo_caca.c
@@ -179,11 +179,11 @@ static void check_events(struct vo *vo)
break;
case CACA_EVENT_MOUSE_PRESS:
mp_input_put_key(vo->input_ctx,
- (MP_MOUSE_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN);
+ (MP_MBTN_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_DOWN);
break;
case CACA_EVENT_MOUSE_RELEASE:
mp_input_put_key(vo->input_ctx,
- (MP_MOUSE_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_UP);
+ (MP_MBTN_BASE + cev.data.mouse.button - 1) | MP_KEY_STATE_UP);
break;
case CACA_EVENT_KEY_PRESS:
{
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index a99eebd46d..1667b2c633 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -608,11 +608,11 @@ static void wait_events(struct vo *vo, int64_t until_time_us)
break;
case SDL_MOUSEBUTTONDOWN:
mp_input_put_key(vo->input_ctx,
- (MP_MOUSE_BASE + ev.button.button - 1) | MP_KEY_STATE_DOWN);
+ (MP_MBTN_BASE + ev.button.button - 1) | MP_KEY_STATE_DOWN);
break;
case SDL_MOUSEBUTTONUP:
mp_input_put_key(vo->input_ctx,
- (MP_MOUSE_BASE + ev.button.button - 1) | MP_KEY_STATE_UP);
+ (MP_MBTN_BASE + ev.button.button - 1) | MP_KEY_STATE_UP);
break;
case SDL_MOUSEWHEEL:
break;
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index e0b26b1183..b93a4fdaa6 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -441,10 +441,10 @@ static void handle_mouse_wheel(struct vo_w32_state *w32, bool horiz, int val)
{
int code;
if (horiz)
- code = val > 0 ? MP_AXIS_RIGHT : MP_AXIS_LEFT;
+ code = val > 0 ? MP_WHEEL_RIGHT : MP_WHEEL_LEFT;
else
- code = val > 0 ? MP_AXIS_UP : MP_AXIS_DOWN;
- mp_input_put_axis(w32->input_ctx, code | mod_state(w32), abs(val) / 120.);
+ code = val > 0 ? MP_WHEEL_UP : MP_WHEEL_DOWN;
+ mp_input_put_wheel(w32->input_ctx, code | mod_state(w32), abs(val) / 120.);
}
static void signal_events(struct vo_w32_state *w32, int events)
diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c
index 22cf23dfa6..181723a0e0 100644
--- a/video/out/wayland_common.c
+++ b/video/out/wayland_common.c
@@ -470,18 +470,18 @@ static void pointer_handle_axis(void *data,
// scale it down to 1.00 for multipliying it with the commands
if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) {
if (value > 0)
- mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_DOWN,
+ mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_DOWN,
wl_fixed_to_double(value)*0.1);
if (value < 0)
- mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_UP,
+ mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_UP,
wl_fixed_to_double(value)*-0.1);
}
else if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
if (value > 0)
- mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_RIGHT,
+ mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_RIGHT,
wl_fixed_to_double(value)*0.1);
if (value < 0)
- mp_input_put_axis(wl->vo->input_ctx, MP_AXIS_LEFT,
+ mp_input_put_wheel(wl->vo->input_ctx, MP_WHEEL_LEFT,
wl_fixed_to_double(value)*-0.1);
}
}
diff --git a/video/out/x11_common.c b/video/out/x11_common.c
index 6fb4e94995..5f2c658a9c 100644
--- a/video/out/x11_common.c
+++ b/video/out/x11_common.c
@@ -1136,7 +1136,7 @@ void vo_x11_check_events(struct vo *vo)
if (Event.xbutton.button == 1)
x11->win_drag_button1_down = true;
mp_input_put_key(x11->input_ctx,
- (MP_MOUSE_BASE + Event.xbutton.button - 1) |
+ (MP_MBTN_BASE + Event.xbutton.button - 1) |
get_mods(Event.xbutton.state) | MP_KEY_STATE_DOWN);
long msg[4] = {XEMBED_REQUEST_FOCUS};
vo_x11_xembed_send_message(x11, msg);
@@ -1145,7 +1145,7 @@ void vo_x11_check_events(struct vo *vo)
if (Event.xbutton.button == 1)
x11->win_drag_button1_down = false;
mp_input_put_key(x11->input_ctx,
- (MP_MOUSE_BASE + Event.xbutton.button - 1) |
+ (MP_MBTN_BASE + Event.xbutton.button - 1) |
get_mods(Event.xbutton.state) | MP_KEY_STATE_UP);
break;
case MapNotify: