-
Notifications
You must be signed in to change notification settings - Fork 8.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip accessibility notifier and all event calculations when we're in PTY mode #10569
Conversation
cc: @skyline75489 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice comments about why this is needed :)
src/host/srvinit.cpp
Outdated
{ | ||
// If we're in ConPTY mode... set the no-op accessibility notifier | ||
// to prevent sending expensive legacy MSAA events when we won't even be | ||
// responsible for the terminal user interface. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may want to audit the places where IAccessibilityNotifier is used, in addition to having the no-op interface.
I say this because ... the one that notifies about buffer changes reads the buffer first, before calling out to IAN. It's a waste of time if IAN is a no-op, which still increases our output time burden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meh, you've got a good point about SCREEN_INFORMATION::NotifyAccessibilityEventing
. If we're really trying to be as optimal as possible, then yea we shouldn't do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why SCREEN_INFORMATION::NotifyAccessibilityEventing
is the only thing showed up in the WPR trace. Maybe this indicates that other places that calls IAccessibilityNotifier
are not as expensive?
src/host/srvinit.cpp
Outdated
// to prevent sending expensive legacy MSAA events when we won't even be | ||
// responsible for the terminal user interface. | ||
std::unique_ptr<IAccessibilityNotifier> noOpNotifier = std::make_unique<Microsoft::Console::Interactivity::NoOpAccessibilityNotifier>(); | ||
RETURN_IF_NTSTATUS_FAILED(ServiceLocator::SetAccessibilityNotifier(std::move(noOpNotifier))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this doesn't cause us to blow up later... because isn't somebody else going to set it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, it creates it if it was not already created. Clever.
Alternative strategy proposal.... Instead of adding a no-op renderer... I'll change it so
Sound OK? |
S_OK for me |
…all callsites and avoid parameter math if it's null to save more time.
Cleared @lhecker approval for plan B. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was only going to have nits, but I think I had enough of them as to start asking questions. 😄
screenInfo.NotifyAccessibilityEventing(CursorPosition.X, CursorPosition.Y, CursorPosition.X + gsl::narrow<SHORT>(i - 1), CursorPosition.Y); | ||
if (screenInfo.HasAccessibilityEventing()) | ||
{ | ||
screenInfo.NotifyAccessibilityEventing(CursorPosition.X, CursorPosition.Y, CursorPosition.X + gsl::narrow<SHORT>(i - 1), CursorPosition.Y); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it (consistency!), but this also seems like a decision SCREEN_INFO can make for itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to avoid the math on the 3rd param too... and below...
That and the consistency argument together are what made me guard it.
if (screenInfo.HasAccessibilityEventing()) | ||
{ | ||
screenInfo.NotifyAccessibilityEventing(insertionPos.X, insertionPos.Y, gsl::narrow<SHORT>(insertionPos.X + lineVec.size() - 1), insertionPos.Y); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ut supra
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
…PTY mode (#10569) Change accessibility notifier creation so we do not create one when we're in PTY mode. (Guard all call sites to skip math/event work when the notifier is null.) MSAA events are legacy events that are registered for globally and used by some screen readers to find content in the conhost window. The PTY mode is not responsible for hosting the display content or input window, so it makes sense for it to not broadcast these events and delegate the accessibility requirement to the connected terminal. ## References - #10537 ## PR Checklist * [x] Closes #10568 * [x] I work here * [x] Manual test launches passed. (cherry picked from commit 91b454a)
🎉 Handy links: |
🎉 Handy links: |
Change accessibility notifier creation so we do not create one when we're in PTY mode. (Guard all call sites to skip math/event work when the notifier is null.) MSAA events are legacy events that are registered for globally and used by some screen readers to find content in the conhost window. The PTY mode is not responsible for hosting the display content or input window, so it makes sense for it to not broadcast these events and delegate the accessibility requirement to the connected terminal.
References
PR Checklist