Changeset - r24823:6a09ecd63560
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 3 years ago 2021-02-18 11:17:51
j.g.rennison@gmail.com
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.
1 file changed with 1 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/news_gui.cpp
Show inline comments
 
@@ -663,14 +663,12 @@ static void MoveToNextTickerItem()
 
{
 
	/* There is no status bar, so no reason to show news;
 
	 * especially important with the end game screen when
 
	 * 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;
 
		const NewsItem *ni = _statusbar_news_item;
 
		const NewsType type = ni->type;
 

	
 
@@ -763,12 +761,13 @@ static void DeleteNewsItem(NewsItem *ni)
 
	if (_statusbar_news_item == ni) {
 
		/* When we're the current news, go to the previous item first;
 
		 * we just possibly made that the last news item. */
 
		_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();
 
	}
 

	
 
	delete ni;
 

	
 
	SetWindowDirty(WC_MESSAGE_HISTORY, 0);
0 comments (0 inline, 0 general)