mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 11:46:30 +02:00
[MouseHighlighter]Fix stray highlights stucking (#37309)
* [MouseHighlighter]Fix stray highlights stucking * Fix spellcheck --------- Co-authored-by: Stefan Markovic <stefan@janeasystems.com>
This commit is contained in:
@@ -233,6 +233,12 @@ void Highlighter::ClearDrawingPoint(MouseButton _button)
|
|||||||
{
|
{
|
||||||
winrt::Windows::UI::Composition::CompositionSpriteShape circleShape{ nullptr };
|
winrt::Windows::UI::Composition::CompositionSpriteShape circleShape{ nullptr };
|
||||||
|
|
||||||
|
if (nullptr == m_alwaysPointer)
|
||||||
|
{
|
||||||
|
// Guard against alwaysPointer not being initialized.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// always
|
// always
|
||||||
circleShape = m_alwaysPointer;
|
circleShape = m_alwaysPointer;
|
||||||
|
|
||||||
@@ -265,6 +271,11 @@ LRESULT CALLBACK Highlighter::MouseHookProc(int nCode, WPARAM wParam, LPARAM lPa
|
|||||||
// Clear AlwaysPointer only when it's enabled and RightPointer is not active
|
// Clear AlwaysPointer only when it's enabled and RightPointer is not active
|
||||||
instance->ClearDrawingPoint(MouseButton::None);
|
instance->ClearDrawingPoint(MouseButton::None);
|
||||||
}
|
}
|
||||||
|
if (instance->m_leftButtonPressed)
|
||||||
|
{
|
||||||
|
// There might be a stray point from the user releasing the mouse button on an elevated window, which wasn't caught by us.
|
||||||
|
instance->StartDrawingPointFading(MouseButton::Left);
|
||||||
|
}
|
||||||
instance->AddDrawingPoint(MouseButton::Left);
|
instance->AddDrawingPoint(MouseButton::Left);
|
||||||
instance->m_leftButtonPressed = true;
|
instance->m_leftButtonPressed = true;
|
||||||
// start a timer for the scenario, when the user clicks a pinned window which has no focus.
|
// start a timer for the scenario, when the user clicks a pinned window which has no focus.
|
||||||
@@ -284,6 +295,11 @@ LRESULT CALLBACK Highlighter::MouseHookProc(int nCode, WPARAM wParam, LPARAM lPa
|
|||||||
// Clear AlwaysPointer only when it's enabled and LeftPointer is not active
|
// Clear AlwaysPointer only when it's enabled and LeftPointer is not active
|
||||||
instance->ClearDrawingPoint(MouseButton::None);
|
instance->ClearDrawingPoint(MouseButton::None);
|
||||||
}
|
}
|
||||||
|
if (instance->m_rightButtonPressed)
|
||||||
|
{
|
||||||
|
// There might be a stray point from the user releasing the mouse button on an elevated window, which wasn't caught by us.
|
||||||
|
instance->StartDrawingPointFading(MouseButton::Right);
|
||||||
|
}
|
||||||
instance->AddDrawingPoint(MouseButton::Right);
|
instance->AddDrawingPoint(MouseButton::Right);
|
||||||
instance->m_rightButtonPressed = true;
|
instance->m_rightButtonPressed = true;
|
||||||
// same as for the left button, start a timer for reposition ourselves to topmost position
|
// same as for the left button, start a timer for reposition ourselves to topmost position
|
||||||
|
|||||||
Reference in New Issue
Block a user