-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Standardize Pointer Event Names with WinUI #8058
Comments
Basically, that's how it's handled at least with windows backend, where we have all of these three native events (at least in WM_POINTER PR). But there is also PointerCaptureLost in avalonia, which can't be easily replaced with PointerExited, if you want to track the capture.
It's annoying for everybody to rename events, but also annoying to keep wrong naming (or not wrong, but unconventional). So it's better to rename now. There are more API deletions are planned for this release as well (most of obsolete members in Pointer apis). |
@maxkatz6 @grokys This also should be done by 11.0 and I'm not sure the best time to do it. I would like to wait until compositor and the big styling PRs are done first but it might not matter much. When do you think is a good time to make this switch? Yes, I know everyone is going to hate me for a while. |
@robloo I think it's not really depended on compositor and control themes, so it can be done in parallel. Anyway, it should be done in first preview version, maybe preview1 or preview2. As these versions should have as much breaking changes as possible. First preview is planned to be released after new renderer merged. Probably it will wait for control themes too. |
Discussed in #7907
Avalonia has the following primary pointer events:
PointerEnter
PointerLeave
PointerMoved
PointerPressed
PointerReleased
UWP/WinUI, which was the basis for this implementation, has:
PointerEntered
PointerExited
PointerMoved
PointerPressed
PointerReleased
PointerCanceled
PointerCaptureLost
The first observation is a good simplification. UWP has PointerCanceled, PointerCaptureLost and PointerExited which are all used in slightly different situations. UWP apps must actually handle all of these events as PointerExited may never fire after PointerEntered. My assumption is Avalonia cleaned all of this up and fires PointerEnter and PointerLeave consistently doing away with the other two.
However, then we get into naming:
UWP PointerEntered vs Avalonia PointerEnter. Almost all events are past-tense and almost ALWAYS end in 'ed'. This was changed in Avalonia so it no longer matches the other event names or standard convention. In my opinion PointerEnter is misnamed and should be PointerEntered like in UWP.
Then we have PointerLeave. This was probably renamed because it no longer works exactly like UWP -- as mentioned it handles all cases where pointer exits the control for whatever reason. however, again it doesn't end in 'ed' and isn't well paired with the term 'enter'. In English the terms are matched "Enter"/"Exit" (most common) and "Arrive"/"Leave" (slightly less common) as antonyms. So in my opinion this never should have been changed and should have retained the UWP naming PointerExited.
As agreed in the discussion, two events should be renamed as follows:
I will submit a PR for this.
The text was updated successfully, but these errors were encountered: