Repository navigation
fix(windows): update thumbnail toolbar instead of re-adding it - #117
Open
StillMisty wants to merge 1 commit into
Open
StillMisty wants to merge 1 commit into
StillMisty wants to merge 1 commit into
Conversation
ThumbBarAddButtons is not a replace call once the toolbar exists. Windows 11 build 26300 returns S_OK from a second ThumbBarAddButtons while leaving the toolbar untouched, so calling it first on every sync meant ThumbBarUpdateButtons never ran: button icons / enabled flags stopped following after the first add (clicks and the progress indicator still worked). Update first once a toolbar has been created for the current shell taskbar item, and fall back to ThumbBarAddButtons on E_INVALIDARG (toolbar gone after the shell recreated the taskbar item). ReplayAllOnWindowThread still resets the flag on TaskbarButtonCreated. Verified on Windows 11 build 26300: icons, enabled state and tooltips follow immediately; hide-to-tray/restore and Explorer restart still recreate the toolbar. Refs libnativeapi/nativeapi#90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ThumbBarAddButtonsis not a replace call once the toolbar exists. Windows 11build 26300 returns
S_OKfrom a secondThumbBarAddButtonswhile leaving theexisting toolbar untouched, so calling it first on every sync meant
ThumbBarUpdateButtonsnever ran: button icons / enabled flags stoppedfollowing after the first add (clicks and the progress indicator still worked).
Root cause
SyncThumbnailToolbarOnWindowThread()adds first and only falls back to updateon
E_INVALIDARG; the new shell never returnsE_INVALIDARGfor an existingtoolbar.
Fix
Update first once a toolbar has been created for the current shell taskbar
item, and fall back to
ThumbBarAddButtonsonE_INVALIDARG(toolbar goneafter the shell recreated the taskbar item).
ReplayAllOnWindowThread()stillresets the flag on
TaskbarButtonCreated, so hide/restore and Explorer restartkeep working.
thumbbar_initialized_is now set totrueon any successfulsync: a toolbar cannot be removed from a taskbar item, only its buttons
cleared, so the next sync must not add again.
Verification
Verified on Windows 11 build 26300 with a Flutter app using the
TaskbarThumbnailButtonproperty setters: icons, enabled state and tooltipsnow follow immediately; hide-to-tray/restore and Explorer restart still
recreate the toolbar; progress indicator unaffected.
Note
The umbrella spec
specs/window-taskbar.mdinlibnativeapi/nativeapi(section 3) still describes the add-first heuristic and should be updated when
this is synced.
Reported in libnativeapi/nativeapi#90.