summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2021-02-18 11:17:51 +0000
committerGitHub <noreply@github.com>2021-02-18 12:17:51 +0100
commit55ed7d16f7e4e8189840ae90048284311eb2f45f (patch)
tree9f67c087ef3a1b9696c04290ae0f8e37b7586494
parente059a88533ac463d802f14c4a25d6c1c69d1c8ea (diff)
downloadopenttd-55ed7d16f7e4e8189840ae90048284311eb2f45f.tar.xz
Fix: Unnecessary status bar redraws when there is no news to show (#8691)
InvalidateWindowData with mode SBI_NEWS_DELETED was called on the status bar when checking for a new item of news to be shown in the ticker, even if there is no news queued and no change occurs.
-rw-r--r--src/news_gui.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/news_gui.cpp b/src/news_gui.cpp
index 3412c351c..261de56a8 100644
--- a/src/news_gui.cpp
+++ b/src/news_gui.cpp
@@ -666,8 +666,6 @@ static void MoveToNextTickerItem()
* there is no status bar but possible news. */
if (FindWindowById(WC_STATUS_BAR, 0) == nullptr) return;
- InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
-
/* if we're not at the last item, then move on */
while (_statusbar_news_item != _latest_news) {
_statusbar_news_item = (_statusbar_news_item == nullptr) ? _oldest_news : _statusbar_news_item->next;
@@ -766,6 +764,7 @@ static void DeleteNewsItem(NewsItem *ni)
_statusbar_news_item = ni->prev;
/* About to remove the currently displayed item (ticker, or just a reminder) */
+ InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
MoveToNextTickerItem();
}