Commit Graph

510 Commits (31285e1ac34d8a2dcd46ec682fba767d05ebd21e)

Author SHA1 Message Date
Leah Amelia Chen 600f59ae31
gtk: implement quick-terminal-screen for Linux/Wayland (#11117) 2026-03-16 06:30:02 +00:00
Mitchell Hashimoto 3dde6e2559
terminal: bound link regex search work with Oniguruma retry limits
Fixes #11177

Use per-search Oniguruma match params (retry_limit_in_search) in
StringMap-backed link detection to avoid pathological backtracking hangs
on very long lines.

The units are ticks in the internal loop so its kind of opaque but
this seems to still match some very long URLs. The test case in question
was a 169K character line (which is now rejected).
2026-03-04 21:02:55 -08:00
Jake Guthmiller beeb810c04 gtk: address PR review feedback for quick-terminal-screen 2026-03-02 23:33:19 -06:00
Mitchell Hashimoto 391c9044bc
pkg/afl++: remove @@ from run target since we use in-memory targets 2026-03-02 19:36:43 -08:00
Jake Guthmiller 96f8f0d93c gtk: add setMonitor binding and kde-output-order-v1 protocol
Add the missing setMonitor() function to the gtk4-layer-shell Zig
bindings and provide the gdk module so it can reference gdk.Monitor.

Register the kde-output-order-v1 Wayland protocol from
plasma-wayland-protocols and generate its scanner binding. This
protocol reports the compositor's monitor priority ordering and is
needed to correctly identify the primary monitor for
quick-terminal-screen support on Linux.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 18:23:08 -06:00
Mitchell Hashimoto 2685efca7a
pkg/afl++: remove file arg 2026-02-28 21:14:52 -08:00
Mitchell Hashimoto 23f6b1af65
pkg/afl++: fuzzer takes a file argument 2026-02-28 21:14:52 -08:00
Mitchell Hashimoto 2bd09523c8
pkg/afl++: use usize for len 2026-02-28 21:14:51 -08:00
Mitchell Hashimoto afabbaf012
pkg/afl++: extract runner 2026-02-28 21:14:51 -08:00
Mitchell Hashimoto 54bdbdf87d
pkg/afl++: clean up, comments 2026-02-28 21:14:51 -08:00
Mitchell Hashimoto 3294621430
switch to pkg/afl++ for fuzz 2026-02-28 21:14:51 -08:00
Mitchell Hashimoto 4e47c225b1
pkg/afl++ 2026-02-28 21:14:51 -08:00
Mitchell Hashimoto de4ee288f5
pkg/dcimgui: only add the OpenGL3 shutdown helper if backend enabled 2026-02-26 06:56:17 -08:00
Mitchell Hashimoto 7db8346fca
apprt/gtk: fix SIGSEGV on ImGui GLArea re-realize
Fixes #10406

ImGui_ImplOpenGL3_Shutdown() calls imgl3wShutdown() which dlcloses the
GL library handles but does not zero out the imgl3w function pointer
table (imgl3wProcs). When a GLArea is re-realized (e.g. during
reparenting), ImGui_ImplOpenGL3_Init() calls ImGui_ImplOpenGL3_InitLoader()
which checks "if (glGetIntegerv == nullptr)". Since the stale pointers
are non-null, it skips re-initialization. The next GL call through a
dangling function pointer causes a SIGSEGV.

Fix this by introducing ImGui_ImplOpenGL3_ShutdownWithLoaderCleanup()
which calls the normal shutdown and then zeroes the imgl3wProcs table,
forcing the next Init to reload GL function pointers via imgl3wInit().

Also properly destroy the ImGui context and reset widget state in
glAreaUnrealize so re-realize starts clean. This was extra but was
probably leaking memory.
2026-02-25 15:25:22 -08:00
Jeffrey C. Ollie 2a02b8f0ef
android: build improvements
* Use a GitHub action to download the Android NDK
* Use helper functions available on `std.Build` to simplify
  the build script.
* Use various Zig-isms to simplify the code.

FYI, using Nix to seems to be a non-starter as getting any Android
development kits from nixpkgs requires accepting the Android license
agreement and allowing many packages to use unfree licenses. And since
the packages are unfree they are not cached by NixOS so the build
triggers massive memory-hungry builds.
2026-02-22 16:26:22 -06:00
Elias Andualem b728e41d77 build: clarify ANDROID_NDK_HOME variable description 2026-02-21 23:44:43 +08:00
Elias Andualem bd9611650f build: add support for Android NDK path configuration 2026-02-21 21:17:09 +08:00
Mitchell Hashimoto a25e91bb25
pkg/dcimgui: expose more private dockbuilder stuff 2026-01-31 08:47:13 -08:00
Jacob Sandlund 80bf50be1d set cluster level to match CoreText logic 2026-01-16 09:39:47 -05:00
Jacob Sandlund 3aba038d38 Merge remote-tracking branch 'upstream/main' into harfbuzz-positions 2026-01-14 08:56:56 -05:00
Tommy D. Rossi 61394d5213 build: add -fPIC for musl targets in C++ dependencies 2026-01-07 06:55:40 -08:00
Mitchell Hashimoto 82e585ad9a
remove pkg/cimgui 2025-12-31 13:38:40 -08:00
Mitchell Hashimoto f2bc722a58
pkg/dcimgui: fix wchar size mismatch 2025-12-31 13:36:40 -08:00
Mitchell Hashimoto 965ffb1750
pkg/dcimgui: add freetype 2025-12-31 13:20:27 -08:00
Mitchell Hashimoto 896361f426
Fix up API calls for initialization 2025-12-31 13:01:28 -08:00
Mitchell Hashimoto 978400b0b0
replace cimgui with dcimgui 2025-12-31 10:42:10 -08:00
Mitchell Hashimoto 3bd898603a
pkg/dcimgui: DearBindings-based Imgui support 2025-12-31 10:11:43 -08:00
Jacob Sandlund 2ff05c9ffb Merge remote-tracking branch 'origin/main' into harfbuzz-positions 2025-12-28 17:24:58 -06:00
-k e63a4ab774
build: fix pkgs for FBSD port runs 2025-12-28 07:21:58 -05:00
Jacob Sandlund e41dbe84fc shaping: Use position offsets for HarfBuzz 2025-12-24 16:23:16 -06:00
-k d0767a089a
build: fix `simdutf`/`highway` flags 2025-12-21 17:11:34 -05:00
Mitchell Hashimoto c92a003325
pkg/{highway,simdutf}: disable ubsan
This causes linker issues for some libghostty users. I don't know why we
never saw these issues with Ghostty release builds, but generally
speaking I think its fine to do this for 3rd party code unless we've
witnessed an issue. And these deps have been stable for a long, long
time.
2025-11-24 21:18:49 -08:00
Qwerasd 6d65abc489 fix(pkg/freetype): fully correct load flags
These now properly match the FreeType API- compared directly in the unit
tests against the values provided by the FreeType header itself.

This was ridiculously wrong before, like... wow.
2025-11-24 17:57:02 -07:00
Qwerasd 3cd6939af6 pkg/freetype: add failing unit tests for LoadFlags 2025-11-24 17:35:53 -07:00
Qwerasd 6a9c869f9d Partially revert 25856d6 since it broke pkg/freetype tests 2025-11-24 17:24:47 -07:00
Pyry Takala 5bfeba6603 Fix LoadFlags struct bit alignment to match FreeType API
The struct was missing padding at bit position 8, causing all subsequent flag fields (bits 9+) to be misaligned by one bit position.

See: https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx
2025-11-24 23:34:47 +00:00
Pyry Takala d4c2376c2d Fix LangSet.hasLang() to compare against FcLangEqual instead of FcTrue
FcLangSetHasLang returns FcLangResult enum values:
- FcLangEqual (0): Exact match
- FcLangDifferentTerritory (1): Same language, different territory
- FcLangDifferentLang (2): Different language

The previous comparison to FcTrue (1) caused:
- Exact matches (0) to incorrectly return false
- Partial matches (1) to incorrectly return true

This fix changes the comparison to FcLangEqual (0) so hasLang()
correctly returns true only for exact language matches.

Fixes emoji font detection which relies on checking for 'und-zsye'
language tag support.
2025-11-24 20:34:07 +00:00
Jeffrey C. Ollie ec55cbc879
wuffs: protect against crafted images that cause overflows
Fixes #9579

Protect against panics caused by integer overflows by using functions
that allow integer overflows to be caught instead of causing a panic.

Also protect against DOS from images that might not cause an
overflow but do consume an absurd amount of memory by limiting
images to a maximum size of 4GiB (which is the maximum size of
`image-storage-limit`).
2025-11-13 14:20:19 -06:00
Ēriks Remess 82a5c177fe gtk4-layer-shell: reenable ubsan 2025-10-10 14:40:56 +03:00
Ēriks Remess ce47a85bf7 gtk4-layer-shell: version from build.zig.zon 2025-10-10 14:40:42 +03:00
Mitchell Hashimoto 0112607532
Zig 0.15: zig build test macOS 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto 7ec57aeebd
Zig 0.15: zig fmt 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto d02770d292
zig-15: build binary builds 2025-10-03 07:10:41 -07:00
Qwerasd efc6e0d673 fix(font/coretext): always prevent shaper from emitting rtl
The solution we had before worked in most cases but there were some
which caused problems still. This is what HarfBuzz's CoreText shaper
backend does, it uses a CTTypesetter with the forced embedding level
attribute. This fixes the failure case I found that was causing non-
monotonic outputs which can have all sorts of unexpected results, and
causes a crash in Debug modes because we assert the monotonicity while
rendering.
2025-10-02 15:32:21 -06:00
Qwerasd d6063428bd font/coretext: tiny shaper improvements
Reduce potential allocation while processing glyphs by ensuring capacity
in the buffer ahead of time and also using CTRunGet*Ptr functions first
and only allocating for those if that didn't work (it should almost
always work in practice.)
2025-10-02 14:06:58 -06:00
Mitchell Hashimoto 0bddaed53b
fix(font): Improve FreeType glyph measurements and add unit tests for face metrics (#8738)
Follow-up to #8720 adding

* Two improvements to FreeType glyph measurements:
- Ensuring that glyphs are measured with the same hinting as they are
rendered, ref
[#8720#issuecomment-3305408157](https://github.com/ghostty-org/ghostty/pull/8720#issuecomment-3305408157);
- For outline glyphs, using the outline bbox instead of the built-in
metrics, like `renderGlyph()`.
* Basic unit tests for face metrics and their estimators, using the
narrowest and widest fonts from the resource directory, Cozette Vector
and Geist Mono.

---

I also made one unrelated change to `freetype.zig`, replacing
`@alignCast(@ptrCast(...))` with `@ptrCast(@alignCast(...))` on line
173. Autoformatting has been making this change on every save for weeks,
and reverting the hunk before each commit is getting old, so I hope it's
OK that I use this PR to upstream this decree from the formatter.
2025-09-29 12:24:42 -07:00
Paal Øye-Strømme bd9bc5f1b9 deps: removing utf8proc
utf8proc is no longer being used

Per #808, it should be removed.

Link: https://github.com/ghostty-org/ghostty/discussions/6931
Link: https://github.com/ghostty-org/ghostty/discussions/2563
2025-09-23 17:38:03 +02:00
azhn a9c5a05e5b deps: Allow dynamic-linking of spirv-cross
- Use the pkg-config name of 'spirv-cross-c-shared' exported by the upstream SPIRV-Cross build
2025-09-23 20:49:22 +10:00
Mitchell Hashimoto 17498ce122
build: many more lazy dependencies, defer deps add unless needed
This makes more dependencies lazy. This has a practical effect of
reducing the number of dependencies that need to be downloaded when
running certain zig build steps.

This is all limited because we're blocked on an upstream Zig issue:
https://github.com/ziglang/zig/issues/21525 This prevents us from
fully avoiding downloading many dependencies, but at least they're
relatively small.

One major improvement here is the usage of `lazyImport` for
`zig-wayland` that prevents downloading `zig_wayland` unconditionally on
all platforms. On macOS, we don't download this at all anymore.

Another, weirder change is that all our transitive dependencies are now
marked lazy (e.g. glslang's upstream source) even if the glslang build
always requires it. This was necessary because without this, even if we
simply referenced glslang in the root build.zig, it would force the
source package to download unconditionally. This no longer happens.
2025-09-21 13:26:09 -07:00
Mitchell Hashimoto a453681615
renderer: create explicit sampler state for custom shaders
The GLSL to MSL conversion process uses a passed-in sampler state for
the `iChannel0` parameter and we weren't providing it. This magically
worked on Apple Silicon for unknown reasons but failed on Intel GPUs.

In normal, hand-written MSL, we'd explicitly create the sampler state as
a normal variable (we do this in `shaders.metal` already!), but the
Shadertoy conversion stuff doesn't do this, probably because the exact
sampler parameters can't be safely known.

This fixes a Metal validation error when using custom shaders:

```
-[MTLDebugRenderCommandEncoder validateCommonDrawErrors:]:5970: failed 
assertion `Draw Errors Validation Fragment Function(main0): missing Sampler 
binding at index 0 for iChannel0Smplr[0].
```
2025-09-18 09:25:37 -07:00