Reduce unnecessary status bar redraws

This commit is contained in:
Jonathan G Rennison
2020-02-13 18:42:40 +00:00
parent e41c85e8ec
commit 57f490db2b
3 changed files with 7 additions and 3 deletions

View File

@@ -184,7 +184,7 @@ void InvalidateCompanyWindows(const Company *company)
{ {
CompanyID cid = company->index; CompanyID cid = company->index;
if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0); if (cid == _local_company) SetWindowWidgetDirty(WC_STATUS_BAR, 0, 2);
SetWindowDirty(WC_FINANCES, cid); SetWindowDirty(WC_FINANCES, cid);
} }

View File

@@ -276,7 +276,9 @@ static void OnNewDay()
DisasterDailyLoop(); DisasterDailyLoop();
IndustryDailyLoop(); IndustryDailyLoop();
if (!_settings_client.gui.time_in_minutes || _settings_client.gui.date_with_time > 0) {
SetWindowWidgetDirty(WC_STATUS_BAR, 0, 0); SetWindowWidgetDirty(WC_STATUS_BAR, 0, 0);
}
EnginesDailyLoop(); EnginesDailyLoop();
/* Refresh after possible snowline change */ /* Refresh after possible snowline change */

View File

@@ -81,6 +81,7 @@ struct StatusBarWindow : Window {
int ticker_scroll; int ticker_scroll;
GUITimer ticker_timer; GUITimer ticker_timer;
GUITimer reminder_timeout; GUITimer reminder_timeout;
int64 last_minute = 0;
static const int TICKER_STOP = 1640; ///< scrolling is finished when counter reaches this value static const int TICKER_STOP = 1640; ///< scrolling is finished when counter reaches this value
static const int REMINDER_START = 1350; ///< time in ms for reminder notification (red dot on the right) to stay static const int REMINDER_START = 1350; ///< time in ms for reminder notification (red dot on the right) to stay
@@ -223,7 +224,8 @@ struct StatusBarWindow : Window {
{ {
if (_pause_mode != PM_UNPAUSED) return; if (_pause_mode != PM_UNPAUSED) return;
if (_settings_client.gui.time_in_minutes) { if (_settings_client.gui.time_in_minutes && this->last_minute != CURRENT_MINUTE) {
this->last_minute = CURRENT_MINUTE;
this->SetWidgetDirty(WID_S_LEFT); this->SetWidgetDirty(WID_S_LEFT);
} }