diff --git a/kitty/mouse.c b/kitty/mouse.c index b0c159630..821d9a07b 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -816,9 +816,9 @@ mouse_event(const int button, int modifiers, int action) { } static int -scale_scroll(Screen *screen, double offset, bool is_high_resolution, double *pending_scroll_pixels, int cell_size) { +scale_scroll(MouseTrackingMode mouse_tracking_mode, double offset, bool is_high_resolution, double *pending_scroll_pixels, int cell_size) { // scale the scroll by the multiplier unless the mouse is grabbed. If the mouse is grabbed only change direction. -#define SCALE_SCROLL(which) { double scale = OPT(which); if (screen->modes.mouse_tracking_mode) scale /= fabs(scale); offset *= scale; } +#define SCALE_SCROLL(which) { double scale = OPT(which); if (mouse_tracking_mode) scale /= fabs(scale); offset *= scale; } int s = 0; if (is_high_resolution) { SCALE_SCROLL(touch_scroll_multiplier); @@ -833,7 +833,7 @@ scale_scroll(Screen *screen, double offset, bool is_high_resolution, double *pen SCALE_SCROLL(wheel_scroll_multiplier); s = (int) round(offset); if (offset != 0) { - const int min_lines = screen->modes.mouse_tracking_mode ? 1 : OPT(wheel_scroll_min_lines); + const int min_lines = mouse_tracking_mode ? 1 : OPT(wheel_scroll_min_lines); if (min_lines > 0 && abs(s) < min_lines) s = offset > 0 ? min_lines : -min_lines; // Always add the minimum number of lines when it is negative else if (min_lines < 0) s = offset > 0 ? s - min_lines : s + min_lines; @@ -910,7 +910,7 @@ scroll_event(double xoffset, double yoffset, int flags, int modifiers) { bool is_high_resolution = flags & 1; if (yoffset != 0.0) { - s = scale_scroll(screen, yoffset, is_high_resolution, &screen->pending_scroll_pixels_y, global_state.callback_os_window->fonts_data->cell_height); + s = scale_scroll(screen->modes.mouse_tracking_mode, yoffset, is_high_resolution, &screen->pending_scroll_pixels_y, global_state.callback_os_window->fonts_data->cell_height); if (s) { bool upwards = s > 0; if (screen->modes.mouse_tracking_mode) { @@ -928,7 +928,7 @@ scroll_event(double xoffset, double yoffset, int flags, int modifiers) { } } if (xoffset != 0.0) { - s = scale_scroll(screen, xoffset, is_high_resolution, &screen->pending_scroll_pixels_x, global_state.callback_os_window->fonts_data->cell_width); + s = scale_scroll(screen->modes.mouse_tracking_mode, xoffset, is_high_resolution, &screen->pending_scroll_pixels_x, global_state.callback_os_window->fonts_data->cell_width); if (s) { if (screen->modes.mouse_tracking_mode) { int sz = encode_mouse_scroll(w, s > 0 ? 6 : 7, modifiers);