tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 5f39ebf46d97002cd0b938a3bc9754a0d4c2b5aa
parent 5dabada4ef6453d78fa6dac0fa6bc30ab4c39c17
Author: Greg Stoll <gstoll@mozilla.com>
Date:   Wed, 22 Oct 2025 18:06:18 +0000

Bug 1968297 - explicitly refresh thumbnail after windows are restored and resized r=win-reviewers,handyman

This is yet another attempt to get reasonable-looking thumbnails in the
taskbar for restored windows after they get resized. This time we're
actually signaling to invalidate the current thumbnail after the window
gets restored, which I'm hopeful will fix the issue.

As usual, this all works on my machine with a dev build :-/

Differential Revision: https://phabricator.services.mozilla.com/D269422

Diffstat:
Mwidget/windows/WinUtils.cpp | 15+++++++++++++++
Mwidget/windows/WinUtils.h | 2++
Mwidget/windows/nsAppShell.cpp | 1+
3 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp @@ -2015,6 +2015,21 @@ bool WinUtils::MicaPopupsEnabled() { return !lf->NeedsMicaWorkaround(); } +static BOOL CALLBACK InvalidateWindowPreviewsProc(HWND aHwnd, LPARAM aLParam) { + if (RefPtr<nsWindow> window = WinUtils::GetNSWindowPtr(aHwnd)) { + RefPtr<nsITaskbarWindowPreview> taskbarPreview = + window->GetTaskbarPreview(); + if (taskbarPreview) { + taskbarPreview->Invalidate(); + } + } + return TRUE; +} + +void WinUtils::InvalidateWindowPreviews() { + ::EnumWindows(InvalidateWindowPreviewsProc, 0); +} + // There are undocumented APIs to query/change the system DPI settings found by // https://github.com/lihas/ . We use those APIs only for testing purpose, i.e. // in mochitests or some such. To avoid exposing them in our official release diff --git a/widget/windows/WinUtils.h b/widget/windows/WinUtils.h @@ -569,6 +569,8 @@ class WinUtils { static nsresult GetProcessImageName(DWORD aProcessId, nsAString& aName); + static void InvalidateWindowPreviews(); + private: static WhitelistVec BuildWhitelist(); diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp @@ -353,6 +353,7 @@ nsAppShell::Observe(nsISupports* aSubject, const char* aTopic, if (!strcmp(aTopic, "sessionstore-windows-restored")) { nsWindow::SetIsRestoringSession(false); + WinUtils::InvalidateWindowPreviews(); // Now that we've handled the observer notification, we can remove it obsServ->RemoveObserver(this, "sessionstore-windows-restored"); return NS_OK;