Skip to content

Gestures and dragable layer surfaces

Guido Günther requested to merge guidog/phoc:gestures into master

This adds support generic support for recognizing swipe and drag gestures that emit their state via signals based on the events fed to them. We use that to make PhocLayerSurface draggable when anchored to 3 sides by a new wayland protocol that can be used by clients to indicate they want that surface dragable based on a threshold.

I had more points in the compositor listen to gesture events and bubble these up but just kept the cursor related bit for now so we can get that moving first.

These bits should be addressed before undrafting/testing:

  • Canceling gestures to the client (wl_touch::cancel). Otherwise the swipe will also trigger touch event on the client and e.g. close notifications. I have code for that but that needs wlroots changes so I left that out for the moment. (See !346 (merged))
  • Protocol cleanups
    • apply changes on commit rather than right away
  • Some obvious resource leaks (see TODOs)
  • Spelling is draggable, not dragable

Other things that would be good before merging:

  • Pick up the right velocity when swipe closing (not needed if we ease out atm)
  • Tests at all
  • Submitting less damage
  • allow for non-0 unfolded margin

Follow ups that can be done past merge:

  • Standalone gesture test client (for testing gestures rather than gesture + layer-surface)
  • Handle shell reveal with a gesture as this is currently open coded
  • Extend layer-surface-effects protocol to support more gestures:
    • swipe to move non anchored surfaces (e.g. to swipe away notifications) The gesture code can do that but we need to wire it up.
    • fling for no stick to finger swipe of a surface The gesture code can do that but we need to wire it up.
    • generic sliding (e.g. to slide in/out the OSD)
  • other protocol improvements
    • Allow to restrict the draggable area (rather than the whole surface)
    • A way to deactivate dragging (e.g. when scrolling in a list box on the client, this would allow to use the current
  • Separate animation class since we have the same pattern all around (see e.g. (I'll post the code once gestures support is in so I can rebase it accordingly)
  • Better rendering with frame callbacks that take refresh rate into account (code in does that) (I'll post the code once gestures support is in so I can rebase it accordingly)
  • Touchpad handling (had that a while back but took it out to keep things confined)
  • Allow gestures on non layer-surfaces (e.g. to swipe close running applications)

This is based on !343 (merged) and !342 (merged) which would be great to have merged make things more trackable with the other MRs I'm carrying to address the above.

The gesture recognition borrows heavily on what GTK does and the example is based on wlroots layer-surface example.

Closes: #82 (closed), #27 (closed)

Edited by Guido Günther

Merge request reports