diff --git a/docs/dnd-protocol.rst b/docs/dnd-protocol.rst index f4023d749..7b5cef9d2 100644 --- a/docs/dnd-protocol.rst +++ b/docs/dnd-protocol.rst @@ -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:: diff --git a/kitty/dnd.c b/kitty/dnd.c index 8c9e2c848..18e46ae54 100644 --- a/kitty/dnd.c +++ b/kitty/dnd.c @@ -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 diff --git a/kitty/dnd.h b/kitty/dnd.h index 1b77e390b..a9ef00e1b 100644 --- a/kitty/dnd.h +++ b/kitty/dnd.h @@ -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); diff --git a/kitty/screen.c b/kitty/screen.c index cecaf438d..d764a6bd8 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -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; } }