Skip to content

Commit 8d069d3

Browse files
committed
More dnd protocol docs
1 parent 5a8132d commit 8d069d3

2 files changed

Lines changed: 36 additions & 11 deletions

File tree

docs/dnd-protocol.rst

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,29 @@ There is one central escape code used for this protocol, which is of the form::
1111

1212
OSC _dnd_code ; metadata ; base64 encoded payload ST
1313

14-
Here, ``OSC`` is the bytes ``ESC ] (0x1b 0x5b)``. The ``metadata`` is a colon
15-
separated list of ``key=value`` pairs. The final part of the escape code is the
16-
:rfc:`base64 <4648>` encoded payload data, whose meaning depends on the
17-
metadata. The payload must be no more than 4096 bytes *before base64 encoding*.
14+
Here, ``OSC`` is the bytes ``ESC ] (0x1b 0x5b)`` and ST is ``ESC \\ (0x1b 0x5c)``.
15+
The ``metadata`` is a colon separated list of ``key=value`` pairs.
16+
The final part of the escape code is the :rfc:`base64 <4648>` encoded payload data,
17+
whose meaning depends on the metadata.
18+
19+
The payload must be no more than 4096 bytes encoded bytes. 4096 is the limit to
20+
be applied after encoding. When the payload is larger than 4096 base64 encoded
21+
bytes, it is chunked up using the ``m`` key. An escape code that has a too long
22+
payload is transmitted in chunks. All but the last chunk must have ``m=1`` in
23+
their metadata. Each chunk must have a payload of no more than 4096 base64
24+
encoded bytes without trailing padding, except the last chunk which may
25+
optionally have trailing padding. Only the first chunk is guaranteed to have
26+
metadata other than the ``m`` key. Subsequent chunks may optionally omit all
27+
metadata except the ``m`` and ``i`` keys.
28+
29+
All integer values used in this escape code must be 32-bit signed or unsigned
30+
integers encoded in decimal representation.
1831

1932
Accepting drops
2033
-----------------
2134

2235
In order to inform the terminal emulator that the program accepts drops, it
23-
must, send the following escape code::
36+
must send the following escape code::
2437

2538
OSC _dnd_code ; t=a ; payload ST
2639

@@ -45,10 +58,21 @@ take, and the default value they take when missing. All integers are 32-bit.
4558
======= ==================== ========= =================
4659
Key Value Default Description
4760
======= ==================== ========= =================
48-
``t`` Single character. ``a`` The overall action this graphics command is performing.
49-
``(a, A, ``t`` - transmit data, ``T`` - transmit data and display image,
50-
)`` ``q`` - query terminal, ``p`` - put (display) previous transmitted image,
51-
``d`` - delete image, ``f`` - transmit data for animation frames,
52-
``a`` - control animation, ``c`` - compose animation frames
53-
61+
``t`` Single character. ``a`` The type of drag and drop event.
62+
``(a, A, ``a`` - start accepting drops
63+
)`` ``A`` - stop accepting drops
64+
65+
``m`` Chunking indicator ``0`` ``0`` or ``i``
66+
67+
``i`` Postive integer ``0`` This id is for use by multiplexers.
68+
When it is set, all responses from
69+
the terminal in that session will
70+
have it set to the same value.
71+
**Keys for location**
72+
-----------------------------------------------------------
73+
``x`` Positive integer ``0`` Cell x-coordinate origin is 0, 0 at top left of screen
74+
``y`` Positive integer ``0`` Cell y-coordinate origin is 0, 0 at top left of screen
75+
``X`` Integer ``0`` Pixel x-coordinate origin is 0, 0 at top left of screen
76+
``Y`` Integer ``0`` Pixel y-coordinate origin is 0, 0 at top left of screen
77+
======= ==================== ========= =================
5478

docs/protocol-extensions.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ please do so by opening issues in the `GitHub bug tracker
2828
graphics-protocol
2929
keyboard-protocol
3030
text-sizing-protocol
31+
dnd-protocol
3132
multiple-cursors-protocol
3233
file-transfer-protocol
3334
desktop-notifications

0 commit comments

Comments
 (0)