diff --git a/src/normal.c b/src/normal.c index e23fa743..8abdc0fc 100644 --- a/src/normal.c +++ b/src/normal.c @@ -104,6 +104,7 @@ struct input_event *normal_mode(struct input_event *start_ev, int oneshot) mouse_reset(); redraw(scr, mx, my, !show_cursor); + int prev_mx = mx, prev_my = my; uint64_t time = 0; uint64_t last_blink_update = 0; while (1) { @@ -130,14 +131,17 @@ struct input_event *normal_mode(struct input_event *start_ev, int oneshot) } } + int was_scrolling = scroll_active(); scroll_tick(); + if (was_scrolling && !scroll_active()) + redraw(scr, mx, my, !show_cursor); if (mouse_process_key(ev, "up", "down", "left", "right")) { redraw(scr, mx, my, !show_cursor); continue; } if (!ev) { - continue; + goto next; } else if (config_input_match(ev, "scroll_down")) { redraw(scr, mx, my, 1); @@ -246,6 +250,11 @@ struct input_event *normal_mode(struct input_event *start_ev, int oneshot) next: platform->mouse_get_position(&scr, &mx, &my); + if (!scroll_active() && (mx != prev_mx || my != prev_my)) + redraw(scr, mx, my, !show_cursor); + + prev_mx = mx; + prev_my = my; platform->commit(); } diff --git a/src/scroll.c b/src/scroll.c index 3416c9df..398ecc0d 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -89,3 +89,8 @@ void scroll_impart_impulse() { v += fling_velocity; } + +int scroll_active() +{ + return v > 0; +} diff --git a/src/warpd.h b/src/warpd.h index 258c8d4e..c90ee0c7 100644 --- a/src/warpd.h +++ b/src/warpd.h @@ -122,6 +122,7 @@ void scroll_tick(); void scroll_stop(); void scroll_accelerate(int direction); void scroll_decelerate(); +int scroll_active(); void hist_add(int x, int y); int hist_get(int *x, int *y);