Skip to content

Implement touchpad pinch gestures in gala - #2907

Merged
leolost2605 merged 5 commits into
mainfrom
leolost/touchpad-pinch
Aug 17, 2026
Merged

leolost2605 merged 5 commits into
mainfrom
leolost/touchpad-pinch

Conversation

@leolost2605

Copy link
Copy Markdown
Member

Towards #2751 since touchegg is no longer packaged for OS9. With this only touchscreen is left to do.

First rename the TouchpadBackend to TouchpadSwipeBackend, then introduce TouchpadPinchBackend.

Note that unfortunately in mutter 46 which we use on OS8 a bug was introduced that pinch gestures are captured by wayland clients i.e. they aren't forwarded to us when over a window:
https://gitlab.gnome.org/GNOME/mutter/-/work_items/3505

This was fixed for GNOME 49 so it isn't a problem for our OS9 but unfortunately it wasn't back ported :/
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4417

Therefore I added build conditions that on mutter < 49 we still use touchegg and on mutter 49 or higher we use the new backend. So if you are on mutter < 49 to test this you have to comment out the build conditions to enable the new TouchpadPinchBackend (in GlobalTrigger) and to filter out pinch gesture from touchegg (in ToucheggBackend). Then you can test this over any non window elements, e.g. in the multitasking view or over the background.

@leolost2605
leolost2605 force-pushed the leolost/touchpad-pinch branch from 460f9a9 to f6d934a Compare August 15, 2026 11:35
@leolost2605
leolost2605 requested a review from a team August 15, 2026 14:26
@danirabbit danirabbit added this to OS 9 Aug 16, 2026
@lenemter

Copy link
Copy Markdown
Member

This differs from the existing pinch behavior because of mutter's "gesture cancel" thing.

If you set pinch-to-zoom in System Settings and use it, when you run out of space on your touchpad, the zoom resets. The same thing happens when you add a 4th finger, for example. But in main this doesn't reset the gesture, just stops it.

That's what mutter source code says:

 * @CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL: The gesture was cancelled, all
 *   changes should be undone.
 
 * Cancelled gestures may be so for a variety of reasons, due to hardware,
 * or due to the gesture recognition layers hinting the gesture did not
 * finish resolutely (eg. a 3rd finger being added during a pinch gesture).
 * In these cases, the last event with report the phase
 * %CLUTTER_TOUCHPAD_GESTURE_PHASE_CANCEL, this should be used as a hint
 * to undo any visible/permanent changes that were done throughout the
 * progress of the gesture.

TBH I think we need to preserve both behaviors (for example, cancellation may be useful for #1804), but this just doesn't work with zoom

@lenemter lenemter moved this to In progress in OS 9 Aug 16, 2026
@leolost2605

Copy link
Copy Markdown
Member Author

This differs from the existing pinch behavior because of mutter's "gesture cancel" thing.

Should be fixed now

TBH I think we need to preserve both behaviors (for example, cancellation may be useful for #1804), but this just doesn't work with zoom

For now it just treats cancel as end. If we ever want to allow cancelling a gesture here it will be trivial to add a boolean allow_cancel or something that just emits on end with 0 progress on cancel.
But I also think we probably should integrate that better with the gesturecontroller since then we can do animated progress undoing and we do already cancelling here depending on speed and travel distance. I would leave that to follow ups though because it also requires some design decisions (e.g. when a finger leaves the touchpad do we want to always cancel or cancel only depending on speed and travel distance (how it is currently)).

@leolost2605
leolost2605 force-pushed the leolost/touchpad-pinch branch from 03704a1 to ae96b76 Compare August 16, 2026 16:51
@leolost2605
leolost2605 merged commit 6f02198 into main Aug 17, 2026
7 checks passed
@leolost2605
leolost2605 deleted the leolost/touchpad-pinch branch August 17, 2026 11:05
@github-project-automation github-project-automation Bot moved this from In progress to Done in OS 9 Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants