winit icon indicating copy to clipboard operation
winit copied to clipboard

wayland: Add support for PinchGesture and RotationGesture

Open linkmauve opened this issue 9 months ago • 2 comments

These two events are synthesized from the same event from the same protocol, zwp_pointer_gestures_v1, and will always come together.

I’ve left over the third value, which is a dx/dy from the center of the gesture, it could be exposed as a 2D scroll but I feel like this should be a different event than the normal AxisMotion.

The documentation doesn’t indicate the unit of the rotation, so I’ve left it as degrees. I don’t have any Apple OS where I could test whether that event is also in degrees or in radians there.

The other two gestures supported by this protocol, a multi-finger swipe, and a multi-finger hold, aren’t currently matched with any event in winit, would it make sense to expose them?

I’ve only tested on GNOME, but I expect other compositors to expose the same protocol eventually.

  • [x] Tested on all platforms changed
  • [x] Added an entry to the changelog module if knowledge of this change could be valuable to users
  • [x] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • [ ] Created or updated an example program if it would help users understand this functionality
  • [ ] Updated feature matrix, if new features were added or implemented

The last two items aren’t needed, as they were already added for the other two platforms which support this feature.

linkmauve avatar Apr 27 '24 11:04 linkmauve

The rotation delta is in degrees on macOS, and that's what the iOS impl tries to match as well.

(Though we should perhaps change it to radians, that's the morally superior unit).

madsmtm avatar Apr 27 '24 13:04 madsmtm

Thanks! Now that this other PR is merged, I’ve also implemented PanGesture during the pinch.

linkmauve avatar Apr 27 '24 15:04 linkmauve