From e186965bda3dbc9d78c90ac73549e589c761bd7c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 7 Feb 2026 15:12:54 +0530 Subject: [PATCH] ... --- kitty/glfw.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/kitty/glfw.c b/kitty/glfw.c index 74944e2f2..789d1693c 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -746,16 +746,9 @@ drop_callback(GLFWwindow *w, GLFWDropData *drop, bool from_self) { int num_mimes; const char** mimes = glfwGetDropMimeTypes(drop, &num_mimes); RAII_PyObject(ans, PyDict_New()); - if (from_self && global_state.drag_source.drag_data) { - // For self-drops, copy data directly from drag_source.drag_data - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next(global_state.drag_source.drag_data, &pos, &key, &value)) { - if (PyDict_SetItem(ans, key, value) != 0) break; - } - } else { - get_mime_data(drop, mimes, num_mimes, ans); - } + if (from_self) { + if (global_state.drag_source.drag_data) PyDict_Update(ans, global_state.drag_source.drag_data); + } else get_mime_data(drop, mimes, num_mimes, ans); RAII_PyObject(exc, PyErr_GetRaisedException()); glfwFinishDrop(drop, GLFW_DRAG_OPERATION_COPY, true); if (!set_callback_window(w)) return;