diff --git a/docs/changelog.rst b/docs/changelog.rst index 356defc17..7676440bd 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -26,6 +26,9 @@ Changelog - Allow private use unicode characters to stretch over more than a single neighboring space (:pull:`1036`) +- Add a new :opt:`touch_scroll_multiplier` option to modify the amount + scrolled by high precision scrolling devices such as touchpads (:pull:`1129`) + - icat kitten: Implement reading image data from STDIN, if STDIN is not connected to a terminal (:iss:`1130`) diff --git a/kitty/config_data.py b/kitty/config_data.py index 2c604259f..74fae825f 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -354,6 +354,14 @@ o('wheel_scroll_multiplier', 5.0, long_text=_(''' Modify the amount scrolled by the mouse wheel. Note this is only used for low precision scrolling devices, not for high precision scrolling on platforms such as macOS and Wayland. Use negative numbers to change scroll direction.''')) + +o('touch_scroll_multiplier', 1.0, long_text=_(''' +Modify the amount scrolled by a touchpad. Note this is only used for high +precision scrolling devices on platforms such as macOS and Wayland. +Use negative numbers to change scroll direction.''')) + +# }}} + # }}} g('mouse') # {{{ diff --git a/kitty/mouse.c b/kitty/mouse.c index b5b67d2a7..e9d90a89c 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -549,6 +549,7 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) { int s; bool is_high_resolution = flags & 1; if (is_high_resolution) { + yoffset *= OPT(touch_scroll_multiplier); if (yoffset * global_state.callback_os_window->pending_scroll_pixels < 0) { global_state.callback_os_window->pending_scroll_pixels = 0; // change of direction } diff --git a/kitty/state.c b/kitty/state.c index 23d9aee2c..51d38972d 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -374,6 +374,7 @@ PYWRAP1(set_options) { S(tab_bar_edge, PyLong_AsLong); S(mouse_hide_wait, PyFloat_AsDouble); S(wheel_scroll_multiplier, PyFloat_AsDouble); + S(touch_scroll_multiplier, PyFloat_AsDouble); S(open_url_modifiers, convert_mods); S(rectangle_select_modifiers, convert_mods); S(click_interval, PyFloat_AsDouble); diff --git a/kitty/state.h b/kitty/state.h index 295d61d27..be9f6d4ba 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -13,7 +13,7 @@ typedef enum { LEFT_EDGE, TOP_EDGE, RIGHT_EDGE, BOTTOM_EDGE } Edge; typedef struct { - double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier; + double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier, touch_scroll_multiplier; bool enable_audio_bell; CursorShape cursor_shape; unsigned int open_url_modifiers;