Skip to content

Conversation

xorgy
Copy link
Collaborator

@xorgy xorgy commented Jun 24, 2025

No description provided.

@xorgy xorgy requested a review from waywardmonkeys June 24, 2025 01:41
Copy link
Collaborator

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

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

Nothing here is generating these events ... so they aren't hooked up to the winit device events.

Also, I suspect that ui-input-state should get an update to track the relative motion of the primary pointer over the last frame (for its definition of frame).

/// altogether, delivering every frame.
///
/// This includes the most recent frame.
pub frames: Vec<PointerRelativeFrame>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't the same definition of "frame" that we use everywhere ... not sure about this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I could use the word ‘sample’ instead. It's not exactly a state since it includes a delta along with several state parameters (buttons, click count, etc.)

@xorgy xorgy force-pushed the pointer-relative-motion branch from 501bddc to e49376c Compare June 24, 2025 04:23
@xorgy xorgy force-pushed the pointer-relative-motion branch from e49376c to 33ee69f Compare June 24, 2025 04:28
pub fn reduce_device_event(&mut self, de: &DeviceEvent) -> Option<EventTranslation> {
match de {
DeviceEvent::MouseMotion { delta: (x, y) } => {
const PRIMARY_MOUSE: PointerInfo = PointerInfo {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we know if these only happen for the primary mouse?

Copy link
Collaborator Author

@xorgy xorgy Jun 24, 2025

Choose a reason for hiding this comment

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

While it is technically conceivable on maybe Wayland or X11, this requires very specific configuration, and users expect multi-mouse support to be lacking in applications. We could map the DeviceId through somehow, but there's no portable way to detect the primary pointer in that case, so we would go from always primary pointer to never primary pointer... and I think one of them is probably more reasonable than the other.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On direct backends, we can be more principled about this. As far as I'm aware macOS only supports one primary virtual pointer. Wayland and X11 applications by default tend only to care about the primary virtual pointer (except for multitouch). On Windows I have no familiarity with multi-mouse, but I think it is handled similarly to macOS in practice (even if it may be easier to distinguish the source device).

@xorgy xorgy marked this pull request as draft September 3, 2025 14:01
@xorgy
Copy link
Collaborator Author

xorgy commented Sep 3, 2025

This is halted on the lack of ability to normalize relative motion to absolute motion in Winit, so is draft for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants