Skip to content

Wayland: Implement pointer gesture hold#4549

Open
Murmele wants to merge 11 commits intorust-windowing:masterfrom
Murmele:pointer_gesture_hold
Open

Wayland: Implement pointer gesture hold#4549
Murmele wants to merge 11 commits intorust-windowing:masterfrom
Murmele:pointer_gesture_hold

Conversation

@Murmele
Copy link
Copy Markdown

@Murmele Murmele commented Mar 27, 2026

  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • 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

Murmele added 3 commits March 27, 2026 09:17
…pad touches

Description: Required to stop kinetic scrolling animations
Description: previously we got wl_display#1: error 1: invalid method 3 (since 1 < 3), object zwp_pointer_gestures_v1#21
Reason: This is usefull when using kinetic animations after the TouchPhase ended and the touchpad was touched again but no movement was executed. In this case the animation shall be stopped
@Murmele Murmele requested a review from kchibisov as a code owner March 27, 2026 08:22
@Murmele Murmele force-pushed the pointer_gesture_hold branch from 089600a to 78f1e72 Compare March 27, 2026 08:42
@Murmele Murmele force-pushed the pointer_gesture_hold branch from 54831f7 to 83821c4 Compare March 27, 2026 14:24
@Murmele Murmele marked this pull request as draft March 27, 2026 15:07
Copy link
Copy Markdown
Author

@Murmele Murmele left a comment

Choose a reason for hiding this comment

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

We can send it also for multiple fingers

@Murmele Murmele marked this pull request as ready for review March 30, 2026 14:57
@Murmele Murmele requested a review from kchibisov March 30, 2026 14:57
Reason: Because it can be handled like Started
// The chance of only one of these events being necessary is extremely small,
// so it is easier to just send all
state.events_sink.push_window_event(
WindowEvent::MouseWheel {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we not use MouseWheel for that? Adding HoldGesture should be better, since it's not that the user should pause scrolling. Alternatively, we can cancel MouseWheel, but I'm not sure it's good.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Do you mean Holdgesture as own event?

The usecase is when you scroll (pinch, rotate, ...) and release the touchpad the animation of the scroll is still ongoing due to some inertia.
When you touch the touchpad again you don't get a wheel event unless you are moving the fingers a bit.
But you get this hold event. Which shall stop the animation by sending a new start and cancel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, I was suggesting to make it into separate event, so UI toolkits can handle it specially.

Because Ended doesn't mean that scrolling should be stopped, it just says taht sequence ended, but inertia won't stop.

As alternative, we can use MouseWheel { Cancel }, when hold gesture starts, but I don't see why such scrolling wouldn't be possible with just Touch and in such case the separate HoldGesture event probably makes sense?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks I changed it to have an explicit Event for it

@Murmele Murmele force-pushed the pointer_gesture_hold branch from ac8aab7 to 44a1409 Compare April 7, 2026 06:48
Murmele added 2 commits April 7, 2026 13:47
Reason: GestureHold was not considered
Copy link
Copy Markdown
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

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

@madsmtm , do we have something like that on macOS/ios?

#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum TouchPhase {
/// Moving the fingers started or when the touchpad gets touched with more than 2 fingers
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There's no connection between fingers and the phase.

You can describe usual behavior, like for example, but we can not guarantee anything.

pub enum TouchPhase {
/// Moving the fingers started or when the touchpad gets touched with more than 2 fingers
Started,
/// Moving of the fingers is ongoing
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's not moving per-se, it's just the touch contant point changed, without e.g. lifting finger.

Moved,
/// The fingers left the touchscreen or the touchpad
Ended,
Cancelled,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you started documenting, should document this one for sure, since actually important, as in, it should cancel the event in flight if any and clear state that generated that event.

Started,
/// Moving of the fingers is ongoing
Moved,
/// The fingers left the touchscreen or the touchpad
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should use for example more, we can not guarantee anything.

Comment on lines +272 to +273
/// Two or more fingers touching / releasing the touchpad / touchscreen without any movement
HoldGesture { device_id: Option<DeviceId>, phase: TouchPhase },
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should document what user expected to do and then give example when the event may happen.


- Updated `windows-sys` to `v0.61`.
- On older macOS versions (tested up to 12.7.6), applications now receive mouse movement events for unfocused windows, matching the behavior on other platforms.
- On wayland touchpad hold events are implemented.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's not changed, it should be in Added and you should explain in terms of global API changes, saying that API is implemented on XYZ(Wayland), you can probably find examples in older changelogs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants