Commit Graph

12112 Commits

Author SHA1 Message Date
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
Qwerasd
8c7538e996 font/freetype: port improved raster logic from CoreText
We now also have absolute perfect control over the raster position under
FreeType as well. This means that, for example, powerline extended chars
are appropriately clamped to the cell edges at all sizes.

This should be purely an improvement over what we had before, and now it
also matches what we do for CoreText.
2025-08-10 19:59:52 -06: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
Qwerasd
5383cd9c9c font/freetype: pass monochrome load flag when needed
The monochrome hinter is very aggressive but makes text actually look
tolerable when rendered in monochrome. If for some god forsaken reason
we get complaints about this, that someone wanted improperly hinted mono
glyphs, we can introduce additonal configuration; but for now, this is
just a straight improvement.
2025-08-10 16:04:54 -06:00
Qwerasd
20a9a3a8c2 font: use adjusted cell width for recentering again
The old method was nice, but had an issue that's intractible without
significant reworking in how we do shaping: combining glyphs need to
position relative to the glyph they're combining with, but if we re-
center that glyph, it will be off by some amount.
2025-08-10 15:49:54 -06:00
Qwerasd
195cbb6a1c Revert "font/Metrics: remove original_cell_width, no longer needed"
This reverts commit 23cc50b12c.
2025-08-10 15:33:47 -06:00
Qwerasd
f56219be95 font/coretext: fix glyph position/scale code
Apologies to Apple, the previous comments in this section of the code
were not correct-- `shouldSubpixelQuantizeFonts` does pretty much what
the minimal documentation for it says it does, it simply quantizes the
position of the glyph and nothing more. Various bugs when testing while
writing the old code that led me to include those comments made me not
realize that the positioning is actually a lot simpler than it seems.

With this version of the positioning there are never any cut-off rows or
columns of pixels on the edges of anything and everything scales as it
should... I hope. I checked pretty thoroughly this time and I'm like 99%
sure this is correct in all cases.
2025-08-10 15:11:20 -06:00
Qwerasd
ee445d2915 font: compare font Index packed structs directly
Packed structs can be compared directly now, no need to convert them to
an int anymore.
2025-08-10 15:11:20 -06:00
Qwerasd
a8b9dd8dfc renderer: clean up, improve constraintWidth function 2025-08-10 14:54:51 -06: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
Mitchell Hashimoto
16e15554da apprt/gtk-ng: add proper setters for surface properties
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:30:22 -07:00
Jeffrey C. Ollie
cae60f7c29 gtk-ng: use single if expression instead of block 2025-08-08 13:36:45 -05:00
Jeffrey C. Ollie
0f67282dfa gtk-ng: add "title bar styles"
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.
2025-08-08 13:32:23 -05:00
Mitchell Hashimoto
2c0bb894b8 valgrind: GtkPopover suppressions (#8183)
We get a ton of leaks from GTK.PopOver when we run the steps given in
the suppression file. I don't see how this could be us since we don't
create or do anything with the popover manually; its simply defined in
the Blueprint file.

The leaks specifically only happen when a Popover shows a sub-menu.
Without that, everything is completely clean. So I actually suspect
there's some leaks in GTK related to this behavior (not sure if they're
on purpose not, a brief look at the code doesn't look like they're
reused).

I tried alternate approaches where we create the Popover AND/OR the
MenuModel in code without the Blueprint file and we get the same leaks.

I'm kind of suspicious about this one but don't see how we can do
anything about it, so I'm going to suppress for now. The suppression
file has detailed repro steps that people can use to hopefully test this
later.
2025-08-08 11:27:47 -07:00
Mitchell Hashimoto
17b4481767 fix: capture screenshot for app intents views as NSImage (#8180)
SwiftUI's ImageRenderer must not be called outside the main thread.

The `@MainActor` annotation is only relevant for our own code, not
for calls from frameworks. The machinations around Shortcuts end up
calling the displayRepresentation method outside the main thread.

By capturing the screenshot as NSImage, all data is retained and can
be processed outside the main thread.

Thread in Discord:
https://discord.com/channels/1005603569187160125/1403384231694172372
2025-08-08 10:25:56 -07:00
Mitchell Hashimoto
ef817cd267 valgrind: GtkPopover suppressions
We get a ton of leaks from GTK.PopOver when we run the steps given in
the suppression file. I don't see how this could be us since we don't
create or do anything with the popover manually; its simply defined in
the Blueprint file.
2025-08-08 10:16:02 -07:00
Alexander Lais
1f378e6775 fix: capture screenshot for app intents views as NSImage
SwiftUI's ImageRenderer must not be called outside the main thread.

The `@MainActor` annotation is only relevant for our own code, not
for calls from frameworks. The machinations around Shortcuts end up
calling the displayRepresentation method outside the main thread.

By capturing the screenshot as NSImage, all data is retained and can
be processed outside the main thread.
2025-08-08 16:53:26 +02:00
Mitchell Hashimoto
a0eb4285b2 build(deps): bump namespacelabs/nscloud-cache-action from 1.2.15 to 1.2.16 (#8175)
Bumps
[namespacelabs/nscloud-cache-action](https://github.com/namespacelabs/nscloud-cache-action)
from 1.2.15 to 1.2.16.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="305bfa7ea9"><code>305bfa7</code></a>
Merge pull request <a
href="https://redirect.github.com/namespacelabs/nscloud-cache-action/issues/31">#31</a>
from namespacelabs/niklas-new-pnpm</li>
<li><a
href="ca35d05e60"><code>ca35d05</code></a>
Do not touch node_modules in PNPM mode.</li>
<li>See full diff in <a
href="f2d0a9e9ed...305bfa7ea9">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=namespacelabs/nscloud-cache-action&package-manager=github_actions&previous-version=1.2.15&new-version=1.2.16)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>
2025-08-08 07:03:15 -07:00
Leah Amelia Chen
4d9d133ebc inspector: fix display for fractional pixel sizes (#8179) 2025-08-08 17:12:43 +08:00