From e72f49952d7f35c153f46763a159a289b9b91a6e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 13 Mar 2026 20:19:33 +0530 Subject: [PATCH] Linux: Fix regression that broke drag and drop from GTK applications Fixes #9656 --- docs/changelog.rst | 2 ++ glfw/wl_window.c | 2 +- kitty/glfw.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f90bfb2de..ad743dab4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -182,6 +182,8 @@ Detailed list of changes - Wayland: Fix momentum scrolling not working on compositors that send a stop frame with no axis information (:iss:`9653`) +- Linux: Fix regression that broke drag and drop from GTK applications (:iss:`9656`) + 0.46.0 [2026-03-11] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 1ebeeea83..1d00917dd 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -2577,7 +2577,7 @@ _glfwPlatformReadAvailableDropData(GLFWwindow *w, GLFWDropEvent *ev, char *buffe for (size_t o = 0; o < offer->dd_count; o++) { if (offer->requested_drop_data[o].fd == fd) { ssize_t ret; - do { ret = read(fd, buffer, sz); } while (ret < 0 && errno == EINTR); + do { ret = read(fd, buffer, sz); } while (ret < 0 && (errno == EINTR || errno == EAGAIN)); if (ret <= 0) removeWatch(&_glfw.wl.eventLoopData, offer->requested_drop_data[o].watch_id); return ret < 0 ? -errno : ret; } diff --git a/kitty/glfw.c b/kitty/glfw.c index a85044cfa..9b98d74d1 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -729,7 +729,7 @@ update_allowed_mimes_for_drop(GLFWDropEvent *ev) { } } if (prio_arr != priorities) free(prio_arr); - ev->num_mimes = remove_duplicate_mimes(ev->mimes, new_count); + ev->num_mimes = new_count; } } @@ -799,6 +799,7 @@ on_drop(GLFWwindow *window, GLFWDropEvent *ev) { break; } update_allowed_mimes_for_drop(ev); + ev->num_mimes = remove_duplicate_mimes(ev->mimes, ev->num_mimes); global_state.drop_dest.num_left = ev->num_mimes; if (!global_state.drop_dest.num_left || !(global_state.drop_dest.data = PyDict_New())) { ev->finish_drop(window, GLFW_DRAG_OPERATION_GENERIC);