Skip to content

Implement SetTaskbarProgress for conhost#20369

Open
tanishqtayade wants to merge 3 commits into
microsoft:mainfrom
tanishqtayade:fix/conhost-settaskbarprogress
Open

Implement SetTaskbarProgress for conhost#20369
tanishqtayade wants to merge 3 commits into
microsoft:mainfrom
tanishqtayade:fix/conhost-settaskbarprogress

Conversation

@tanishqtayade

@tanishqtayade tanishqtayade commented Jun 28, 2026

Copy link
Copy Markdown

Summary:
Conhost had an empty SetTaskbarProgress which was TODO stub. Implemented it using ITaskbarList3 so conhost now actually updates the Windows taskbar progress indicator when a VT sequence requests it.

References:
Addresses the TODO in src/host/outputStream.cpp.

Description:
Used the same structure as IslandWindow::SetTaskbarProgress , get the window handle via ServiceLocator, create and cache an ITaskbarList3 instance, call HrInit() before use, and handle all five states (Clear, Set, Error, Indeterminate, Paused). Caches the instance as a member variable instead of creating a new COM object on every call. Also added ShObjIdl.h to precomp.h since ITaskbarList3 lives there.

Validation:
Built locally with Debug x64 ,30 succeeded, 0 failed.

Comment thread src/host/outputStream.cpp Fixed
@github-actions

This comment has been minimized.

The function was just an empty TODO stub. Hooked it up using
ITaskbarList3, same as IslandWindow already does. Caches the
COM instance and calls HrInit() before use.
@tanishqtayade tanishqtayade force-pushed the fix/conhost-settaskbarprogress branch from 8a0015e to 4fcb254 Compare June 28, 2026 06:39
@tanishqtayade

Copy link
Copy Markdown
Author

Hi @DHowett this PR has approvals from reviewers with read-only access, but branch protection requires an approval from someone with write access to merge. Could you please take a look and approve if it looks good? All required checks are passing thanks for your time.

@DHowett

DHowett commented Jul 10, 2026

Copy link
Copy Markdown
Member

Hey, sorry for the delay. Much of the team has been out of the office or distracted of late. This is really cool, I'll make sure we review it soon.

@DHowett DHowett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general, we try to avoid having the output handlers do anything with the windowing APIs and instead prefer to create window messages so that the window itself can do it. It's safer from a threading perspective and doesn't couple the I/O path with any of the UI code.

Would you mind following what we did for CM_UPDATE_CLIPBOARD in this very same file? We can probably pack the flags and progress into the lParam of the message. Check out how #18949 did it for some inspiration.

Comment thread src/host/outputStream.cpp Outdated
flags = TBPF_NOPROGRESS;
break;
case DispatchTypes::TaskbarState::Set:
// cspell:disable-next-line

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay so, as a rule, we do not use cspell. i do not know where "you" may have gotten that idea.

@microsoft-github-policy-service microsoft-github-policy-service Bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jul 10, 2026

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check-spelling found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@github-actions

This comment has been minimized.

@tanishqtayade tanishqtayade force-pushed the fix/conhost-settaskbarprogress branch from f4143a4 to 9e865ea Compare July 10, 2026 11:13
@tanishqtayade

Copy link
Copy Markdown
Author

Hey @DHowett , refactored as per your suggestion.
SetTaskbarProgress in outputStream.cpp now just posts CM_SET_TASKBAR_PROGRESS with state + progress packed into lParam, same pattern as CM_UPDATE_CLIPBOARD. The ITaskbarList3 call is in now Window::_HandleSetTaskbarProgress (window.cpp/hpp), invoked from ConsoleWindowProc on the UI thread. Moved ShObjIdl.h from host/precomp.h to win32/precomp.h accordingly.
Note that I packed state/progress into 16 bits each rather than a 32/32 split, since LPARAM is only 32 bits on x86 - a <<32 shift would've been UB there. Happy to adjust if you'd prefer a different layout.
Re: cspell - added those without actually needing to, this repo doesn't use cspell disable comments as a convention, I just assumed it would based on habit from other projects. Removed them all.

@tanishqtayade tanishqtayade requested a review from DHowett July 10, 2026 11:24
Comment thread .gitignore Outdated
# MSBuildCache
/MSBuildCacheLogs/ No newline at end of file
/MSBuildCacheLogs/
vcpkg_installed/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not believe our build system puts this in the root folder, and therefore it does not need to be ignored here in the root folder :)

Comment thread src/interactivity/win32/window.hpp Outdated
void _HandleWindowPosChanged(const LPARAM lParam);
LRESULT _HandleGetDpiScaledSize(UINT dpiNew, _Inout_ SIZE* pSizeNew) const;

// Taskbar progress // ← ADD THIS SECTION

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ADD THIS SECTION"?

I appreciate you working on this, but I would like to ask you to be sure that I am not the first human to read the code 🙂

#endif

#define CM_UPDATE_CLIPBOARD (WM_USER+20)
#define CM_SET_TASKBAR_PROGRESS (WM_USER+21)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems you've made an attempt to align these, but it has not worked

Comment thread src/host/outputStream.hpp Outdated
Comment on lines +22 to +83
@@ -78,4 +80,5 @@ class ConhostInternalGetSet final : public Microsoft::Console::VirtualTerminal::

private:
Microsoft::Console::IIoProvider& _io;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert all changes to this file since you have not changed it

tbc
tbi
TBM
TBPF

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious - we already use TBPF in this codebase. it looks like it's already present in spelling/allow/apis.txt. You can put TBPFLAG in there too.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 10, 2026
@DHowett

DHowett commented Jul 10, 2026

Copy link
Copy Markdown
Member

(Otherwise, this is going in the right direction!)

@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 10, 2026
@tanishqtayade

Copy link
Copy Markdown
Author

Hii @DHowett ,fixed all of these. That ADD THIS SECTION comment was a leftover placeholder from when I was scaffolding the change and moving pieces into window.cpp/window.hpp . I clearly didn't give the diff a close enough read before pushing, fair callout. Cleaned it up along with the rest.
Reverted outputStream.hpp (no actual change needed there), fixed the alignment in CustomWindowMessages.h, moved TBPF/TBPFLAG out of expect.txt since they're already covered in apis.txt, and dropped the vcpkg_installed line from .gitignore.

@tanishqtayade tanishqtayade requested a review from DHowett July 10, 2026 20:55
@DHowett

DHowett commented Jul 10, 2026

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@DHowett

DHowett commented Jul 10, 2026

Copy link
Copy Markdown
Member

Looks like the code format check failed!

@j4james

j4james commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

@DHowett I strongly suspect this implementation is incorrect. And this may seem harsh, but I think PRs that show no sign of human involvement should just be rejected outright. It's not like the LLM is going to learn anything from the experience while you handhold it through the process of fixing the code.

@DHowett

DHowett commented Jul 10, 2026

Copy link
Copy Markdown
Member

@j4james you're right. I feel kinda bad doing that, but I do understand that it is costing me my own humanity. Thank you

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.

6 participants