Skip to content

Conversation

miloush
Copy link
Contributor

@miloush miloush commented Oct 15, 2025

What does the pull request do?

Tracks the source of capture changes and introduces internal PointerCaptureChanging event that gives controls ability to suppress capture change. This allows to implement different mouse capture semantics, notably suppressing platform capture loss.

What is the current behavior?

Implicit capture model (Linux+macOS) is enforced on all platforms.

What is the updated/expected behavior with this PR?

No behavior changes for Avalonia projects as no control handles this event.

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

The Pointer.Capture will return early if the PointerCaptureChanging event is marked as handled and will keep the existing Captured element.

Checklist

Breaking changes

No breaking changes expected.

@miloush miloush added the backport-candidate-11.3.x Consider this PR for backporting to 11.3 branch label Oct 15, 2025
@avaloniaui-bot
Copy link

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

Copy link
Member

@MrJul MrJul left a comment

Choose a reason for hiding this comment

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

LGTM!

@MrJul MrJul enabled auto-merge October 15, 2025 09:09
@avaloniaui-bot
Copy link

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

@Gillibald
Copy link
Contributor

Looks like integration tests for win32 interop are failing now

@miloush
Copy link
Contributor Author

miloush commented Oct 15, 2025

Right, so there was actually a change, the Implicit captures are now not announced to platforms, which seems to have effect on Windows (I am guessing Avalonia did not feel the need to capture mouse due to the implicit capture). I can change the condition to be != External instead of == Explicit but I want to retest that it still works as it should.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants