Ticket #3859: rotating dash generates way too much output.

(rotate_dash): draw rotating dash with maximum rate of 10 FPS.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2019-09-08 12:00:22 +03:00
parent f788bd02ac
commit 95432ec457
1 changed files with 8 additions and 0 deletions

View File

@ -50,6 +50,7 @@
#include "lib/strutil.h"
#include "lib/widget.h"
#include "lib/event.h"
#include "lib/util.h" /* mc_time_elapsed() */
#include "src/consaver/cons.saver.h"
#include "src/viewer/mcviewer.h" /* The view widget */
@ -953,11 +954,18 @@ set_hintbar (const char *str)
void
rotate_dash (gboolean show)
{
static guint64 timestamp = 0;
/* update with 10 FPS rate */
static const guint64 delay = G_USEC_PER_SEC / 10;
const Widget *w = CONST_WIDGET (midnight_dlg);
if (!nice_rotating_dash || (ok_to_refresh <= 0))
return;
if (show && !mc_time_elapsed (&timestamp, delay))
return;
widget_move (w, (menubar_visible != 0) ? 1 : 0, w->cols - 1);
tty_setcolor (NORMAL_COLOR);