Skip to content

Commit 4600c47

Browse files
authored
Rewrite the MSAA/UIA integration into conhost (#19344)
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. ✅
1 parent e80aadd commit 4600c47

File tree

78 files changed

+923
-1023
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+923
-1023
lines changed

.github/actions/spelling/expect/expect.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ IMPEXP
807807
inbox
808808
inclusivity
809809
INCONTEXT
810+
INDEXID
810811
INFOEX
811812
inheritcursor
812813
INITCOMMONCONTROLSEX
@@ -908,6 +909,7 @@ LNM
908909
LOADONCALL
909910
LOBYTE
910911
localappdata
912+
LOCATIONCHANGE
911913
locsrc
912914
Loewen
913915
LOGBRUSH
@@ -1033,6 +1035,7 @@ MOUSEACTIVATE
10331035
MOUSEFIRST
10341036
MOUSEHWHEEL
10351037
MOVESTART
1038+
msaa
10361039
msb
10371040
msbuildcache
10381041
msctls
@@ -1973,8 +1976,8 @@ WRITECONSOLEINPUT
19731976
WRITECONSOLEOUTPUT
19741977
WRITECONSOLEOUTPUTSTRING
19751978
wrkstr
1976-
WRL
19771979
wrl
1980+
WRL
19781981
wrp
19791982
WRunoff
19801983
WSLENV

dep/Console/ntcsrdll.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ Licensed under the MIT license.
77

88
#include <ntcsrmsg.h>
99

10+
#ifdef __cplusplus
11+
extern "C" {
12+
#endif
13+
1014
NTSTATUS CsrClientCallServer(
1115
PCSR_API_MSG m,
1216
PCSR_CAPTURE_HEADER CaptureBuffer OPTIONAL,
1317
ULONG ApiNumber,
1418
ULONG ArgLength
1519
);
20+
21+
#ifdef __cplusplus
22+
}
23+
#endif

dep/Console/ntlpcapi.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Licensed under the MIT license.
55

66
#pragma once
77

8+
#ifdef __cplusplus
9+
extern "C" {
10+
#endif
11+
812
#define OB_FILE_OBJECT_TYPE 1
913

1014
typedef struct _PORT_MESSAGE {
@@ -124,3 +128,7 @@ NTSTATUS NtAlpcQueryInformationMessage(
124128
ULONG Length,
125129
PULONG ReturnLength
126130
);
131+
132+
#ifdef __cplusplus
133+
}
134+
#endif

src/buffer/out/cursor.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
// - ulSize - The height of the cursor within this buffer
1414
Cursor::Cursor(const ULONG ulSize, TextBuffer& parentBuffer) noexcept :
1515
_parentBuffer{ parentBuffer },
16-
_fHasMoved(false),
1716
_fIsVisible(true),
1817
_fIsOn(true),
1918
_fIsDouble(false),
@@ -35,11 +34,6 @@ til::point Cursor::GetPosition() const noexcept
3534
return _cPosition;
3635
}
3736

38-
bool Cursor::HasMoved() const noexcept
39-
{
40-
return _fHasMoved;
41-
}
42-
4337
bool Cursor::IsVisible() const noexcept
4438
{
4539
return _fIsVisible;
@@ -75,11 +69,6 @@ ULONG Cursor::GetSize() const noexcept
7569
return _ulSize;
7670
}
7771

78-
void Cursor::SetHasMoved(const bool fHasMoved) noexcept
79-
{
80-
_fHasMoved = fHasMoved;
81-
}
82-
8372
void Cursor::SetIsVisible(const bool fIsVisible) noexcept
8473
{
8574
_fIsVisible = fIsVisible;
@@ -249,7 +238,6 @@ void Cursor::CopyProperties(const Cursor& OtherCursor) noexcept
249238
// We shouldn't copy the position as it will be already rearranged by the resize operation.
250239
//_cPosition = pOtherCursor->_cPosition;
251240

252-
_fHasMoved = OtherCursor._fHasMoved;
253241
_fIsVisible = OtherCursor._fIsVisible;
254242
_fIsOn = OtherCursor._fIsOn;
255243
_fIsDouble = OtherCursor._fIsDouble;

src/buffer/out/cursor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class Cursor final
3838
Cursor(Cursor&&) = default;
3939
Cursor& operator=(Cursor&&) & = delete;
4040

41-
bool HasMoved() const noexcept;
4241
bool IsVisible() const noexcept;
4342
bool IsOn() const noexcept;
4443
bool IsBlinkingAllowed() const noexcept;
@@ -54,7 +53,6 @@ class Cursor final
5453
bool IsDeferDrawing() noexcept;
5554
void EndDeferDrawing() noexcept;
5655

57-
void SetHasMoved(const bool fHasMoved) noexcept;
5856
void SetIsVisible(const bool fIsVisible) noexcept;
5957
void SetIsOn(const bool fIsOn) noexcept;
6058
void SetBlinkingAllowed(const bool fIsOn) noexcept;
@@ -90,7 +88,6 @@ class Cursor final
9088

9189
til::point _cPosition; // current position on screen (in screen buffer coords).
9290

93-
bool _fHasMoved;
9491
bool _fIsVisible; // whether cursor is visible (set only through the API)
9592
bool _fIsOn; // whether blinking cursor is on or not
9693
bool _fIsDouble; // whether the cursor size should be doubled

src/cascadia/TerminalCore/Terminal.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ class Microsoft::Terminal::Core::Terminal final :
154154
void UseMainScreenBuffer() override;
155155

156156
bool IsVtInputEnabled() const noexcept override;
157-
void NotifyAccessibilityChange(const til::rect& changedRect) noexcept override;
158157
void NotifyBufferRotation(const int delta) override;
159158
void NotifyShellIntegrationMark() override;
160159

src/cascadia/TerminalCore/TerminalApi.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,6 @@ bool Terminal::IsVtInputEnabled() const noexcept
347347
return false;
348348
}
349349

350-
void Terminal::NotifyAccessibilityChange(const til::rect& /*changedRect*/) noexcept
351-
{
352-
// This is only needed in conhost. Terminal handles accessibility in another way.
353-
}
354-
355350
void Terminal::InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength)
356351
{
357352
if (_pfnCompletionsChanged)

0 commit comments

Comments
 (0)