More work on the DnD protocol

This commit is contained in:
Kovid Goyal 2026-04-08 19:19:20 +05:30
parent 348151c457
commit 702f9905d2
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
4 changed files with 14 additions and 3 deletions

View file

@ -293,9 +293,10 @@ code. The variants are listed in the table below:
The client program should respond to data requests with escape codes of the
form::
OSC _dnd_code ; t=e:m=0 or 1 ; base64 encoded data ST
OSC _dnd_code ; t=e:y=idx:m=0 or 1 ; base64 encoded data ST
This, is the data for requested MIME type. The data should be chunkedusing the
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
occurs the client should send::

View file

@ -1098,6 +1098,10 @@ drag_get_data(Window *w, const char *mime_type, size_t *sz, int *err_code) {
return NULL;
}
void
drag_process_item_data(Window *w, size_t idx, int has_more, const uint8_t *payload, size_t payload_sz) {
(void)w; (void)idx; (void)has_more; (void)payload; (void)payload_sz;
}
#undef img
#undef abrt
#undef ds

View file

@ -34,3 +34,4 @@ void drag_start(Window *w);
void drag_notify(Window *w, DragNotifyType type);
int drag_free_data(Window *w, const char *mime_type, const char* data, size_t sz);
const char* drag_get_data(Window *w, const char *mime_type, size_t *sz, int *err_code);
void drag_process_item_data(Window *w, size_t idx, int has_more, const uint8_t *payload, size_t payload_sz);

View file

@ -1566,7 +1566,12 @@ screen_handle_dnd_command(Screen *self, const DnDCommand *cmd, const uint8_t *pa
if (cmd->cell_x >= 0) drag_change_image(w, cmd->cell_x);
else drag_start(w);
} break;
case 'e': {
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);
} break;
}
}