summaryrefslogtreecommitdiffstats
path: root/input
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2024-02-12 03:11:02 -0500
committerDudemanguy <random342@airmail.cc>2024-02-15 16:44:32 +0000
commit690dc201ad07aae68b42fd368384990a18ddd86f (patch)
tree0d5283159fa867bf1ea8d81723f69636dc7da75b /input
parentd8f4749c341e855c9da4569248f2d61b8cd3c7f1 (diff)
downloadmpv-690dc201ad07aae68b42fd368384990a18ddd86f.tar.bz2
mpv-690dc201ad07aae68b42fd368384990a18ddd86f.tar.xz
input: add --input-preprocess-wheel option
This adds --input-preprocess-wheel option, which can be used to control whether to preprocess received wheel events. Commit 937128697fbbef6b21e2d23a4785f1334f62b9e3 added preprocessing of wheel events to prevent the accidental scrolling of another direction when one direction is being scrolled for touchpads, which is problematic with the default wheel bindings where unrelated functions (seeking and volume) are used for the 2 directions. However, this behavior is undesirable in the following situations: - When custom wheel bindings are used so that the 2 directions are used for closely related actions, such as panning. With preprocessing, diagonal movement is impossible. - Since the wheel deadzone was introduced to prevent accidental scrolling for touchpads, this filtering provides no benefit for high resolution unidirectional mouse wheels, while causing a regression where scrolling at least 0.125 units is required to trigger the event, causing input delay. By adding this option, these two use cases are addressed.
Diffstat (limited to 'input')
-rw-r--r--input/input.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/input/input.c b/input/input.c
index c09eccf193..cb58c9ba83 100644
--- a/input/input.c
+++ b/input/input.c
@@ -179,6 +179,7 @@ struct input_opts {
bool vo_key_input;
bool test;
bool allow_win_drag;
+ bool preprocess_wheel;
};
const struct m_sub_options input_config = {
@@ -198,6 +199,7 @@ const struct m_sub_options input_config = {
{"input-cursor", OPT_BOOL(enable_mouse_movements)},
{"input-vo-keyboard", OPT_BOOL(vo_key_input)},
{"input-media-keys", OPT_BOOL(use_media_keys)},
+ {"input-preprocess-wheel", OPT_BOOL(preprocess_wheel)},
#if HAVE_SDL2_GAMEPAD
{"input-gamepad", OPT_BOOL(use_gamepad)},
#endif
@@ -217,6 +219,7 @@ const struct m_sub_options input_config = {
.builtin_bindings = true,
.vo_key_input = true,
.allow_win_drag = true,
+ .preprocess_wheel = true,
},
.change_flags = UPDATE_INPUT,
};
@@ -731,7 +734,7 @@ static void mp_input_feed_key(struct input_ctx *ictx, int code, double scale,
if (!force_mouse && opts->doubleclick_time && MP_KEY_IS_MOUSE_BTN_DBL(unmod))
return;
int units = 1;
- if (MP_KEY_IS_WHEEL(unmod) && !process_wheel(ictx, unmod, &scale, &units))
+ if (MP_KEY_IS_WHEEL(unmod) && opts->preprocess_wheel && !process_wheel(ictx, unmod, &scale, &units))
return;
interpret_key(ictx, code, scale, units);
if (code & MP_KEY_STATE_DOWN) {