Skip to content

fix(windows): update taskbar thumbnail buttons first when toolbar is already initialized - #118

Merged
lijy91 merged 1 commit into
mainfrom
fix/windows-thumbbar-update-issue-90
Dec 4, 2026
Merged

lijy91 merged 1 commit into
mainfrom
fix/windows-thumbbar-update-issue-90

Conversation

@lijy91

@lijy91 lijy91 commented Dec 4, 2026

Copy link
Copy Markdown
Member

Fixes libnativeapi/nativeapi#90.

Root Cause

  • SyncThumbnailToolbarOnWindowThread() in src/platform/windows/window_taskbar_windows.cpp called ITaskbarList3::ThumbBarAddButtons first on every sync, relying on E_INVALIDARG to fall back to ThumbBarUpdateButtons.
  • On newer Windows 11 shells (e.g. build 26300 / 26H2), a second ThumbBarAddButtons call returns S_OK while leaving the existing toolbar untouched, so ThumbBarUpdateButtons never runs and subsequent button icon/enabled/tooltip changes are silently dropped.

Fix

  • When thumbbar_initialized_ is true, call ThumbBarUpdateButtons first and fall back to ThumbBarAddButtons only if the shell returns E_INVALIDARG (e.g. taskbar item recreated after hide/restore or Explorer restart; ReplayAllOnWindowThread also resets thumbbar_initialized_ = false on TaskbarButtonCreated).
  • Keep thumbbar_initialized_ = true on success (even after ClearThumbnailButtons) because a taskbar item's toolbar cannot be removed, only updated.

Verification

  • Built nativeapi and passed ctest -C Release -R window_taskbar_test on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] Thumbnail toolbar button state stops updating: second ThumbBarAddButtons returns S_OK, so ThumbBarUpdateButtons never runs

1 participant