`zig-gobject` is a set of GObject bindings that allow us to write
GTK-facing code in Zig instead of getting hands dirty with C. It's been
tested and refined in real-life applications and several GTK
contributors agree that it is a marked improvement over using the C API
directly, such as allowing method call syntax and avoiding many manual
`@ptrCast`s.
This PR doesn't actually contain any changes to our preexisting GTK code
— the migration process is intended to begin in chunks, firstly in
self-contained components (e.g. the header bar, overlays, etc.), and
then full-scale migration can begin when we remove non-Adwaita GTK
builds for 1.2. (After all, why port code that you'll remove later
either way?)
`zig-gobject` is a set of GObject bindings that allow us to write
GTK-facing code in Zig instead of getting hands dirty with C.
It's been tested and refined in real-life applications and several
GTK contributors agree that it is a marked improvement over using
the C API directly, such as allowing method call syntax and avoiding
many manual `@ptrCast`s.
This commit doesn't actually contain any changes to our preexisting
GTK code — the migration process is intended to begin in chunks,
firstly in self-contained components (e.g. the header bar, overlays,
etc.), and then full-scale migration can begin when we remove non-Adwaita
GTK builds for 1.2. (After all, why port code that you'll remove later
either way?)
I don't have a machine locally that can reproduce the issue in #5597 but
have been working with @paperlib over Discord to try to narrow down the
cause. My fix in #5625 didn't fix the problem, so I'm *really* hoping
this patch does.
The problem presents as any text that matches the default bg color not
being rendered, regardless of the cell's bg color. The best I can figure
is that either we have some sort of accidental UB or there's a driver
bug (perhaps related to the addition of the `[[flat]]` interpolation
qualifier to the vertex out structure?), but I don't have a system
locally to iterate on to narrow it down.
This optimization is extremely niche and seems to be related to a
strange bug experienced by Intel Mac users. Considering it costs some
amount to have this extra check here even though it's false in the vast
majority of cases, I feel it's pretty safe to just remove it entirely.
Discrete GPUs cannot use the "shared" storage mode. This causes
undefined behavior right now, and I believe it's what's causing a
problem on Intel systems with discrete GPUs with "inverted" cells.
(Observed in discussion #5597)
This commit also sets the CPU cache mode to "write combined" for our
resources since we don't read them back so Metal can optimize them
further with this hint.
Discrete GPUs cannot use the "shared" storage mode. This causes
undefined behavior right now, and I believe it's what's causing a
problem on Intel systems with discrete GPUs with "inverted" cells.
This commit also sets the CPU cache mode to "write combined" for our
resources since we don't read them back so Metal can optimize them
further with this hint.
This commit introduces the proposed subsystem maintainer system for
Ghostty. This commit doesn't assign anyone yet to the subsystems, but
defines the CODEOWNERS file, creates the GitHub teams, and documents the
system.
We can discuss this in Discord, but any feedback is also welcome here.
This commit introduces the proposed subsystem maintainer system for
Ghostty. This commit doesn't assign anyone yet to the subsystems, but
defines the CODEOWNERS file, creates the GitHub teams, and documents the
system.
When cursor color matches the background color, the optimization that
skips rendering identical colors causes the character under cursor to
become invisible. This PR ensures characters at cursor position are
always rendered, maintaining cursor visibility regardless of color
settings.
<img width="1129" alt="image"
src="https://github.com/user-attachments/assets/b82387c1-2bfd-481d-b679-1a1f82d21bcb"
/>
cc @kpovel - Would you mind giving it a try? Any feedback would be
appreciated!
Fixes#5554
This PR ensures visibility toggling is ignored when the currently
focused surface is fullscreen. This includes the following:
- Show/Hide All Terminals is ignored
- Using a binding to toggle is ignored
This ensures Ghostty doesn't unexpectedly lose focus or disappear and is
the expected behavior on macOS.
Fixes#5558
Binding checks would sometimes trigger preedit which would cause some
characters to leak through.
This is a bit of a band-aid. The real long term solution is noted in the
TODO comment in this commit, but I wanted to avoid regressions in a
patch release so I'm going to defer that to 1.2. This commit fixes the
main issue for 1.1.1.
Fixes#5558
Binding checks would sometimes trigger preedit which would cause some
characters to leak through.
This is a bit of a band-aid. The real long term solution is noted in the
TODO comment in this commit, but I wanted to avoid regressions in a
patch release so I'm going to defer that to 1.2. This commit fixes the
main issue for 1.1.1.
Fixes#5494
When ibus/fcitx is not running (the GTK "simple" input method is
active), the preedit end event triggers _before_ the commit event. For
both ibus/fcitx, the opposite is true. We were relying on this ordering.
This commit changes the GTK input handling to not rely on this ordering.
Instead, we encode our composing state into the boolean state of whether
a key event is pressed. This happens before ANY input method events are
triggered.
Tested dead key handling on: X11/Wayland, ibus/fcitx/none.
Fixes#5494
When ibus/fcitx is not running (the GTK "simple" input method is
active), the preedit end event triggers _before_ the commit event. For
both ibus/fcitx, the opposite is true. We were relying on this ordering.
This commit changes the GTK input handling to not rely on this ordering.
Instead, we encode our composing state into the boolean state of whether
a key event is pressed. This happens before ANY input method events are
triggered.
Tested dead key handling on: X11/Wayland, ibus/fcitx/none.
This is, admittedly, a very silly bug. On GNOME the SSD protocol is not
available and past me just decided to always enable CSDs in that case,
*even when* `window-decoration = none`. I now question my own
intelligence.
When trying to run valgrind this incorrectly results in a correct
result, this is because `posix.errno` will use libc errno when linking
libc which ghostty does.
cf90dfd309/lib/std/posix.zig (L219-L221)
Since we are making the syscall directly we should not use this function
but rather use the return code directly on the enum, name from this
function seems odd to me (no zig experience) but it is the suggested
answer from zig (refer to issue below)
https://github.com/ziglang/zig/issues/22718
Note this definitely isnt much better than what we were doing before in
the case of running in valgrind
```text
error(linux-cgroup): unable to clone: os.linux.E__enum_81093.NOSYS
debug(io_thread): IO thread exited
warning(io_thread): error in io thread err=error.CloneError
warning(io_thread): abrupt io thread exit detected, starting xev to drain mailbox
debug(io_thread): io thread fully exiting after abnormal failure
```
opening a new tab shows
```
error starting IO thread: error.CloneError
The underlying shell or command was unable to be started.
This error is usually due to exhausting a system resource.
If this looks like a bug, please report it.
This terminal is non-functional. Please close it and try again.
```
this did not show on the original surface only on the new tab