Merge branch 'feat-mouse-scroll-min' of https://github.com/page-down/kitty
This commit is contained in:
@@ -135,6 +135,8 @@ Detailed list of changes
|
|||||||
|
|
||||||
- Wayland: Fix touchpads and high resolution wheels not scrolling at the same speed on monitors with different scales (:iss:`4703`)
|
- 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`)
|
||||||
|
|
||||||
|
|
||||||
0.24.2 [2022-02-03]
|
0.24.2 [2022-02-03]
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|||||||
@@ -888,9 +888,13 @@ scroll_event(double UNUSED xoffset, double yoffset, int flags, int modifiers) {
|
|||||||
} else {
|
} else {
|
||||||
SCALE_SCROLL(wheel_scroll_multiplier);
|
SCALE_SCROLL(wheel_scroll_multiplier);
|
||||||
s = (int) round(yoffset);
|
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
|
// apparently on cocoa some mice generate really small yoffset values
|
||||||
// when scrolling slowly https://github.com/kovidgoyal/kitty/issues/1238
|
// when scrolling slowly https://github.com/kovidgoyal/kitty/issues/1238
|
||||||
if (s == 0 && yoffset != 0) s = yoffset > 0 ? 1 : -1;
|
if (s == 0) s = yoffset > 0 ? 1 : -1;
|
||||||
screen->pending_scroll_pixels = 0;
|
screen->pending_scroll_pixels = 0;
|
||||||
}
|
}
|
||||||
#undef SCALE_SCROLL
|
#undef SCALE_SCROLL
|
||||||
|
|||||||
@@ -347,6 +347,16 @@ as macOS and Wayland. Use negative numbers to change scroll direction.
|
|||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
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.
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
opt('touch_scroll_multiplier', '1.0',
|
opt('touch_scroll_multiplier', '1.0',
|
||||||
option_type='float', ctype='double',
|
option_type='float', ctype='double',
|
||||||
long_text='''
|
long_text='''
|
||||||
|
|||||||
3
kitty/options/parse.py
generated
3
kitty/options/parse.py
generated
@@ -1272,6 +1272,9 @@ class Parser:
|
|||||||
def wayland_titlebar_color(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def wayland_titlebar_color(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
ans['wayland_titlebar_color'] = titlebar_color(val)
|
ans['wayland_titlebar_color'] = titlebar_color(val)
|
||||||
|
|
||||||
|
def wheel_scroll_min_lines(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
|
ans['wheel_scroll_min_lines'] = int(val)
|
||||||
|
|
||||||
def wheel_scroll_multiplier(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
def wheel_scroll_multiplier(self, val: str, ans: typing.Dict[str, typing.Any]) -> None:
|
||||||
ans['wheel_scroll_multiplier'] = float(val)
|
ans['wheel_scroll_multiplier'] = float(val)
|
||||||
|
|
||||||
|
|||||||
15
kitty/options/to-c-generated.h
generated
15
kitty/options/to-c-generated.h
generated
@@ -187,6 +187,19 @@ convert_from_opts_wheel_scroll_multiplier(PyObject *py_opts, Options *opts) {
|
|||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_from_python_wheel_scroll_min_lines(PyObject *val, Options *opts) {
|
||||||
|
opts->wheel_scroll_min_lines = PyLong_AsLong(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
convert_from_opts_wheel_scroll_min_lines(PyObject *py_opts, Options *opts) {
|
||||||
|
PyObject *ret = PyObject_GetAttrString(py_opts, "wheel_scroll_min_lines");
|
||||||
|
if (ret == NULL) return;
|
||||||
|
convert_from_python_wheel_scroll_min_lines(ret, opts);
|
||||||
|
Py_DECREF(ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
convert_from_python_touch_scroll_multiplier(PyObject *val, Options *opts) {
|
convert_from_python_touch_scroll_multiplier(PyObject *val, Options *opts) {
|
||||||
opts->touch_scroll_multiplier = PyFloat_AsDouble(val);
|
opts->touch_scroll_multiplier = PyFloat_AsDouble(val);
|
||||||
@@ -1023,6 +1036,8 @@ convert_opts_from_python_opts(PyObject *py_opts, Options *opts) {
|
|||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_wheel_scroll_multiplier(py_opts, opts);
|
convert_from_opts_wheel_scroll_multiplier(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
|
convert_from_opts_wheel_scroll_min_lines(py_opts, opts);
|
||||||
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_touch_scroll_multiplier(py_opts, opts);
|
convert_from_opts_touch_scroll_multiplier(py_opts, opts);
|
||||||
if (PyErr_Occurred()) return false;
|
if (PyErr_Occurred()) return false;
|
||||||
convert_from_opts_mouse_hide_wait(py_opts, opts);
|
convert_from_opts_mouse_hide_wait(py_opts, opts);
|
||||||
|
|||||||
2
kitty/options/types.py
generated
2
kitty/options/types.py
generated
@@ -437,6 +437,7 @@ option_names = ( # {{{
|
|||||||
'visual_window_select_characters',
|
'visual_window_select_characters',
|
||||||
'watcher',
|
'watcher',
|
||||||
'wayland_titlebar_color',
|
'wayland_titlebar_color',
|
||||||
|
'wheel_scroll_min_lines',
|
||||||
'wheel_scroll_multiplier',
|
'wheel_scroll_multiplier',
|
||||||
'window_alert_on_bell',
|
'window_alert_on_bell',
|
||||||
'window_border_width',
|
'window_border_width',
|
||||||
@@ -580,6 +581,7 @@ class Options:
|
|||||||
visual_bell_duration: float = 0
|
visual_bell_duration: float = 0
|
||||||
visual_window_select_characters: str = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
visual_window_select_characters: str = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
wayland_titlebar_color: int = 0
|
wayland_titlebar_color: int = 0
|
||||||
|
wheel_scroll_min_lines: int = 1
|
||||||
wheel_scroll_multiplier: float = 5.0
|
wheel_scroll_multiplier: float = 5.0
|
||||||
window_alert_on_bell: bool = True
|
window_alert_on_bell: bool = True
|
||||||
window_border_width: typing.Tuple[float, str] = (0.5, 'pt')
|
window_border_width: typing.Tuple[float, str] = (0.5, 'pt')
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
monotonic_t visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval;
|
monotonic_t visual_bell_duration, cursor_blink_interval, cursor_stop_blinking_after, mouse_hide_wait, click_interval;
|
||||||
double wheel_scroll_multiplier, touch_scroll_multiplier;
|
double wheel_scroll_multiplier, touch_scroll_multiplier;
|
||||||
|
int wheel_scroll_min_lines;
|
||||||
bool enable_audio_bell;
|
bool enable_audio_bell;
|
||||||
CursorShape cursor_shape;
|
CursorShape cursor_shape;
|
||||||
float cursor_beam_thickness;
|
float cursor_beam_thickness;
|
||||||
|
|||||||
Reference in New Issue
Block a user