mirror of https://github.com/mpv-player/mpv
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 937128697f
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.
This commit is contained in:
parent
d8f4749c34
commit
690dc201ad
|
@ -179,6 +179,7 @@ struct input_opts {
|
||||||
bool vo_key_input;
|
bool vo_key_input;
|
||||||
bool test;
|
bool test;
|
||||||
bool allow_win_drag;
|
bool allow_win_drag;
|
||||||
|
bool preprocess_wheel;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct m_sub_options input_config = {
|
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-cursor", OPT_BOOL(enable_mouse_movements)},
|
||||||
{"input-vo-keyboard", OPT_BOOL(vo_key_input)},
|
{"input-vo-keyboard", OPT_BOOL(vo_key_input)},
|
||||||
{"input-media-keys", OPT_BOOL(use_media_keys)},
|
{"input-media-keys", OPT_BOOL(use_media_keys)},
|
||||||
|
{"input-preprocess-wheel", OPT_BOOL(preprocess_wheel)},
|
||||||
#if HAVE_SDL2_GAMEPAD
|
#if HAVE_SDL2_GAMEPAD
|
||||||
{"input-gamepad", OPT_BOOL(use_gamepad)},
|
{"input-gamepad", OPT_BOOL(use_gamepad)},
|
||||||
#endif
|
#endif
|
||||||
|
@ -217,6 +219,7 @@ const struct m_sub_options input_config = {
|
||||||
.builtin_bindings = true,
|
.builtin_bindings = true,
|
||||||
.vo_key_input = true,
|
.vo_key_input = true,
|
||||||
.allow_win_drag = true,
|
.allow_win_drag = true,
|
||||||
|
.preprocess_wheel = true,
|
||||||
},
|
},
|
||||||
.change_flags = UPDATE_INPUT,
|
.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))
|
if (!force_mouse && opts->doubleclick_time && MP_KEY_IS_MOUSE_BTN_DBL(unmod))
|
||||||
return;
|
return;
|
||||||
int units = 1;
|
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;
|
return;
|
||||||
interpret_key(ictx, code, scale, units);
|
interpret_key(ictx, code, scale, units);
|
||||||
if (code & MP_KEY_STATE_DOWN) {
|
if (code & MP_KEY_STATE_DOWN) {
|
||||||
|
|
Loading…
Reference in New Issue