Mouse events#344
Conversation
This makes the API more intuitive for common use-cases and allows us to better propagate platform knowledge of motion semantics.
This emphasizes the difference between motion of the host GUI cursor, as used for clicking on things, and raw mouse(-like) input data, as used for first-person controls.
There was a problem hiding this comment.
1f9afe7 (removing the Motion/Moved fix) bothers me a bit. Since this is a breaking change anyway, I'd like to make the event names consistent to reduce future frustration. This is not a blocker for merging because it's a pre-existing issue.
I'm in favor of the other changes, especially the mousewheel fixes--thanks! This should make the correct solution to typical gamedev mouse input significantly more obvious.
| }, | ||
|
|
||
| /// Motion on some analog axis. May report data redundant to other, more specific events. | ||
| Motion { axis: AxisId, value: f64 }, |
There was a problem hiding this comment.
Not sure if I understood this. Does this mean that whether Motion events are also emitted for the mouse is platform-dependent?
There was a problem hiding this comment.
Mouse events should be emitted on all major desktop platforms. Mouse events will also be accompanied by Motion events from the same device with the same deltas. Not all Motion events will be accompanied by Mouse events though, as some Motion events won't come from the Mouse.
There was a problem hiding this comment.
You could improve this comment to clearly note that Motion is a fallback event for any motion along axis that are not already handled by MouseMoved or MouseWheel (since it seems to be what your implementation does).
There was a problem hiding this comment.
There was a problem hiding this comment.
Ah, I see. So, the actual intended behavior is for the generic Motion to repeat MouseMoved? Is there a clear reason for this repetition?
There was a problem hiding this comment.
Motion is good for being abstract over axes, so it makes sense to include mouse axes in that abstraction. MouseMoved is for when you don't want to be abstract over axes, and you just want the mouse.
There was a problem hiding this comment.
Would be nice to include a detailed description of this in the docs given the confusion in these reviews.
|
Looks good to me modulo the doc nitpick. 👍 |
|
@Ralith I'd like them to be consistent, too, is there any other place where |
|
The issue I was discussing was inconsistent use of "Moved" versus "Motion." I don't see a need to have both terms; the introduction of a second one was unintended. |
|
I see. Let's rename all the variants to |
|
If we're breaking the API of |
|
looks like it needs a rebase. Likely a consequence of #342 which move the pointer logic for wayland into its own file. |
|
@vberger I've resolved the conflict. So what's the policy for merging PRs in this repo? |
| axis_buffer: Option<(f32, f32)>, | ||
| axis_discrete_buffer: Option<(i32, i32)>, | ||
| axis_state: TouchPhase, | ||
| } |
There was a problem hiding this comment.
Is it github messing up the displayed diff? It looks like you're undoing part of #342 by re-adding pointer logic in event_loop.rs and removing touch support in the seat...
There was a problem hiding this comment.
Woops I think I grabbed the wrong pieces while resolving this, thanks and good catch. Let me try again.
|
@vberger Ok I think I got it right this time. git has a really weird idea of how changes impact sections of code sometimes and it confused me because I was expecting git to be smarter than it was. |
|
Looks like that's not yet it, the I think git is getting confused because you modified some part of this code (while changing the variant names), but #342 has moved this code to an other file ( |
|
@vberger Thanks for describing the changes to me, sorry I should have reviewed the PR. I think this is ready now. |
elinorbgr
left a comment
There was a problem hiding this comment.
Ok, this looks good. I'll merge this once the CI is finished if all is green.
|
Oh, actually one last thing is missing: could you add a line in the changelog describing the breaking changes which were made? |
|
@vberger done. |
|
Alright, perfect! 👍 |
Replaces #192