From 66e667b0961ef80e4f95b29f5772e1a8127a4c70 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 16 May 2026 10:29:53 +0000 Subject: [PATCH] fix: send drag leave/enter events when crossing kitty window boundaries during DnD Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/6aeadc64-7167-4cdb-bafd-8b680cef5d2d Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com> --- kitty/glfw.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kitty/glfw.c b/kitty/glfw.c index ecb4f11d1..54f957543 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -801,6 +801,13 @@ drop_dest_callback(GLFWwindow *window, GLFWDropEvent *ev) { os_window->last_drag_event.x = (int)(ev->xpos * os_window->viewport_x_ratio); os_window->last_drag_event.y = (int)(ev->ypos * os_window->viewport_y_ratio); on_mouse_position_update(ev->xpos, ev->ypos); + // Re-evaluate which kitty window is now under the cursor after the + // position update, so that drag enter/leave events are sent to the + // correct kitty window when the drag crosses a kitty window boundary + // within the same OS window. + wid = global_state.mouse_hover_in_window; + w = wid ? window_for_window_id(wid) : NULL; + is_client_drop = !is_kitty_ui_drag && wid && w && w->drop.wanted; global_state.drop_dest.allowed_ops = ev->operation.source_actions; if (is_client_drop) { if (!w->drop.initialized) {