aboutsummaryrefslogtreecommitdiffstats
path: root/src/server.c
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-19 14:10:52 +0200
committeruser <user@clank>2026-08-19 14:10:52 +0200
commit1f5b55bc323e89399ec82eca392612ce2c0167a4 (patch)
tree84cffc149d0329117013debf04df8ac9c984f144 /src/server.c
parentslosh: split app.c into five units, mechanically (diff)
downloadslosh-1f5b55bc323e89399ec82eca392612ce2c0167a4.tar.gz
slosh-1f5b55bc323e89399ec82eca392612ce2c0167a4.tar.xz
slosh-1f5b55bc323e89399ec82eca392612ce2c0167a4.zip
slosh: greet an attach with the logo, wearing a random shader
logo.txt is the source of truth; the Makefile bakes it into build/logo.h the way version.h is baked. When a client attaches (MSG_HELLO turning a connection into the display), the logo appears centered over everything for splash_ms (900, 0 for never), on a cleared backdrop, in the accent -- and one of six effects runs over its rect through the ordinary shader pass: a diagonal sheen, plasma, rings, sparkle, a left-to-right reveal, a breathe. Which one is picked by the splash's own timestamp, so every attach looks a little different without anybody keeping a counter. Every effect reads the clock, so the frame clock runs only while the splash is up (note_animation, same as any animated chain), and `since` in a splash context is milliseconds since it appeared, so one-shot effects sweep exactly once. Any key or click ends it and still lands where it was aimed: a greeting is not a modal. A screen the box does not fit on gets no greeting rather than a cropped one. Headless and scripted sessions never attach, so the whole fast suite never sees it; {"cmd":"splash"} triggers it on demand, which is what makes it testable from a scripted session -- and lets you replay the greeting whenever you like.
Diffstat (limited to '')
-rw-r--r--src/server.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/server.c b/src/server.c
index 578ffff..4635e3b 100644
--- a/src/server.c
+++ b/src/server.c
@@ -428,6 +428,9 @@ int server_run(const char *name, const char *const argv[], uint16_t cols,
break;
}
s.conns[ci].display = true;
+ /* Someone is now looking, which is the one moment a greeting
+ * makes sense: a headless or scripted session never gets here. */
+ app_splash(s.app);
}
if (m.len >= 4 && s.conns[ci].display) {
uint16_t c = (uint16_t)(m.data[0] << 8 | m.data[1]);