Skip to content

Commit 5e27c21

Browse files
committed
Implement touch_scroll_multiplier
1 parent 3f77a20 commit 5e27c21

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

kitty/config_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,12 @@ def scrollback_pager_history_size(x):
356356
as macOS and Wayland. Use negative numbers to change scroll direction.'''))
357357
# }}}
358358

359+
o('touch_scroll_multiplier', 1.0, long_text=_('''
360+
Modify the amount scrolled by a touchpad. Note this is only used for high
361+
precision scrolling devices on platforms such as macOS and Wayland.
362+
Use negative numbers to change scroll direction.'''))
363+
# }}}
364+
359365
g('mouse') # {{{
360366

361367
o('url_color', '#0087BD', option_type=to_color, long_text=_('''

kitty/mouse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags) {
549549
int s;
550550
bool is_high_resolution = flags & 1;
551551
if (is_high_resolution) {
552-
yoffset *= global_state.callback_os_window->viewport_y_ratio * OPT(wheel_scroll_multiplier);
552+
yoffset *= OPT(touch_scroll_multiplier);
553553
if (yoffset * global_state.callback_os_window->pending_scroll_pixels < 0) {
554554
global_state.callback_os_window->pending_scroll_pixels = 0; // change of direction
555555
}

kitty/state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ PYWRAP1(set_options) {
373373
S(tab_bar_edge, PyLong_AsLong);
374374
S(mouse_hide_wait, PyFloat_AsDouble);
375375
S(wheel_scroll_multiplier, PyFloat_AsDouble);
376+
S(touch_scroll_multiplier, PyFloat_AsDouble);
376377
S(open_url_modifiers, convert_mods);
377378
S(rectangle_select_modifiers, convert_mods);
378379
S(click_interval, PyFloat_AsDouble);

kitty/state.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
typedef enum { LEFT_EDGE, TOP_EDGE, RIGHT_EDGE, BOTTOM_EDGE } Edge;
1414

1515
typedef struct {
16-
double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier;
16+
double visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval, wheel_scroll_multiplier, touch_scroll_multiplier;
1717
bool enable_audio_bell;
1818
CursorShape cursor_shape;
1919
unsigned int open_url_modifiers;

0 commit comments

Comments
 (0)