mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-05-13 08:26:56 +00:00
Ensure drag finish timer doesnt fire will waiting for remote item data
This commit is contained in:
parent
9c29c612a5
commit
c2a7225657
2 changed files with 7 additions and 1 deletions
|
|
@ -4462,7 +4462,11 @@ _glfwPlatformStartDrag(_GLFWwindow* window, const GLFWimage* thumbnail) {@autore
|
|||
- (bool)is_mimetype:(const char*)q { return strcmp(q, mimeType) == 0; }
|
||||
|
||||
- (void)promised_data_ready:(const char*)path sz:(size_t)sz type:(int)type {
|
||||
(void)sz;
|
||||
if (drag_finish_timer) {
|
||||
[drag_finish_timer invalidate];
|
||||
drag_finish_timer = nil;
|
||||
}
|
||||
if (path == NULL) return; // progress update
|
||||
if (file_handle) [file_handle release];
|
||||
file_handle = nil;
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
|
|
|
|||
|
|
@ -1666,6 +1666,7 @@ static int
|
|||
notify_drag_data_received(Window *w, size_t uri_item_idx, const char *basename, int type) {
|
||||
char mime_type[128], path[4096];
|
||||
snprintf(mime_type, sizeof(mime_type), "kitty-internal/uri-list-item-%zu", uri_item_idx);
|
||||
if (!basename || !basename[0]) notify_drag_data_ready(global_state.drag_source.from_os_window, mime_type, NULL, 0, type);
|
||||
int sz = snprintf(path, sizeof(path), "%s/%zu/%s", ds.base_dir_for_remote_items, uri_item_idx, basename);
|
||||
return notify_drag_data_ready(global_state.drag_source.from_os_window, mime_type, path, sz, type);
|
||||
}
|
||||
|
|
@ -2251,6 +2252,7 @@ drag_remote_file_data(
|
|||
}
|
||||
if (promise_item_idx == ds.file_promises_count + 1) abrt(EINVAL, "drag source file promise uri list index out of bounds");
|
||||
ri = &ds.file_promises[promise_item_idx].ri;
|
||||
notify_drag_data_received(w, uri_item_idx, "", ri->type);
|
||||
} else {
|
||||
if (uri_item_idx >= mi.num_remote_items) abrt(EINVAL, "drag source uri list index out of bounds");
|
||||
ri = mi.remote_items + uri_item_idx;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue