Reduce CursorChanged Events for Accessibility (#5196)
## Summary of the Pull Request Reduce the number of times we dispatch a cursor changed event. We were firing it every time the renderer had to do anything related to the cursor. Unfortunately, blinking the cursor triggered this behavior. Now we just check if the position has changed. ## PR Checklist * [X] Closes #5143 ## Validation Steps Performed Verified using Narrator Also verified #3791 still works right
This commit is contained in:
parent
8585bc6bde
commit
f8227e6fa2
|
@ -68,12 +68,21 @@ UiaEngine::UiaEngine(IUiaEventDispatcher* dispatcher) :
|
|||
// Arguments:
|
||||
// - pcoordCursor - the new position of the cursor
|
||||
// Return Value:
|
||||
// - S_FALSE
|
||||
[[nodiscard]] HRESULT UiaEngine::InvalidateCursor(const COORD* const /*pcoordCursor*/) noexcept
|
||||
// - S_OK
|
||||
[[nodiscard]] HRESULT UiaEngine::InvalidateCursor(const COORD* const pcoordCursor) noexcept
|
||||
try
|
||||
{
|
||||
_cursorChanged = true;
|
||||
return S_FALSE;
|
||||
RETURN_HR_IF_NULL(E_INVALIDARG, pcoordCursor);
|
||||
|
||||
// check if cursor moved
|
||||
if (*pcoordCursor != _prevCursorPos)
|
||||
{
|
||||
_prevCursorPos = *pcoordCursor;
|
||||
_cursorChanged = true;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
CATCH_RETURN();
|
||||
|
||||
// Routine Description:
|
||||
// - Invalidates a rectangle describing a pixel area on the display
|
||||
|
@ -246,7 +255,6 @@ UiaEngine::UiaEngine(IUiaEventDispatcher* dispatcher) :
|
|||
_selectionChanged = false;
|
||||
_textBufferChanged = false;
|
||||
_cursorChanged = false;
|
||||
_prevSelection.clear();
|
||||
_isPainting = false;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -88,5 +88,6 @@ namespace Microsoft::Console::Render
|
|||
Microsoft::Console::Types::IUiaEventDispatcher* _dispatcher;
|
||||
|
||||
std::vector<SMALL_RECT> _prevSelection;
|
||||
til::point _prevCursorPos;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue