Skip to content

Commit

Permalink
Merge pull request #249 from yourealwaysbe/regular-redraw
Browse files Browse the repository at this point in the history
Redraw window at regular intervals not a fixed time after last move
  • Loading branch information
rnorris authored Apr 27, 2024
2 parents 612be7b + ff61afa commit b62b11d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/vikwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1994,9 +1994,8 @@ static void vik_window_pan_move (VikWindow *vw, GdkEventMotion *event)
vw->pan_move = TRUE;
vw->pan_x = new_pan_x;
vw->pan_y = new_pan_y;
if ( vw->pending_draw_id )
g_source_remove ( vw->pending_draw_id );
vw->pending_draw_id = g_timeout_add ( vw->move_scroll_timeout, (GSourceFunc)pending_draw_timeout, vw );
if ( ! vw->pending_draw_id )
vw->pending_draw_id = g_timeout_add ( vw->move_scroll_timeout, (GSourceFunc)pending_draw_timeout, vw );
}
}

Expand Down Expand Up @@ -2267,9 +2266,8 @@ static gboolean draw_scroll (VikWindow *vw, GdkEventScroll *event)

// Note using a shorter timeout compared to the other instance at the end of this function
// since one path to get here is via touch-pad scrolls which would be generating many events
if ( vw->pending_draw_id )
g_source_remove ( vw->pending_draw_id );
vw->pending_draw_id = g_timeout_add ( vw->move_scroll_timeout, (GSourceFunc)pending_draw_timeout, vw );
if ( ! vw->pending_draw_id )
vw->pending_draw_id = g_timeout_add ( vw->move_scroll_timeout, (GSourceFunc)pending_draw_timeout, vw );

return TRUE;
}
Expand Down Expand Up @@ -2310,9 +2308,8 @@ static gboolean draw_scroll (VikWindow *vw, GdkEventScroll *event)
// If a pending draw, remove it and create a new one
// thus avoiding intermediary screen redraws when transiting through several
// zoom levels in quick succession, as typical when scroll zooming.
if ( vw->pending_draw_id )
g_source_remove ( vw->pending_draw_id );
vw->pending_draw_id = g_timeout_add ( vw->zoom_scroll_timeout, (GSourceFunc)pending_draw_timeout, vw );
if ( ! vw->pending_draw_id )
vw->pending_draw_id = g_timeout_add ( vw->zoom_scroll_timeout, (GSourceFunc)pending_draw_timeout, vw );

return TRUE;
}
Expand Down

0 comments on commit b62b11d

Please sign in to comment.