Some docs

This commit is contained in:
Kovid Goyal 2026-03-06 10:32:45 +05:30
parent b0e57b4dce
commit fba67322d6
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 15 additions and 1 deletions

View file

@ -51,6 +51,18 @@ code::
to inform the terminal that it no longer wants drops.
Whenever the user drags something over the window, the terminal will send an
escape code of the form::
OSC _dnd_code ; t=m:x=x:y=y:X=X:Y=Y ; optional MIME list ST
Here, ``x, y`` identify the cell over which the drag is currently present.
The ``(0, 0)`` cell is at top left of the screen. ``X and Y`` are the pixel
offsets from the top-left. The optional list of MIMES is a space separated
list of MIME types that are available for dropping. To avoid overhead, the
terminal should only send this list for the first move event and subsequently
only if the list changes.
Metadata reference
---------------------------
@ -63,6 +75,7 @@ Key Value Default Description
``t`` Single character. ``a`` The type of drag and drop event.
``(a, A, ``a`` - start accepting drops
)`` ``A`` - stop accepting drops
``m`` - a drop move event
``m`` Chunking indicator ``0`` ``0`` or ``i``

View file

@ -7,6 +7,7 @@
#include "dnd.h"
#include "base64.h"
#include "control-codes.h"
static void
drop_free_offered_mimes(Window *w) {
@ -124,7 +125,7 @@ drop_move_on_child(Window *w, const char** mimes, size_t num_mimes) {
// we simply drop this event if there is too much data being written to the child
if (w->drop.pending.count) return;
char buf[128];
int header_size = snprintf(buf, sizeof(buf), "\x1b]%d;i=%u:t=m:x=%u:y=%u:X=%d:Y=%d", w->drop.client_id,
int header_size = snprintf(buf, sizeof(buf), "\x1b]%d;i=%u:t=m:x=%u:y=%u:X=%d:Y=%d", DND_CODE, w->drop.client_id,
w->mouse_pos.cell_x, w->mouse_pos.cell_y, (int)w->mouse_pos.global_x, (int)w->mouse_pos.global_y);
if (mimes_total_size) {
mimes_total_size += 1;