diff options
| author | user <user@clank> | 2026-08-19 13:46:57 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-19 13:46:57 +0200 |
| commit | 42b3c10995eb67778d9dd3aa2fd80624896acd5f (patch) | |
| tree | 751bcb8604967dc8687cf23fbeb1033aa26ca427 /src/graphics.h | |
| parent | slosh: a website that is a page, not a mock session (diff) | |
| download | slosh-42b3c10995eb67778d9dd3aa2fd80624896acd5f.tar.gz slosh-42b3c10995eb67778d9dd3aa2fd80624896acd5f.tar.xz slosh-42b3c10995eb67778d9dd3aa2fd80624896acd5f.zip | |
slosh: defaults most people can live in, said by shaders
The out-of-the-box look, rethought as one piece:
- the compiled-in palette calms down: muted blue #7aa2f7 on the same
neutral darks, with the colours that mean something kept semantic --
amber bell, red-orange dead. sl0p stays one include away as the house
style, and contrib/themes/default.kdl is the starting point written
down (theme-tour shows it).
- derived state defaults now actually follow the theme: the scrolled
wash is rebuilt from scroll_bg after the theme block (it used to bake
the compiled accent), and declaring a state -- in any file of an
include chain -- still wins. The dump writes derived states as
comments so C-a e cannot pin what is meant to keep following.
- a bell you can see: the frame blinks three times in theme's bell
colour then breathes until answered, and a soft diagonal shimmer --
the bell colour halved towards default_fg, width breathing on a sine
-- crosses the body for the same 900ms. bell_indicator false silences
all of it; states { bell { } } replaces it like any state. since
carries the clock dependency, so an idle session pays nothing.
- scrollback says where it continues: while scrolled, the viewport's
top and bottom rows melt towards an edge with content past it and
turn solid at the buffer's end. New expression variables above/below
(lines hidden past each edge, own dependency bit, cached per scroll
position), carried in shade_ctx_t -- SLOSH_SHADER_ABI 3 -> 4.
- expressions survive the dump: a program keeps its source and cb_chain
writes it back, so amount="(y % 2) * 40" no longer dumps as a number.
- headers move to include/, -Iinclude everywhere; the plugin Makefile's
SLOSH var becomes SLOSH_DIR because slosh exports SLOSH=1 into every
pane it runs, and building from inside a session read that as a path.
- comment drift culled where features outran the prose, and the
derivation boilerplate folded into derived_pass()/ctx_scroll().
Diffstat (limited to 'src/graphics.h')
| -rw-r--r-- | src/graphics.h | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/src/graphics.h b/src/graphics.h deleted file mode 100644 index b3cd6ec..0000000 --- a/src/graphics.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Kitty graphics passthrough. - * - * libghostty-vt parses the protocol and tracks every image and placement, so - * a pane's images exist as data; what a multiplexer has to add is *re-emitting* - * them to the client's terminal at the right place, with ids that cannot - * collide between panes. - * - * This is why pi has to fall back to sixel under tmux and zellij: they drop - * the images entirely. Here the native path works. - */ -#ifndef SLOSH_GRAPHICS_H -#define SLOSH_GRAPHICS_H - -#include <stdbool.h> -#include <stddef.h> -#include <stdint.h> - -typedef struct graphics graphics_t; - -/* One image, as this session knows it. */ -typedef struct { - uint32_t pane; /* which pane transmitted it */ - uint32_t src_id; /* the id the program chose, unique only within its pane */ - uint32_t out_id; /* the id we give the client, unique across the session */ - uint64_t gen; /* image generation, so a changed image is re-sent */ - bool sent; -} gfx_image_t; - -/* One placement on screen this frame. */ -typedef struct { - uint32_t out_id; - uint32_t place_id; - uint16_t col, row; /* screen cells */ - uint16_t cols, rows; - /* Where the image starts *inside* its first cell, in pixels. This is what - * makes motion smooth instead of snapping a cell at a time, and dropping it - * is invisible in a still picture and obvious the moment anything moves. */ - uint32_t x_off, y_off; - /* Cells to scale into, or 0 to draw at natural size. Only sent on when the - * program asked for it. */ - uint16_t scale_cols, scale_rows; - uint32_t sx, sy, sw, sh; /* source rectangle, in image pixels */ - bool live; -} gfx_place_t; - -graphics_t *gfx_new(void); -void gfx_free(graphics_t *g); - -/* Start a frame: everything placed last frame is marked stale. */ -void gfx_begin(graphics_t *g); -/* Everything gfx_place() needs: where it goes, what it crops to, and the - * image itself for the first time it is seen. - * - * A struct rather than the twenty positional arguments this used to be. Half - * of them are uint32_t pixel quantities, so a transposed pair compiles - * perfectly and shows up as a picture in slightly the wrong place — which is - * exactly the bug class this file is for. */ -typedef struct { - uint32_t pane; /* which pane it belongs to */ - uint32_t src_id; /* the id the program chose */ - uint64_t gen; /* image generation, so a changed image is re-sent */ - uint32_t place_id; - uint16_t col, row; /* screen cells */ - uint16_t cols, rows; /* cells covered */ - uint16_t scale_cols, scale_rows; /* cells to scale into, 0 for natural */ - uint32_t x_off, y_off; /* offset within the first cell, in pixels */ - uint32_t sx, sy, sw, sh; /* source rectangle, in image pixels */ - uint32_t px_w, px_h; /* the image's own size */ - int format, compression; - const uint8_t *data; /* NULL once the client has it */ - size_t data_len; -} gfx_req_t; - -/* Record a visible placement, transmitting the image if the client has not - * seen it yet. `data` may be NULL when the image is already transmitted. */ -void gfx_place(graphics_t *g, const gfx_req_t *req); -/* End a frame: emit transmits, placements and deletions. Caller frees. */ -char *gfx_flush(graphics_t *g, size_t *out_len); - -/* Forget what the client has seen (it is a different client now). */ -void gfx_reset(graphics_t *g); -/* Drop everything belonging to a pane that is gone. */ -void gfx_forget_pane(graphics_t *g, uint32_t pane); - -size_t gfx_placements(const graphics_t *g, const gfx_place_t **out); -size_t gfx_images(const graphics_t *g, const gfx_image_t **out); - -#endif /* SLOSH_GRAPHICS_H */ |
