fix: allow drag-dropping tabs into single-pane workspaces#78
Open
bvolpato wants to merge 3 commits into
Open
Conversation
The drag-and-drop plumbing for moving tabs between workspaces was already in place, but dropping a tab onto a workspace with only a single pane (no splits) silently failed. Root cause: handle_tab_drop_to_workspace calls find_leaf_pane to locate a target pane widget inside the destination workspace. workspace.root is a SplitTreeContainer bin (a gtk::Box). For workspaces with splits, the bin contains a gtk::Paned, so find_leaf_pane correctly descends into it. But for single-pane workspaces, the bin contains the pane widget directly, and find_leaf_pane was treating the bin itself as a leaf pane. This caused pane::move_tab_to_pane to fail because the bin doesn't have PaneInternals. Fix: in find_leaf_pane, when we encounter a gtk::Box that is not a pane widget, descend into its first child instead of returning the box as a leaf.
826c4bb to
64347a5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: Dragging and dropping a tab onto another workspace only worked when the destination workspace had split panes. For single-pane workspaces, the drop silently failed.
Root cause:
handle_tab_drop_to_workspacecallsfind_leaf_pane(&workspace.root, ...)to locate a target pane widget.workspace.rootis aSplitTreeContainerbin (agtk::Box). For workspaces with splits, the bin contains agtk::Paned, sofind_leaf_panecorrectly descends into it. But for single-pane workspaces, the bin contains the pane widget directly, andfind_leaf_panewas treating the bin itself as a leaf pane. This causedpane::move_tab_to_paneto fail because the bin doesn't havePaneInternals.Fix: In
find_leaf_pane, when encountering agtk::Boxthat is not a pane widget, descend into its first child instead of returning the box as a leaf. The regression test now uses pane-shaped fixtures and asserts exact returned leaf widgets.Verification:
cargo check -p limux-host-linuxcompiles cleanly in CIlimux-host-linuxunit tests pass in CIqualitycheck passes: fmt, clippy, all workspace tests