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/input.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/input.h')
| -rw-r--r-- | src/input.h | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/src/input.h b/src/input.h deleted file mode 100644 index adda27a..0000000 --- a/src/input.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Input decoding: the bytes the *outer* terminal sends us -> semantic events. - * - * libghostty-vt encodes events outward to a pane, but nothing decodes inward, - * so this half is ours (DESIGN.md). Decoding to a semantic event and - * re-encoding per pane against that pane's own modes is what makes kitty - * keyboard passthrough correct instead of approximate. - * - * The event carries GhosttyKey / GHOSTTY_MODS_* values as plain integers so - * this header stays free of libghostty-vt. - */ -#ifndef SLOSH_INPUT_H -#define SLOSH_INPUT_H - -#include <stdbool.h> -#include <stddef.h> -#include <stdint.h> - -typedef enum { - EV_NONE = 0, - EV_KEY, - EV_MOUSE, - EV_PASTE, - EV_FOCUS, -} ev_kind_t; - -/* mirrors GhosttyKeyAction */ -enum { KEY_RELEASE = 0, KEY_PRESS = 1, KEY_REPEAT = 2 }; -/* mirrors GhosttyMouseAction */ -enum { MOUSE_PRESS = 0, MOUSE_RELEASE = 1, MOUSE_MOTION = 2 }; -/* mirrors GhosttyMouseButton */ -enum { - MBTN_UNKNOWN = 0, - MBTN_LEFT = 1, - MBTN_RIGHT = 2, - MBTN_MIDDLE = 3, - MBTN_FOUR = 4, - MBTN_FIVE = 5, - MBTN_SIX = 6, - MBTN_SEVEN = 7, -}; -/* mirrors GHOSTTY_MODS_* */ -enum { - MOD_SHIFT = 1 << 0, - MOD_CTRL = 1 << 1, - MOD_ALT = 1 << 2, - MOD_SUPER = 1 << 3, - MOD_CAPS = 1 << 4, - MOD_NUM = 1 << 5, -}; - -typedef struct { - ev_kind_t kind; - - /* EV_KEY */ - int key; /* GhosttyKey */ - uint16_t mods; /* MOD_* */ - uint8_t action; /* KEY_* */ - char text[16]; /* UTF-8 the key produced, if any */ - uint8_t text_len; - uint32_t unshifted; /* unshifted codepoint, 0 if unknown */ - - /* EV_MOUSE */ - uint8_t button; /* MBTN_* */ - uint8_t maction; /* MOUSE_* */ - uint16_t mx, my; /* 0-indexed cell coordinates */ - - /* EV_PASTE */ - const char *paste; - size_t paste_len; - - /* EV_FOCUS */ - bool focused; -} input_event_t; - -typedef struct input_parser input_parser_t; -typedef void (*input_cb_t)(const input_event_t *ev, void *ud); - -input_parser_t *input_new(void); -void input_free(input_parser_t *p); - -/* Feed bytes; complete events are dispatched to cb. Partial sequences are - * retained for the next call, so split reads are safe. */ -void input_feed(input_parser_t *p, const uint8_t *data, size_t len, - input_cb_t cb, void *ud); - -/* True when a bare ESC (or an unterminated sequence) is buffered. Call - * input_timeout() after ~50ms of quiet to resolve it as the Escape key. */ -bool input_pending(const input_parser_t *p); -void input_timeout(input_parser_t *p, input_cb_t cb, void *ud); - -/* Debug/test rendering of an event, e.g. "key ARROW_UP mods=CTRL press". */ -void input_event_describe(const input_event_t *ev, char *buf, size_t cap); - -#endif /* SLOSH_INPUT_H */ |
