Prevent tab icon from blinking upon tab gaining focus (#8609)

Looks like recent regression:
1. Every time the tab gains focus (e.g., upon tab switching) we trigger `TaskbarProgressChanged`
2. This call results in `HideIcon` call
3. This call resets the value of Icon even if hide=false
4. This triggers reload of the image resulting in blinking
This commit is contained in:
Don-Vito 2020-12-18 10:49:22 +02:00 committed by GitHub
parent 4f46129cb4
commit d37df8ab05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,17 +219,19 @@ namespace winrt::TerminalApp::implementation
if (auto tab{ weakThis.get() })
{
if (hide)
if (tab->_iconHidden != hide)
{
Icon({});
TabViewItem().IconSource(IconPathConverter::IconSourceMUX({}));
tab->_iconHidden = true;
}
else
{
Icon(_lastIconPath);
TabViewItem().IconSource(IconPathConverter::IconSourceMUX(_lastIconPath));
tab->_iconHidden = false;
if (hide)
{
Icon({});
TabViewItem().IconSource(IconPathConverter::IconSourceMUX({}));
}
else
{
Icon(_lastIconPath);
TabViewItem().IconSource(IconPathConverter::IconSourceMUX(_lastIconPath));
}
tab->_iconHidden = hide;
}
}
}