Skip to content

Conversation

@flabbet
Copy link
Contributor

@flabbet flabbet commented Dec 31, 2025

What does the pull request do?

Mouse Intermediate points are not returned in order on Windows. I already pushed one fix to this some time ago #20075, and it solves most of the cases. However I found out, that on significantly higher pauses between events, Windows still manages to slip past equal timestamps for 2 different pointer positions. And of course, not in order (good job Microsoft)

What is the current behavior?

Points are not in order, when fps are low.

2025-12-31.16-24-31.mp4

To test set:

 <local:PointerCanvas x:Name="PressureCanvas"
                             ...
                             ThreadSleep="50" />

In PointersPage.xaml

What is the updated/expected behavior with this PR?

Points are in order, no weird lines on PointerCanvas

How was the solution implemented (if it's not obvious)?

Discarding packets is now done after time sorting, so time comparision is correct. Discarding early didn't work correctly, because points were not in timestamp order.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 12.0.999-cibuild0061179-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@MrJul MrJul added bug os-windows backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch labels Jan 5, 2026
@MrJul
Copy link
Member

MrJul commented Jan 5, 2026

Sorry, but I really don't see how the proposed change can do anything.
The set of points at the end is the exact same: whether there are filtered before or after sorting does not matter.

I can reproduce the behavior displayed in the provided video, both before and after this PR.
There is no magical algorithm that can solve this case since Windows reports the points out of order with the same timestamp.

If you want precise mouse intermediate points, the best thing to do is to call the Win32 API EnableMouseInPointer(true) at the start of your program, which would enable WM_POINTER messages, which don't exhibit this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch bug os-windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants