8161 Commits

Author SHA1 Message Date
Qwerasd
c66042d6e0 font/sprite: address PR review feedback
- Make canvas geometry primitives generic, use `Rect(u32)` for `rect`
function, so that we don't have to worry about negatives or rounding.
- Make `Quads` struct packed just in case it gets non-comptime use in
the future.
- Clarify comment on why we're discarding out of range pixels + runtime
unreachable for any other type of error which we shouldn't ever see.
- Move z2d import above in-tree imports.
2024-10-15 12:00:11 -04:00
Mitchell Hashimoto
7673ce31a9 Merge pull request #2441 from ghostty-org/push-sqsmtmrsswxp
macos: NSProcessInfo-based arg iterator so CLI args work
2024-10-14 19:05:03 -07:00
Qwerasd
83a56afcb1 font/sprite: fix weird code 2024-10-14 20:52:42 -04:00
Qwerasd
37144fd5b8 font/sprite: fix light arc character for odd thicknesses
+ update Box.ppm ground truth image
2024-10-14 20:47:04 -04:00
Qwerasd
c0315a04b4 test(font/sprite): add second size to box regression test
Smaller, odd cell size, odd (1) thickness, catches more edge cases with
rounding etc.
2024-10-14 20:31:01 -04:00
Mitchell Hashimoto
115e14f19f macos: NSProcessInfo-based arg iterator
Fixes #2432

On macOS, processes with an NSApplicationMain entrypoint do not have
access to libc argc/argv. Instead, we must use NSProcessInfo. This
commit introduces an args iterator that uses NSProcessInfo, giving us
access to the args.

This also fixes an issue where we were not properly skipping argv0 when
iterating over the args. This happened to be fine because we happened to
ignore invalid args but it introduces a config error.
2024-10-14 17:08:33 -07:00
Jeffrey C. Ollie
ca42b4ca1c gtk: use CSS variables and color calcs introduced in 4.16
This takes advantage of CSS variables and color expressions to improve
the `window-theme=ghostty` support. The only visibile difference from
the previous implementation is that the header bar will darken if the
Ghostty window is in the background, which is standard for GTK apps.

This is conditional at runtime. If Ghostty detects that you're running
against GTK 4.16 or newer it will use the CSS variables and color calcs.
If you're running against older versions it will use CSS classes to
achieve nearly the same effect.
2024-10-14 18:24:05 -05:00
Qwerasd
bb5b7b0274 font/sprite(Box): refactor smooth mosaic rendering
+ un-`comptime` the line spec and make it a packed struct, to reduce
codegen size.
2024-10-14 17:50:49 -04:00
Qwerasd
d38d0f30c4 font/sprite: replace pixman with z2d, extend Box coverage
More complete coverage of the Symbols For Legacy Computing block,
including characters from Unicode 16.0.

Pixman and the web canvas impl for Canvas have been removed in favor of
z2d for drawing, since it has a nicer API with more powerful methods,
and is in Zig with no specific platform optimizations so should compile
to wasm no problem.
2024-10-14 17:50:49 -04:00
Qwerasd
c86b5f44ce font/sprite: refactor box drawing quads/sextants
Move away from C-style bit sets, calculate sextants procedurally rather
than hard coding.
2024-10-14 17:50:49 -04:00
Qwerasd
d63cf6eaec test(font/sprite): generate diff image on failed regression check 2024-10-14 17:50:49 -04:00
Qwerasd
ced4247e55 font/sprite: refactor lines and fractional blocks, add ground truth for regression test
Use a single unified function for intersection-style line drawing chars,
and one for fractional block characters. Add a ground truth image based
on this commit for the regression test (differences from before changes
validated visually, 1 incorrect rendering actually fixed)
2024-10-14 17:50:49 -04:00
Qwerasd
f3e74384bb test(font/sprite): add regression test for box drawing sprites 2024-10-14 17:50:49 -04:00
Qwerasd
74750fbd49 font/Atlas: add dump method to dump to ppm 2024-10-14 17:50:49 -04:00
Mitchell Hashimoto
9f50ed07a5 Merge pull request #2438 from qwerasd205/undercurl-thickness
Undercurl tweaks
2024-10-14 12:57:11 -07:00
Qwerasd
2462921681 font/sprite(underline): make undercurl segment symmetrical
Previously was biased half a pixel to one side.
2024-10-14 14:53:09 -04:00
Qwerasd
63f82119cd font/sprite(underline): add thickness correction to undercurl 2024-10-14 14:46:43 -04:00
Mitchell Hashimoto
10aad444b7 Merge pull request #2436 from isabelroses/nix/prefer-hostplatforn
refactor(nix): stdenv.isX -> stdenv.hostPlatform.isX
2024-10-14 09:46:25 -07:00
Mitchell Hashimoto
0cf12cd88b input: make clear the open keybinding uses xdg-open 2024-10-14 09:32:38 -07:00
isabel
02be641358 refactor(nix): stdenv.isX -> stdenv.hostPlatform.isX
In preparation for the deprecation of `stdenv.isX`

e0464e4788
2024-10-14 16:39:28 +01:00
Mitchell Hashimoto
ccb97c6c33 Merge pull request #2417 from qwerasd205/misc-shaper-fixes
Renderer `rebuildCells` rework
2024-10-12 09:39:08 -07:00
Mitchell Hashimoto
6ce5f3f94b Merge pull request #2434 from ofseed/en-space
renderer: generalize the definition of "space"
2024-10-12 09:37:15 -07:00
Mitchell Hashimoto
862bdcb92a apprt/gtk: adw about dialog introduces in libadw 1.5.0
Fixes #2433
2024-10-12 09:35:09 -07:00
Yi Ming
0571c50d63 renderer: generalize the definition of "space" 2024-10-12 17:56:51 +08:00
Qwerasd
e4f4b708c9 font/shaper: explicitly skip invisible cells while shaping
Fixes a bug caused by the renderer logic assuming this behavior and not
advancing the run iterator when skipping foreground elements in cells
with the invisible flag set.
2024-10-11 13:50:16 -04:00
Mitchell Hashimoto
97abf3c370 font/noop: conform to new run struct type 2024-10-10 17:24:44 -07:00
Mitchell Hashimoto
c26d1cb28e config: add accidentally removed keybinding 2024-10-10 16:47:35 -07:00
Mitchell Hashimoto
2b5263032f Merge pull request #2431 from ghostty-org/push-xrvpptonzowr
core: simplify scroll math, fix horizontal scroll direction on macOS
2024-10-10 16:46:26 -07:00
Mitchell Hashimoto
745079cbb5 core: simplify scroll math, fix horizontal scroll direction on macOS
This simplifies the math for calculating scroll vectors based on mouse
scroll events. This was done to fix inverted horizontal scrolling on
macOS with natural scrolling enabled. Many assertions were added for
assumptions and our preconditions are clearly documented.

The preconditions are:

  * Apprt scroll offsets are negative down/left, positive up/right
  * Terminal vertical scroll is postive down, negative up (opposite
    since scroll for a terminal means how many rows to move down).
  * `Surface.scrollCallback` is always call with an apprt offset.
  * Apprt is responsible for implementing natural scrolling. Surface
    always assumes negative is down/left.
2024-10-10 16:24:16 -07:00
Mitchell Hashimoto
75b8dc19d4 Merge pull request #2430 from ghostty-org/push-qqxqmpquyyut
macos: retry focusing the quick terminal to handle focus on other screen
2024-10-09 15:25:55 -07:00
Mitchell Hashimoto
7c5ea1c8d6 Merge pull request #2429 from ghostty-org/push-svonxsqwnumx
macos: change our minimum version to macOS 13
2024-10-09 15:19:12 -07:00
Mitchell Hashimoto
94d30eaea3 macos: retry focusing the quick terminal to handle focus on other screen
Fixes #2409

This is one of the weirder macOS quirks (bugs? who knows!) I've seen
recently. The bug as described in #2409: when you have at least two
monitors ("screens" in AppKit parlance), Ghostty on one, a focused app
on the other, and you toggle the quick terminal, the quick terminal
does not have focus.

We already knew and accounted for the fact that
`window.makeKeyAndOrderFront(nil)` does not work until the window is visible
and on the target screen. To do this, we only called this once the
animation was complete. For the same NSScreen, this works, but for
another screen, it does not.

Using one DispatchQueue.async tick also does not work. Based on testing,
it takes anywhere from 2 to 5 ticks to get the window focus API to work
properly. Okay.

The solution I came up with here is to retry the focus operation every
25ms up to 250ms. This has worked consistently for me within the first 5
ticks but it is obviously a hack so I'm not sure if this is all right.

This fixes the issue but if there's a better way to do this, I'm all
ears!
2024-10-09 15:13:54 -07:00
Mitchell Hashimoto
eec77e271c macos: change our minimum version to macOS 13
macOS 12 is officially EOL by Apple and the project only supports
officially supported versions of macOS. Once publicly released, users on
older macOS versions will have to use older released builds.
2024-10-09 14:41:57 -07:00
Mitchell Hashimoto
2f009b7262 Merge pull request #2428 from ghostty-org/push-spqssprnrpun
build: use the native target for generic macos target by default
2024-10-09 14:18:19 -07:00
Mitchell Hashimoto
640eaf3795 Merge pull request #2427 from lucymhdavies/patch-1
Include command to run a subset of tests in README
2024-10-09 14:11:14 -07:00
Mitchell Hashimoto
124ffb3ecb build: use the native target for generic macos target by default
Fixes #2426
2024-10-09 14:08:48 -07:00
Lucy Davinhart || Strawb System
1b024b117f Include command to run a subset of tests in README
For Zig veterans this may be obvious. As a Zig newbie, for me it was no, but found the answer in the Discord.
2024-10-09 21:23:05 +01:00
Qwerasd
ca59367164 harfbuzz: fix tests to account for removal of null cells 2024-10-09 16:05:09 -04:00
Qwerasd
7de7bfa20e coretext: fix tests to account for removal of null cells 2024-10-09 16:00:57 -04:00
Qwerasd
0bb176d22c renderer: cleanup, reduce nesting, more comments 2024-10-09 15:53:02 -04:00
Qwerasd
b65ccd4598 test(coretext): add test for high plane padding sprite font behavior 2024-10-09 15:28:01 -04:00
Mitchell Hashimoto
6b293fbf25 Merge pull request #2424 from ghostty-org/push-xnvwslrvoktn
core: support mouse button 6/7 for mouse reports
2024-10-09 11:30:19 -07:00
Mitchell Hashimoto
e90dec04be core: support mouse button 6/7 for mouse reports
Fixes #2423

This corresponds to horizontal scroll on macOS and likely other mice.
2024-10-09 11:24:36 -07:00
Mitchell Hashimoto
fe9afe73f0 Merge pull request #2422 from ghostty-org/push-nrnmvswvwlmz
macos: don't swallow flagsChanged events, breaks system bindings
2024-10-09 10:20:29 -07:00
Mitchell Hashimoto
a2ba7b4948 macos: don't swallow flagsChanged events, breaks system bindings
Fixes #2419
2024-10-09 10:17:39 -07:00
Mitchell Hashimoto
defb2e186d Merge pull request #2420 from ghostty-org/push-lrummrmpmxwt
core: modifier-only keys do not reset pending key sequences
2024-10-09 09:50:28 -07:00
Mitchell Hashimoto
4ffb1c8cf9 core: modifier-only keys do not reset pending key sequences
This allows nested key sequences to be used such as `ctrl+a>ctrl+b>c`.
2024-10-09 09:46:16 -07:00
Mitchell Hashimoto
b65a9ebc45 Merge pull request #2234 from jcollie/gtk-css-no-libadwaita
gtk: load css when libadwaita is not being used
2024-10-09 09:37:30 -07:00
Mitchell Hashimoto
3e55c47e8b Merge pull request #2418 from ghostty-org/apprt-key-seq
macOS: Key Sequence UI
2024-10-09 09:30:53 -07:00
Mitchell Hashimoto
8994a8c627 macos: implement key sequence UI 2024-10-08 21:58:53 -07:00