From ef6539d6974be07d2aa1d2de04a2bd124281b501 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 15 May 2026 11:33:33 +0530 Subject: [PATCH] Propagate error when requesting drop data --- kitty/dnd.c | 8 +++++++- kitty/glfw.c | 5 +++-- kitty/state.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/kitty/dnd.c b/kitty/dnd.c index 1794671d6..42c22e3e1 100644 --- a/kitty/dnd.c +++ b/kitty/dnd.c @@ -668,7 +668,13 @@ do_drop_request_data(Window *w, int32_t idx) { } const char *mime = w->drop.offerred_mimes[idx - 1]; w->drop.getting_data_for_mime = strdup(mime); - if (w->drop.getting_data_for_mime) request_drop_data(osw, w->id, mime); + if (w->drop.getting_data_for_mime) { + int err = request_drop_data(osw, w->id, mime); + if (err) { + drop_send_error(w, err, "drop data request from OS failed"); + return true; + } + } return false; /* async: completion via drop_dispatch_data */ } diff --git a/kitty/glfw.c b/kitty/glfw.c index ba19ab58e..ecb4f11d1 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -776,10 +776,11 @@ register_mimes_for_drop(OSWindow *w, const char **mimes, size_t sz) { #endif } -void +int request_drop_data(OSWindow *w, id_type wid, const char* mime) { global_state.drop_dest.client_window_data_request = wid; - if (w->handle) glfwRequestDropData(w->handle, mime); + if (w->handle) return glfwRequestDropData(w->handle, mime); + return ENOENT; } static void diff --git a/kitty/state.h b/kitty/state.h index c50f11f2a..555b31c9d 100644 --- a/kitty/state.h +++ b/kitty/state.h @@ -642,7 +642,7 @@ void take_screenshot_of_rectangular_region(OSWindow *os_window, Region region, u bool current_framebuffer_is_ok(void); void request_drop_status_update(OSWindow *osw); void register_mimes_for_drop(OSWindow *w, const char **mimes, size_t sz); -void request_drop_data(OSWindow *w, id_type wid, const char* mime); +int request_drop_data(OSWindow *w, id_type wid, const char* mime); void cancel_current_drag_source(void); bool change_drag_image(int idx); int start_window_drag(Window *w, bool in_test_mode);