selection: implement support for drag-and-drop

We accept COPY and MOVE actions, for text/plain;charset=utf-8
mime-types.

To implement DnD, we need to track the current DnD data offer *and*
the terminal instance it is (currently) targeting.

To do this, a seat has a new member, ‘dnd_term’. On a DnD enter event,
we lookup the corresponding terminal instance and point ‘dnd_term’ to
it.

On a DnD leave event, ‘dnd_term’ is reset.

The DnD data offer is tracked in the terminal’s wayland window
instance. It is reset, along with the seat’s ‘dnd_term’ on a DnD leave
event.

On a drop event, we immediately clear the seat’s ‘dnd_term’, to ensure
we don’t reset it, or destroy the offer before the drop has been
completed.

The drop’s ‘done()’ callback takes care of destroying and resetting
the DnD offer in the terminal’s wayland window instance.

Closes #175
This commit is contained in:
Daniel Eklöf 2020-10-26 21:02:53 +01:00
parent af3b604d8e
commit 8e23b5b70d
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 98 additions and 5 deletions

View file

@ -45,6 +45,8 @@
`foot.ini`. These options allow custom bold/italic fonts. They are
unset by default, meaning the bold/italic version of the regular
font is used (https://codeberg.org/dnkl/foot/issues/169).
* Drag & drop support; text, files and URLs can now be dropped in a
foot terminal window (https://codeberg.org/dnkl/foot/issues/175).
### Changed