diff --git a/kitty/boss.py b/kitty/boss.py index aa70b5d9d..f3a4a02e1 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -1893,7 +1893,7 @@ class Boss: if tm is not None: tm.update_tab_bar_data() - def on_drop_move(self, os_window_id: int, x: int, y: int, from_self: bool) -> None: + def on_drop_move(self, os_window_id: int, x: int, y: int, from_self: bool, is_leave: bool) -> None: if (tm := self.os_window_map.get(os_window_id)) is None: return if from_self: @@ -1901,10 +1901,10 @@ class Boss: if tab_id and drag_started and (tab := self.tab_for_id(tab_id)): central, tab_bar = viewport_for_window(os_window_id)[:2] in_tab_bar = tab_bar.left <= x < tab_bar.right and tab_bar.top <= y < tab_bar.bottom - detach = not in_tab_bar or tab.os_window_id != tm.os_window_id + detach = not in_tab_bar or tab.os_window_id != tm.os_window_id or is_leave change_drag_thumbnail(tab.os_window_id, 1 if detach else 0, detach) for q in self.all_tab_managers: - is_dest = q is tm and (in_tab_bar or os_window_id != tab.os_window_id) + is_dest = q is tm and (in_tab_bar or os_window_id != tab.os_window_id) and not is_leave q.on_tab_drop_move(tab_id, is_dest, x, y) def on_drop(self, os_window_id: int, drop: dict[str, bytes] | int, from_self: bool, x: int, y: int) -> None: diff --git a/kitty/glfw.c b/kitty/glfw.c index 604b41dcf..94e043f39 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -731,14 +731,17 @@ on_drop(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); - call_boss(on_drop_move, "KiiO", + call_boss(on_drop_move, "KiiOO", os_window->id, os_window->last_drag_event.x, os_window->last_drag_event.y, - ev->from_self ? Py_True : Py_False); + ev->from_self ? Py_True : Py_False, Py_False); /* fallthrough */ case GLFW_DROP_STATUS_UPDATE: update_allowed_mimes_for_drop(ev); break; case GLFW_DROP_LEAVE: + call_boss(on_drop_move, "KiiOO", + os_window->id, os_window->last_drag_event.x, os_window->last_drag_event.y, + ev->from_self ? Py_True : Py_False, Py_True); break; case GLFW_DROP_DROP: Py_CLEAR(global_state.drop_dest.data);