Avalonia
Avalonia copied to clipboard
Fix MouseDevice not reporting clicks when any mouse buttons is hold
What does the pull request do?
Currently if you will click e.g button with left mouse button and hold it and start clicking the right mouse button then right mouse button wont trigger any PointerPressed\PointerReleased events. That doesen't match a WPF behavior. Also,if you hold any mouse button and click any other mouse button and don't move your mouse Avalonia will send MouseMove events which is quite strange.
What is the current behavior?
What is the updated/expected behavior with this PR?
Breaking changes
That might be a soft breaking change for someone who is relaying on the incorrect behavior.
Fixed issues
Fixes https://github.com/AvaloniaUI/Avalonia/issues/13977
You can test this PR using the following package version. 11.1.999-cibuild0045287-beta
. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]
@Takoooooo since it was a bug in MouseDevice, it should be possible to add some tests for this behavior.
@Takoooooo since it was a bug in MouseDevice, it should be possible to add some tests for this behavior.
Sure, will do!
This might indirectly close #13977 as well. If you are no longer raising PointerMoved events when the mouse doesn't actually move on Windows (i.e. when button is just released) then that is the intended behavior and will work as in macOS.
I was just using a trick to avoid watching PointerReleased and just watching PointerMoved for releases as well.
Edit: after re-reading the linked issue I do think it should be closed. We are now following WPF behavior on all platforms and PointerMoved isn't being invoked extra times.
Extra pressed buttons are supposed to arrive as pointer update events. It's specifically designed to match UWP, not WPF.
https://github.com/AvaloniaUI/Avalonia/issues/2857