222 Commits

Author SHA1 Message Date
Mitchell Hashimoto
98237b112f config: RepeatableString is null-terminated now
This makes it easier for these values to interface with C APIs
2024-01-03 09:24:15 -08:00
Gregory Anders
060bdff117 terminal: track palette color in cell state
Rather than immediately converting a color palette index into an RGB
value for a cell color, when a palette color is used track the palette
color directly in the cell state and convert to an RGB value in the
renderer.

This causes palette color changes to take effect immediately instead of
only for newly drawn cells.
2024-01-02 22:34:06 -06:00
Mitchell Hashimoto
a8419754b9 renderer/opengl: allow OpenGL 4.1/4.2 2023-12-18 13:59:33 -08:00
Mitchell Hashimoto
4ba44fb8c1 renderer/opengl: error if OpenGL version is too old
This returns an error from the renderer implementation. This error just
crashes Ghostty currently with a stack trace. We can handle the error
later but for now it makes it a lot more obvious why certain error
scenarios happen.
2023-12-18 12:51:53 -08:00
Mitchell Hashimoto
231a2b6369 renderer/opengl: implement fg_constrained 2023-12-16 20:11:37 -08:00
Mitchell Hashimoto
5b4232b094 renderer/opengl: acquire lock to prep kitty images
Fixes #1101

GTK forces all GLArea drawing to happen on the GUI thread. In this
scenario, `updateFrame` and `drawFrame` could be happening in parallel.
This commit grabs the lock while updating the Kitty image protocol state
since that is used by both functions.

We already have a mutex called "draw_mutex" that we hold while we're
modifying data that could be shared by this separate draw thread. We
should reuse that here.
2023-12-15 14:15:32 -08:00
Mitchell Hashimoto
bcf6753c68 renderer/opengl: use new glyph offsets 2023-12-11 21:47:03 -08:00
Mitchell Hashimoto
3e9a6e4de5 renderer/opengl: apply extra offset for zero-advance glyphs 2023-12-10 17:10:00 -08:00
Mitchell Hashimoto
0b60ae0010 renderer/metal,opengl: replace matching image IDs if transmit time differs
Fixes #1037

Renderers must convert the internal Kitty graphics state to a GPU
texture for rendering. For performance reasons, renderers cache the GPU
state by image ID. Unfortunately, this meant that if an image was
replaced with the same ID and was already cached, it would never be
updated on the GPU.

This PR adds the transmission time to the cache. If the transmission
time differs, we assume the image changed and replace the image.
2023-12-10 09:16:10 -08:00
Mitchell Hashimoto
56c6c096fa renderer: handle scenarios the preedit text is wider than our screen 2023-12-03 20:16:49 -08:00
Mitchell Hashimoto
0cdefe8b8b core: remove size limit on preedit length by heap allocating
Fixes #882

We previously had a hardcoded limit of 16 codepoints. In #882, a user
pointed out that in Chinese, is reasonable for a preedit input to be
longer than this.

To avoid any future issues, this commit moves to a heap-allocated
variant. Preedits aren't that common, they aren't high throughput, and
they're generally pretty small, so using a heap allocation is fine. The
memory is owned by the person who set it.
2023-12-03 19:54:26 -08:00
Mitchell Hashimoto
7f40881747 font: faces use primary grid metrics to better line up glyphs
Fixes #895

Every loaded font face calculates metrics for itself. One of the
important metrics is the baseline to "sit" the glyph on top of. Prior to
this commit, each rasterized glyph would sit on its own calculated
baseline. However, this leads to off-center rendering when the font
being rasterized isn't the font that defines the terminal grid.

This commit passes in the font metrics for the font defining the
terminal grid to all font rasterization requests. This can then be used
by non-primary fonts to sit the glyph according to the primary grid.
2023-12-02 09:51:15 -08:00
Mitchell Hashimoto
ec8f3d036e renderer/opengl: implement min contrast 2023-12-01 21:55:51 -08:00
Mitchell Hashimoto
bb60d2c1c0 renderer/opengl: urls 2023-11-29 15:30:23 -08:00
Mitchell Hashimoto
cf8a0bdaec renderer: handle Kitty images where z < 0 for all placements 2023-11-20 21:34:17 -08:00
Mitchell Hashimoto
9988dedb80 renderr/opengl: stylistic 2023-11-20 09:45:38 -08:00
Mitchell Hashimoto
2a10af90a3 renderer/opengl: draw images 2023-11-19 22:43:39 -08:00
Mitchell Hashimoto
64cacce1cf renderer/opengl: setup image uniforms 2023-11-19 22:33:06 -08:00
Mitchell Hashimoto
76c76ce85e renderer/opengl: upload kitty image textures 2023-11-19 22:08:07 -08:00
Mitchell Hashimoto
e55cb274ba config: custom-shader-animation 2023-11-17 21:51:07 -08:00
Mitchell Hashimoto
61f10dc583 renderer/opengl: new gpucell 2023-11-17 21:51:07 -08:00
Mitchell Hashimoto
8253fc1f31 renderer/opengl: shaders only need one color input 2023-11-17 21:51:07 -08:00
Mitchell Hashimoto
2db36646ac renderer/opengl: some comments 2023-11-17 21:51:07 -08:00
Mitchell Hashimoto
39e7055853 renderer/opengl: enable animations 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
c8a51a2158 renderer/opengl: create the screen texture 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
fbc13d08b0 renderer/opengl: set resolution uniform on screen size change 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
2559d6b367 renderer/opengl: increment time uniform 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
e0afa442c4 renderer/opengl: better organization of custom shader state 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
47971e7663 renderer/opengl: setup uniform buffer objects for custom shaders 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
5fc91401f2 renderer/opengl: draw custom shaders, simplified 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
da600fee8f renderer/opengl: pull out cell program drawing to dedicated func 2023-11-17 21:51:06 -08:00
Mitchell Hashimoto
1fedc912f0 renderer/opengl: create ubos 2023-11-17 21:51:05 -08:00
Mitchell Hashimoto
3502db0f5f renderer/opengl: start custom program work 2023-11-17 21:51:05 -08:00
Mitchell Hashimoto
cc630f10ac renderer/opengl: only one GPUCell 2023-11-17 21:51:05 -08:00
Mitchell Hashimoto
fb0929a11b renderer/opengl: extract cell program state to dedicated struct 2023-11-17 21:51:05 -08:00
Mitchell Hashimoto
46dd084ee9 renderer/opengl: wip 2023-11-17 21:51:05 -08:00
Mitchell Hashimoto
8576acb89e renderer/opengl: move opengl API to pkg/opengl 2023-11-17 21:51:04 -08:00
Mitchell Hashimoto
389712a698 renderer/opengl: switch to new update vs draw 2023-11-17 21:50:34 -08:00
Mitchell Hashimoto
45dfbfe53c renderer: address issue with inverted cells 2023-11-17 21:47:24 -08:00
Raiden1411
7a239835d2 core: add config option to invert fg and bg of cell when selected 2023-11-18 01:04:14 +00:00
Krzysztof Wolicki
44a48f62f1 change unmodified vars to consts in anticipation of zig changes 2023-11-17 15:46:46 +01:00
Mitchell Hashimoto
b5bf7e9d3b Merge pull request #890 from mitchellh/faint-bg
renderer: faint should not be applied to bg alpha
2023-11-15 11:41:35 -08:00
Mitchell Hashimoto
ed3e3764d9 renderer: faint should not be applied to bg alpha
Fixes #889
2023-11-15 11:38:16 -08:00
Mitchell Hashimoto
ad24e5e687 renderer/opengl: use new preedit format 2023-11-15 09:59:08 -08:00
Mitchell Hashimoto
5c8c4bb06e renderer/opengl: handle wide preedit 2023-11-10 17:30:14 -08:00
Gregory Anders
171292a063 core: implement OSC 12 and OSC 112 to query/set/reset cursor color 2023-11-09 16:21:07 -06:00
Gregory Anders
33753f59c8 core: implement OSC 104, 110, and 111 to reset colors 2023-11-09 16:17:21 -06:00
Lukáš Dvořák
bca7140248 balanced padding cleanup 2023-10-30 14:56:02 +01:00
Lukáš Dvořák
6887ea7e53 fix window-padding-balance in combination with explicit padding 2023-10-30 13:46:19 +01:00
Mitchell Hashimoto
06edc311a1 renderer/opengl: reclaim cell buffer memory when resizing 2023-10-28 11:38:20 -07:00