Bug 1917202 - Fixed duplicate icon when pinning to taskbar on MSIX r=nrishel

Differential Revision: https://phabricator.services.mozilla.com/D221910
This commit is contained in:
Nipun Shukla 2024-09-27 20:14:50 +00:00
parent 47b5abbd3f
commit 521bcafc8d

View File

@ -84,6 +84,7 @@
#include "nsWindowTaskbarConcealer.h"
#include "nsAppRunner.h"
#include <appmodel.h>
#include <shellapi.h>
#include <windows.h>
#include <wtsapi32.h>
@ -1005,6 +1006,14 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
// grouping works properly
Unused << NS_WARN_IF(!mozilla::widget::WinTaskbar::GenerateAppUserModelID(
aumid, usePrivateAumid));
if (!usePrivateAumid && widget::WinUtils::HasPackageIdentity()) {
// On MSIX we should always have a provided process AUMID
// that we can explicitly assign to a regular window.
UINT32 maxLength = MAX_PATH;
aumid.SetLength(maxLength);
Unused << NS_WARN_IF(
GetCurrentApplicationUserModelId(&maxLength, aumid.get()));
}
if (!FAILED(InitPropVariantFromString(aumid.get(), &pv))) {
if (!FAILED(pPropStore->SetValue(PKEY_AppUserModel_ID, pv))) {
pPropStore->Commit();