Repository navigation
gtk: implement drag-to-move for splits - #10423
Conversation
e23343f to
6fc7f7d
Compare
|
After playing around a bit, I got this panic when exiting Ghostty: |
|
Hmm.. what does the font grid have to do with any of this...? |
6666b57 to
04deac3
Compare
|
Hang on. Why is the surface not getting deinit'd when the whole app closes? This is sus. Lemme think about this |
|
I think I realized why - the content provider is constantly holding a stale ref to the surface, so the surfaces themselves are actually never unref'd. Good thing we had an assert there, since otherwise we could have had a gigantic leak |
|
Hmm.. Resolving this turned out to be much more difficult than imagined. The GLib APIs I've been given here aren't really flexible enough, so I might need to wait for us to assign each surface a unique ID and then make the split tree fully ID-based instead of holding pointers to the RtSurface structs, to fully sidestep the refcounting mechanism. Gonna mark this as draft for now. Blocked on #8200 or a functional equivalent |
Adds a move_split action (up/down/left/right) that swaps the active split with its nearest spatial neighbor, scoped to the current split tree so splits can't be moved across tabs or windows. GTK-only; no default keybind is set, bind it yourself e.g. `keybind = alt+shift+h=move_split:left`. The tree-manipulation core (SplitTree.moveSplit, plus a locate() helper on the datastruct split tree) is adapted from upstream's in-progress mouse drag-and-drop implementation (ghostty-org#10423, itself a GTK port of macOS PR ghostty-org#10090), but exposed here via a keybind instead of a drag handle, per issue ghostty-org#10224. Plumbing follows the existing goto_split action end-to-end: a new MoveSplit C-ABI enum in apprt/action.zig + include/ghostty.h (appended at the end for ABI compatibility), a Binding.zig keybind action and command palette entries, and dispatch through Surface.zig into the gtk apprt.
One major todo is moving splits across different split trees (i.e. moving across tabs and windows), but that would involve a lot more logic. This MVP version works for now. GTK version of ghostty-org#10090 Closes ghostty-org#10224
04deac3 to
98fae16
Compare
|
Wouldn't you know it, switching to u64 IDs fixed all the issues completely :bobr: |
jcollie
left a comment
There was a problem hiding this comment.
Nifty! Now the GTK devs can get people complaining about the drag handle too! One nice thing to have might be is suppressing the drag handle when there's only one split but I won't block this PR for that.
One major todo is moving splits across different split trees (i.e. moving across tabs and windows), but that would involve a lot more logic. This MVP version works for now.
Video demo (somehow the encode quality is terrible - I'll fix this later):
2026-01-24.01-13-44.mp4
GTK version of #10090
Closes #10224