From 3f77a2044e14aa9cacbad9042d8b368c0f29b309 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Fri, 9 Nov 2018 13:22:03 +0100 Subject: [PATCH 1/2] Make high resolution scrolling more responsive and configurable --- kitty/mouse.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kitty/mouse.c b/kitty/mouse.c index b5b67d2a7..6bda055c7 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 *= global_state.callback_os_window->viewport_y_ratio * OPT(wheel_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 } From 5e27c2185610ad2fc532e0396caa2542a38ce2c2 Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Sat, 10 Nov 2018 12:33:47 +0100 Subject: [PATCH 2/2] Implement touch_scroll_multiplier --- kitty/config_data.py | 6 ++++++ kitty/mouse.c | 2 +- kitty/state.c | 1 + kitty/state.h | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kitty/config_data.py b/kitty/config_data.py index 426c94a7b..f0a72905a 100644 --- a/kitty/config_data.py +++ b/kitty/config_data.py @@ -356,6 +356,12 @@ 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') # {{{ o('url_color', '#0087BD', option_type=to_color, long_text=_(''' diff --git a/kitty/mouse.c b/kitty/mouse.c index 6bda055c7..e9d90a89c 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -549,7 +549,7 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) { int s; bool is_high_resolution = flags & 1; if (is_high_resolution) { - yoffset *= global_state.callback_os_window->viewport_y_ratio * OPT(wheel_scroll_multiplier); + 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 91970d1a4..a9552421c 100644 --- a/kitty/state.c +++ b/kitty/state.c @@ -373,6 +373,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 ecff3d054..f16b66052 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;