From ef1894b4aa12db7fef35e1f62be0964fb7f6159e Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 1 Mar 2005 01:02:20 +0000 Subject: [PATCH 1/1] Make sure each screen stays on for a minimum of three seconds (eight if it contains new info). --- bigscreen/rotatescreen.cpp | 18 ++++++++++++++++++ bigscreen/rotatescreen.h | 1 + 2 files changed, 19 insertions(+) diff --git a/bigscreen/rotatescreen.cpp b/bigscreen/rotatescreen.cpp index 6b244e8..275b73e 100644 --- a/bigscreen/rotatescreen.cpp +++ b/bigscreen/rotatescreen.cpp @@ -20,6 +20,8 @@ bool RotateScreen::check_invalidated() return true; if (needs_update()) return true; + if (!can_update()) + return false; for (unsigned i = 0; i < subscreens.size(); ++i) { if (subscreens[i].screen->check_invalidated()) @@ -147,6 +149,22 @@ bool RotateScreen::needs_update() return (since >= 10.0); } +// hold all screens for minimum three seconds, hold all screens with new info for at minimum eight seconds +bool RotateScreen::can_update() +{ + struct timeval now; + gettimeofday(&now, NULL); + + double since = double(now.tv_sec - last_update.tv_sec) + + double(now.tv_usec - last_update.tv_usec) * 1.0e-6; + + if (since < 3.0) + return false; + if (fade_to_new_info && since < 8.0) + return false; + return true; +} + void RotateScreen::add_screen(GenericScreen *screen) { Subscreen ss; diff --git a/bigscreen/rotatescreen.h b/bigscreen/rotatescreen.h index 114f6c0..6a5c35f 100644 --- a/bigscreen/rotatescreen.h +++ b/bigscreen/rotatescreen.h @@ -26,6 +26,7 @@ private: bool in_fade, fade_found_start_time, fade_to_new_info; bool needs_update(); + bool can_update(); public: RotateScreen(); -- 2.39.2