Commit Graph

11617 Commits

Author SHA1 Message Date
Mitchell Hashimoto
4afd3445c4 split_tree: fix bugs for 0/1 sized ratios 2025-08-12 10:46:43 -07:00
Mitchell Hashimoto
2bcc2fa4bd split_tree: resize function 2025-08-11 12:52:16 -07:00
Mitchell Hashimoto
a94bd8f5c4 gtk-ng: don't use signals to toggle command palette (#8182) 2025-08-11 12:02:48 -07:00
Jeffrey C. Ollie
5bb88d259c gtk-ng: use WeakRef helper for type safety 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
2de0c108ba gtk-ng: better handling of weak references
The upstream GIR for g_weak_ref_get is incorrect - it does not allow the
returned value to be NULL. This PR pulls in a new version of our GObject
bindings with that patched and improves the safety of dealing with the
command palette weak reference held by the window.

See ianprime0509/zig-gobject#117
2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
5c088d10a4 gtk-ng: fix memory leaks in command palette 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
3221421a74 gtk-ng: add TODOs about passing surface that toggled command palette 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
8af1230228 gtk-ng: don't add extra refs when activating a command in the palette 2025-08-11 11:56:08 -07:00
Jeffrey C. Ollie
2a5b7aab86 gtk-ng: don't use signals to toggle command palette 2025-08-11 11:56:08 -07:00
Mitchell Hashimoto
21a9760ff5 apprt/gtk-ng: equalize splits (#8211)
Fixes known issues from #8202. Also brings in the better equalization
logic on macOS from #7710.
2025-08-11 11:39:19 -07:00
Mitchell Hashimoto
9f037a7c23 apprt/gtk-ng: equalize splits 2025-08-11 11:35:13 -07:00
Mitchell Hashimoto
a21b447c75 apprt/gtk-ng: goto_split (including spatial navigation for the first time for our GTK backend) (#8210)
This continues #8202 by fixing two of the known issues: `goto_split` key
binds work and closing a split moves focus to the proper place.

A big improvement in this PR is that for the first time ever in our GTK
backend, the up/down/left/right `goto_split` bindings **use spatial
navigation.** "Spatial navigation" means that the direction to move
focus is done based on the nearest split _visually_ from the current
split, rather than via a tree traversal. We did this on macOS a couple
months ago, with a lot more details there: #7523

Similar to macOS, the spatial navigation is currently based on top-left
corner. Now that our split tree is implemented in Zig though it should
be a lot easier for us to work in the current cursor position as the
reference point.

~~🚧 TODO: Going to add some unit tests for the spatial navigation before
merge.~~
2025-08-11 11:04:06 -07:00
Mitchell Hashimoto
43c3150e81 split_tree: unit tests for spatial nav, fix a bug 2025-08-11 10:59:37 -07:00
Mitchell Hashimoto
5a01877c77 apprt/gtk-ng: spatial navigation 2025-08-11 10:17:13 -07:00
Mitchell Hashimoto
70d48d03a5 apprt/gtk-ng: go to right focus when split closes 2025-08-11 09:51:58 -07:00
Mitchell Hashimoto
5903d7d10f apprt/gtk-ng: hook up goto_split 2025-08-11 09:44:13 -07:00
Mitchell Hashimoto
984435d7ea split_tree: deepest, previous, next traversals 2025-08-11 09:30:59 -07:00
Mitchell Hashimoto
9f959ea876 gtk-ng: fix split-divider-color config (#8209) 2025-08-11 08:38:28 -07:00
Jeffrey C. Ollie
b726183981 gtk-ng: fix split-divider-color config 2025-08-11 10:28:54 -05:00
Mitchell Hashimoto
a9a41aec83 apprt/gtk-ng: create/close split functionality (#8202)
This adds on to our existing foundations from #8165 and adds the ability
to create and close splits. We're still missing split navigation,
resizing via keybindings, etc. And there are a number of known issues
(listed below). But this is a strict improvement from where we're at and
includes a number of important bug fixes to our split tree.

The only nasty thing in this PR is that I learned that GTK _did not
like_ rebuilding our split widget tree on every data model change. I
don't know enough about how all the re-parenting plus size allocation
interactions work together. As a compromise, this PR adds a listener,
waits for our surface tree to "settle" by having all surfaces have no
parents, then schedules a single rebuild after that. This works well,
but results in some noticeable flashing for a frame or so. I think we
can improve this later, it works completely well enough.

Importantly, all of this is Valgrind clean. I long suspected our splits
on legacy are NOT free of leaks, but never proved it, so this makes me
happy.

## Demo



https://github.com/user-attachments/assets/e231d89f-581e-486b-ade0-1d7e6795262e



## Known Issues

I may fix this in this PR, I may follow up.

- [ ] Focus doesn't go to the right place after closing a split
- [x] Divider with a transparent background is transparent
- [x] Close split doesn't show any close confirmation dialog
- Missing features:
  * [ ] Equalize splits
  * [ ] Resize splits keybind (manual mouse action works fine)
  * [ ] Go to split keybind
2025-08-11 08:25:38 -07:00
Mitchell Hashimoto
edd73fa0e4 font/freetype: convert encoding of font names (#8204)
Freetype encodes some font names internally in formats other than UTF-8.
This only affects debug logs but it was annoying me so I fixed it. There
may be other encodings that might need to be dealt with but I took care
of the one that I ran across.
2025-08-10 19:55:35 -07:00
Mitchell Hashimoto
dd983d112d gtk-ng: sync action accelerators for split-tree (#8207) 2025-08-10 19:55:22 -07:00
Jeffrey C. Ollie
aba5a34335 gtk-ng: sync action accelerators for split-tree 2025-08-10 21:31:50 -05:00
Jeffrey C. Ollie
e9e32d71e4 font/freetype: add a test for face name decoding using embedded fonts 2025-08-10 20:10:24 -05:00
Jeffrey C. Ollie
897d70982e font/freetype: convert encoding of font names
Freetype encodes some font names internally in formats other than UTF-8.
This only affects debug logs but it was annoying me so I fixed it. There
may be other encodings that might need to be dealt with but I took care
of the one that I ran across.
2025-08-10 17:29:31 -05:00
Mitchell Hashimoto
ca4e38ff03 apprt/gtk-ng: split close confirmation 2025-08-10 13:35:30 -07:00
Mitchell Hashimoto
441af8389b apprt/gtk-ng: split separator styling 2025-08-10 13:09:06 -07:00
Mitchell Hashimoto
0aaf80402b Update iTerm2 colorschemes (#8195)
Upstream revision:
3cbeca99ef
2025-08-10 12:52:48 -07:00
Mitchell Hashimoto
46560d0018 apprt/gtk-ng: wait for unparent to rebuild split tree 2025-08-10 12:36:28 -07:00
mitchellh
c64701e744 deps: Update iTerm2 color schemes 2025-08-10 00:15:37 +00:00
Mitchell Hashimoto
b1da644b62 apprt/gtk-ng: unnecessary grab focus 2025-08-09 14:48:42 -07:00
Mitchell Hashimoto
e682e99bf5 apprt/gtk-ng: hook up win split actions 2025-08-09 14:36:50 -07:00
Mitchell Hashimoto
aed6a3a343 apprt/gtk-ng: clean up some changed handlers 2025-08-09 14:24:25 -07:00
Mitchell Hashimoto
ec293c1fd0 apprt/gtk-ng: active surface hookups 2025-08-09 13:49:36 -07:00
Mitchell Hashimoto
8232cf33b4 apprt/gtk-ng: surface close in split tree 2025-08-09 12:36:27 -07:00
Mitchell Hashimoto
a28d673467 update supps 2025-08-09 12:24:40 -07:00
Mitchell Hashimoto
9ad92d2c3d apprt/gtk-ng: proper split operations 2025-08-09 12:21:28 -07:00
Mitchell Hashimoto
34be4de018 apprt/gtk-ng: write back split ratio to tree 2025-08-09 12:19:10 -07:00
Mitchell Hashimoto
e396d9d78d apprt/gtk-ng: setup gtk paned listeners to set position 2025-08-09 07:27:11 -07:00
Mitchell Hashimoto
a3c041bcb4 apprt/gtk-ng: keep track of last focused surface 2025-08-08 15:14:41 -07:00
Mitchell Hashimoto
517f17995c apprt/gtk-ng: rebuild the widget tree on an idle callback 2025-08-08 14:38:02 -07:00
Mitchell Hashimoto
fbe28477ff datastruct: fix split tree ascii diagram 2025-08-08 14:22:38 -07:00
Mitchell Hashimoto
75dd8e46b5 datastruct: fix split tree debug log rounding 2025-08-08 14:22:38 -07:00
Mitchell Hashimoto
ae5dc3a4fb apprt/gtk-ng: split tree new split actions 2025-08-08 14:22:38 -07:00
Mitchell Hashimoto
4742177daa apprt/gtk-ng: template callbacks can't return bool, must be c_int (#8186)
This fixes the tab bar showing the window controls sometimes.
2025-08-08 13:39:46 -07:00
Mitchell Hashimoto
5bf8f12cf0 apprt/gtk-ng: template callbacks can't return bool, must be c_int
This fixes the tab bar showing the window controls sometimes.
2025-08-08 13:36:08 -07:00
Mitchell Hashimoto
8ae72d5f7f apprt/gtk-ng: set resize overlay label in the idle callback (#8185)
This avoids jitter when resizing splits. I didn't see any jitter before
splits but conceptually its possible. The issue is that since we're
updating the overlay DURING A RESIZE, changing the dimensions of any
part of the widget tree causes GTK warnings and a bunch of laggy
updates.

Instead, we copy the label text to a property and update it on the idle
callback along with everything else. This also provides a natural
debounce to the label.
2025-08-08 13:14:13 -07:00
Mitchell Hashimoto
8e073505f7 apprt/gtk-ng: set resize overlay label in the idle callback
This avoids jitter when resizing splits. I didn't see any jitter before
splits but conceptually its possible. The issue is that since we're
updating the overlay DURING A RESIZE, changing the dimensions of any
part of the widget tree causes GTK warnings and a bunch of laggy
updates.

Instead, we copy the label text to a property and update it on the idle
callback along with everything else. This also provides a natural
debounce to the label.
2025-08-08 12:59:54 -07:00
Mitchell Hashimoto
729b8f9c2d apprt/gtk-ng: add proper setters for surface properties (#8184)
This also fixes a bug where we were setting custom cursors on the wrong
gtk widget, this showed up most terribly with `mouse-hide-while-typing`
where the mouse would never reappear.
2025-08-08 12:36:42 -07:00
Mitchell Hashimoto
17101294aa gtk-ng: add "title bar styles" (#8166)
This PR adds a "tabs" title bar style similar to the macOS title bar
style. When `gtk-titlebar-style=tabs` the title bar and the tab bar will
be merged together.

The config entry for controlling this is kept separate from macOS as
macOS has more styles defined that don't map to a GTK title bar style
and it's likely that users that use both macOS and GTK would want
different settings for each platform.

<img width="922" height="722" alt="Screenshot From 2025-08-06 16-38-28"
src="https://github.com/user-attachments/assets/3c2db235-695a-457e-9c96-5039120263fc"
/>
2025-08-08 12:34:21 -07:00