Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Expand Down Expand Up @@ -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();
}

Expand Down
5 changes: 5 additions & 0 deletions src/scroll.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,8 @@ void scroll_impart_impulse()
{
v += fling_velocity;
}

int scroll_active()
{
return v > 0;
}
1 change: 1 addition & 0 deletions src/warpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down