Add cancelling of current drag offer

This commit is contained in:
Kovid Goyal 2026-04-08 20:49:10 +05:30
parent 87381e1c2d
commit 3fb748e3db
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
2 changed files with 12 additions and 3 deletions

View file

@ -297,14 +297,18 @@ form::
This, is the data for the MIME type identified by ``idx`` which is a zero based
index into the list of MIME types. The data should be chunkedusing the
``m`` key. End of data is denoted by ``m=0`` and an rmpty payload. If an error
``m`` key. End of data is denoted by ``m=0`` and an empty payload. If an error
occurs the client should send::
OSC _dnd_code ; t=E; ERR_CODE ST
OSC _dnd_code ; t=E:y=idx ; ERR_CODE ST
Where ``ERR_CODE`` is a POSIX error code such as ``ENOENT`` if the MIME type is
not found or ``EIO`` if an IO error occurred and so on.
If the client wants to cancel the full drag at any time, it should send:
OSC _dnd_code ; t=E:y=-1 ST
Multiplexers
-----------------

View file

@ -1570,7 +1570,12 @@ screen_handle_dnd_command(Screen *self, const DnDCommand *cmd, const uint8_t *pa
drag_process_item_data(w, cmd->cell_y, cmd->more, payload, cmd->payload_sz);
} break;
case 'E': {
drag_process_item_data(w, cmd->cell_y, -1, payload, cmd->payload_sz);
if (cmd->cell_y == -1) {
drag_free_offer(w);
if (global_state.drag_source.is_active && global_state.drag_source.from_window == w->id) {
cancel_current_drag_source();
}
} else drag_process_item_data(w, cmd->cell_y, -1, payload, cmd->payload_sz);
} break;
}
}