summaryrefslogtreecommitdiff
path: root/src/kinds
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 11:38:06 -0300
committerGabriel Schneider <[email protected]>2026-11-06 12:03:00 -0300
commitf05c69380c8f23ab7dadb1c9d6240af687c88bed (patch)
tree8bb77af9ba2fadf64ac789bbe94c39df346a9db8 /src/kinds
parent239e8186111c215bf3bca842216205056e4b00e1 (diff)
downloadpardes-f05c69380c8f23ab7dadb1c9d6240af687c88bed.tar.gz
pardes-f05c69380c8f23ab7dadb1c9d6240af687c88bed.zip
kinds #18, ABI 2.2: pa_api says the core's ABI, pa_mouse grows a wheel's amount (a window passes a touchpad's fraction of a turn over a kind's pane, a terminal whole notches), pa_view says glyphs (no graphics), pa_paint's tail padding holds the pointer the kind asks for (the window shows a hand for PA_POINTER_LINK over its pane, a Shadow's frame carries it), and tick is told PA_FRAMED when a frame was drawn since its last; addon-test gains graphics on|off
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/kinds')
-rw-r--r--src/kinds/pardes_addon.h31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/kinds/pardes_addon.h b/src/kinds/pardes_addon.h
index e7334063..072f2447 100644
--- a/src/kinds/pardes_addon.h
+++ b/src/kinds/pardes_addon.h
@@ -32,7 +32,7 @@
/* Major in the high half: an addon of another major is refused. */
#define PA_ABI_MAJOR 2u
-#define PA_ABI_MINOR 1u
+#define PA_ABI_MINOR 2u
#define PA_ABI ((PA_ABI_MAJOR << 16) | PA_ABI_MINOR)
#define PA_OK 0
@@ -106,13 +106,20 @@ typedef struct pa_placement {
* frame, body and prefix together, never over no cells. 2.1: `at` and
* `span`, where the window is in the pane's whole (the share above it and
* the share it shows, 0 to 1), are the rail's thumb; 0 and 0, none. A kind
- * writes them only to a core whose api->size says 2.1. */
+ * writes them only to a core whose api->size says 2.1. 2.2: `pointer`, the
+ * pointer a frontend shows over the pane (PA_POINTER_*), which a terminal
+ * ignores. In paint, not in mouse's answer: what is under a resting pointer
+ * is known after the motion (a PDF's link, found on a tick), and the field
+ * takes the record's tail padding, so its size stays. */
+#define PA_POINTER_DEFAULT 0u
+#define PA_POINTER_LINK 1u
typedef struct pa_paint {
pa_placement *placements;
uint32_t cap, n;
char prefix[96];
uint32_t prefix_len;
float at, span;
+ uint32_t pointer;
} pa_paint;
/* ---- input ---- */
@@ -147,10 +154,13 @@ typedef struct pa_key {
#define PA_MOTION 2
#define PA_DRAG 3
/* A pointer event in the window's cells; a motion at col and row 0xffff
- * when the pointer leaves the window. */
+ * when the pointer leaves the window. 2.2: `amount`, a wheel's turn in
+ * notches, a touchpad's fraction of one (a terminal's are whole; 0 from an
+ * older core: one; an older kind is told each turn as a notch). */
typedef struct pa_mouse {
uint8_t button, action, ctrl, shift, alt, pad;
uint16_t col, row;
+ float amount;
} pa_mouse;
/* ---- what pardes does for an addon ---- */
@@ -163,7 +173,9 @@ typedef struct pa_view {
uint16_t cols, rows, cell_w, cell_h;
uint32_t fg, bg, sel, link;
uint16_t dpi, max_px;
- uint8_t fill, pad[3];
+ /* 2.2: `glyphs`, 1 when the frontend shows placements as glyph art (a
+ * terminal without graphics; 0 from an older core). */
+ uint8_t fill, glyphs, pad[2];
} pa_view;
/* Valid during any call pardes makes for a pane, and about that pane. */
@@ -196,6 +208,9 @@ typedef struct pa_api {
/* The text the pane has selected now, which a yank, a chord's Snarf and
* a keyboard Look take; n 0, none. */
void (*select)(const char *text, uint32_t n);
+ /* 2.2 (api->size >= 104): the core's PA_ABI, so a kind reads the 2.2
+ * fields it is given (pa_mouse.amount) only from a core that sets them. */
+ uint32_t abi, pad;
} pa_api;
/* What a job allocates from, on its worker (pa_api is not there): as often
@@ -226,8 +241,10 @@ typedef struct pa_word {
} pa_word;
#define PA_WORD(nm, ld, a, op, dc) { .name = (nm), .leader = (ld), .arg = (a), .opens = (op), .doc = (dc) }
-/* tick's flags: the pane has the keyboard in some view. */
+/* tick's flags: the pane has the keyboard in some view; 2.2: a frame of it
+ * was drawn since the last tick. */
#define PA_FOCUSED 0x1u
+#define PA_FRAMED 0x2u
typedef struct pa_head {
uint32_t size, abi;
@@ -309,8 +326,8 @@ _Static_assert(sizeof(pa_window) == 24, "pa_window");
_Static_assert(sizeof(pa_rect) == 16 && sizeof(pa_cells) == 8, "pa_rect");
_Static_assert(sizeof(pa_placement) == 80, "pa_placement");
_Static_assert(sizeof(pa_paint) == 128 && sizeof(pa_view) == 32, "pa_paint");
-_Static_assert(sizeof(pa_key) == 8 && sizeof(pa_mouse) == 10, "pa_key");
-_Static_assert(sizeof(pa_api) == 96 && sizeof(pa_out) == 16, "pa_api");
+_Static_assert(sizeof(pa_key) == 8 && sizeof(pa_mouse) == 16, "pa_key");
+_Static_assert(sizeof(pa_api) == 104 && sizeof(pa_out) == 16, "pa_api");
_Static_assert(sizeof(pa_word) == 32 && sizeof(pa_head) == 56, "pa_head");
_Static_assert(sizeof(pa_ops) == 200, "pa_ops");
#endif