Cleanup previous PR

This commit is contained in:
Kovid Goyal
2022-02-14 20:21:17 +05:30
parent 3e2a8d80d7
commit 88630731dc
3 changed files with 16 additions and 13 deletions

View File

@@ -135,7 +135,7 @@ Detailed list of changes
- Wayland: Fix touchpads and high resolution wheels not scrolling at the same speed on monitors with different scales (:iss:`4703`)
- Add an option :opt:`wheel_scroll_min_lines` to set the minimum number of lines for mouse wheel scrolling (:pull:`4710`)
- Add an option :opt:`wheel_scroll_min_lines` to set the minimum number of lines for mouse wheel scrolling when using a mouse with a wheel that generates very small offsets when slow scrolling (:pull:`4710`)
0.24.2 [2022-02-03]

View File

@@ -888,13 +888,15 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags, int modifiers) {
} else {
SCALE_SCROLL(wheel_scroll_multiplier);
s = (int) round(yoffset);
int min_lines = OPT(wheel_scroll_min_lines);
if (min_lines > 0 && abs(s) < min_lines) s = yoffset > 0 ? min_lines : -min_lines;
// Add the minimum number of lines when it is negative and the scrolling acceleration takes effect
else if (min_lines < 0) s = yoffset > 0 ? s - min_lines : s + min_lines;
// apparently on cocoa some mice generate really small yoffset values
// when scrolling slowly https://github.com/kovidgoyal/kitty/issues/1238
if (s == 0) s = yoffset > 0 ? 1 : -1;
if (yoffset != 0) {
const int min_lines = OPT(wheel_scroll_min_lines);
if (min_lines > 0 && abs(s) < min_lines) s = yoffset > 0 ? min_lines : -min_lines;
// Always add the minimum number of lines when it is negative
else if (min_lines < 0) s = yoffset > 0 ? s - min_lines : s + min_lines;
// apparently on cocoa some mice generate really small yoffset values
// when scrolling slowly https://github.com/kovidgoyal/kitty/issues/1238
if (s == 0) s = yoffset > 0 ? 1 : -1;
}
screen->pending_scroll_pixels = 0;
}
#undef SCALE_SCROLL

View File

@@ -343,17 +343,18 @@ opt('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.
as macOS and Wayland. Use negative numbers to change scroll direction. See also
:opt:`wheel_scroll_min_lines`.
'''
)
opt('wheel_scroll_min_lines', '1',
option_type='int', ctype='int',
long_text='''
The minimum number of lines scrolled by the mouse wheel. The scrolling
acceleration only takes effect after it reaches the number. Note that this is
only used for low precision scrolling devices. With a negative number, the
minimum number of lines will always be added.
The minimum number of lines scrolled by the mouse wheel. The :opt:`scroll multiplier <wheel_scroll_multiplier>`
only takes effect after it reaches this number. Note that this is only used for
low precision scrolling devices like wheel mice that scroll by very small amounts when using the wheel.
With a negative number, the minimum number of lines will always be added.
'''
)