Skip to content

Rewrite the MSAA/UIA integration into conhost - #19344

Merged
Dustin L. Howett (DHowett) merged 7 commits into
mainfrom
dev/lhecker/BEGONE-FOUL-SPIRIT
Sep 22, 2025
Merged

Dustin L. Howett (DHowett) merged 7 commits into
mainfrom
dev/lhecker/BEGONE-FOUL-SPIRIT

Conversation

@lhecker

@lhecker Leonard Hecker (lhecker) commented Sep 12, 2025 •

Copy link
Copy Markdown
Member

Goal: Remove CursorBlinker.
Problem: Spooky action at a distance via Cursor::HasMoved.
Solution: Moved all the a11y event raising into _stream.cpp and pray for the best.

Goal: Prevent node.js from tanking conhost performance via MSAA (WHY).
Problem: ServiceLocator.
Solution: Unserviced the locator. Debounced event raising. Performance increased by >10x.
Problem 2: Lots of files changed.

This PR is a prerequisite for #19330

Validation Steps Performed

Ran NVDA with and without UIA enabled and with different delays. ✅

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

This comment has been minimized.

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.

55/70

Comment thread src/host/_output.cpp Resolved
Comment thread src/host/_stream.cpp
const auto& bufferBefore = gci.GetActiveOutputBuffer();
const auto cursorBefore = bufferBefore.GetTextBuffer().GetCursor().GetPosition();

auto raise = wil::scope_exit([&bufferBefore, cursorBefore] {

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.

hit this with AVRF please. I'm worried about capturing this reference by reference.

can we just capture the pointer itself, since all we do is compare it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

AFAIK lambda captures behave like auto so bufferBefore would capture a copy, not a reference. But I agree that capturing a pointer would be easier to read and understand.

Comment thread src/host/_stream.cpp Resolved
// Flags is expected to be 2, 1, or 0. 2 in selecting (whether or not visible), 1 if just visible, 0 if invisible/noselect.
if (WI_IsFlagSet(gci.Flags, CONSOLE_SELECTING))
{
flags = IAccessibilityNotifier::ConsoleCaretEventFlags::CaretSelection;

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.

📝 watch where Selection/Invisible/Visible go

<ClCompile Include="..\writeData.cpp" />
<ClCompile Include="..\_output.cpp" />
<ClCompile Include="..\_stream.cpp" />
<ClCompile Include="..\AccessibilityNotifier.cpp" />

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 to sources.inc

Comment on lines +17 to +25
void RemoteConsoleControl::Control(ControlType, PVOID, DWORD) noexcept
{
WI_ASSERT_FAIL();
}

void RemoteConsoleControl::NotifyWinEvent(DWORD, HWND, LONG, LONG) noexcept
{
WI_ASSERT_FAIL();
}

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.

you need to test this out as a handoff recipient to verify these asserts never hit

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Will do. Theoretically nothing will happen because AccessibilityNotifier only exists if the Window class has been loaded.

</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\AccessibilityNotifier.cpp" />

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.

update sources

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.

Approving with comments! Glorious work, well done L.

Comment thread src/host/settings.hpp
bool _fInterceptCopyPaste;

bool _TerminalScrolling;
bool _TerminalScrolling = true;

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.

nit we should default to false for compatibility with old console

Comment thread src/host/AccessibilityNotifier.h Resolved
Comment thread src/host/AccessibilityNotifier.cpp Resolved
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.

3 participants