Skip to content
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

Reduce CursorChanged Events for Accessibility #5196

Merged
6 commits merged into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/renderer/uia/UiaRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -246,7 +255,6 @@ UiaEngine::UiaEngine(IUiaEventDispatcher* dispatcher) :
_selectionChanged = false;
_textBufferChanged = false;
_cursorChanged = false;
_prevSelection.clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

???

Copy link
Contributor

Choose a reason for hiding this comment

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

wots all this then eh

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I realized, why should we clear the previousSelection between frames? If it's clear when we render a new frame, we'll always have the selection be "new". So, this should reduce the number of times we send a selection event too.

_isPainting = false;

return S_OK;
Expand Down
1 change: 1 addition & 0 deletions src/renderer/uia/UiaRenderer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@ namespace Microsoft::Console::Render
Microsoft::Console::Types::IUiaEventDispatcher* _dispatcher;

std::vector<SMALL_RECT> _prevSelection;
til::point _prevCursorPos;
};
}