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

Invalid Mouse Over events on NC raw events #7804

Merged
merged 2 commits into from
Mar 15, 2022
Merged
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions src/Avalonia.Input/MouseDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ private void ProcessRawEvent(RawPointerEventArgs e)
if(mouse._disposed)
return;

if (e.Type == RawPointerEventType.NonClientLeftButtonDown) return;

_position = e.Root.PointToScreen(e.Position);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This position is stored and used as a parameter for SetPointerOver calls here

var clientPoint = root.PointToClient(_position.Value);
if (rect.Contains(clientPoint))
{
if (_pointer.Captured == null)
{
SetPointerOver(this, 0 /* TODO: proper timestamp */, root, clientPoint,
PointerPointProperties.None, KeyModifiers.None);
}
else
{
SetPointerOver(this, 0 /* TODO: proper timestamp */, root, _pointer.Captured,
PointerPointProperties.None, KeyModifiers.None);
}
}

This position is not correct for RawPointerEventType.NonClientLeftButtonDown-s though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Position was correct at click time but due to resizing it cached a stale value. But anyway this old logic was conflicting with window pointer leave mechanic (which was clearing pointerover state) so your fix looks fine to me.

var props = CreateProperties(e);
var keyModifiers = KeyModifiersUtils.ConvertToKey(e.InputModifiers);
Expand Down