win: use UPDATEITEM, not ASSOCCHANGED when updating shortcut
SHCNE_ASSOCCHANGED causes the whole desktop to flash. I've found that UPDATEITEM is sufficient in other scenarios (crrev.com/c/3442476) and works better on Win 11. Add SHCNF_FLUSH since some shortcut changes require it, and this function should be called rarely (and even with FLUSH should be a lot faster than SHCNE_ASSOCCHANGED) Tested manually by locally modifying kLastVersionNeedingMigration and the app model id and pinned taskbar icons looked fine after upgrade. Change-Id: Ia7f3400df8adb5b1fd9d3618f522e8f4e80b9777 Cq-Include-Trybots: luci.chromium.try:win7-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3451704 Reviewed-by: Gabriel Charette <gab@chromium.org> Commit-Queue: David Bienvenu <davidbienvenu@chromium.org> Cr-Commit-Position: refs/heads/main@{#969739}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
76363867ed
commit
7a484747a7
@ -190,19 +190,14 @@ bool CreateOrUpdateShortcutLink(const FilePath& shortcut_path,
|
||||
|
||||
// If we successfully created/updated the icon, notify the shell that we have
|
||||
// done so.
|
||||
const bool succeeded = SUCCEEDED(result);
|
||||
if (succeeded) {
|
||||
if (shortcut_existed) {
|
||||
// TODO(gab): SHCNE_UPDATEITEM might be sufficient here; further testing
|
||||
// required.
|
||||
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nullptr, nullptr);
|
||||
} else {
|
||||
SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, shortcut_path.value().c_str(),
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
if (!SUCCEEDED(result))
|
||||
return false;
|
||||
|
||||
return succeeded;
|
||||
SHChangeNotify(shortcut_existed ? SHCNE_UPDATEITEM : SHCNE_CREATE,
|
||||
SHCNF_PATH | SHCNF_FLUSH, shortcut_path.value().c_str(),
|
||||
nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ResolveShortcutProperties(const FilePath& shortcut_path,
|
||||
|
Reference in New Issue
Block a user