aboutsummaryrefslogtreecommitdiffstats
path: root/src/app_draw.c
diff options
context:
space:
mode:
authorIngmar Steen <iksteen@gmail.com>2026-09-06 20:34:26 +0200
committerIngmar Steen <iksteen@gmail.com>2026-09-06 20:34:26 +0200
commit79a2812808061129bf1449d9f4c3356b36bf0061 (patch)
tree773ca521e7432af6e271bfb7f69ff2ab5047f1c9 /src/app_draw.c
parentgraphics: place what a float leaves of an image, not nothing (diff)
downloadslosh-79a2812808061129bf1449d9f4c3356b36bf0061.tar.gz
slosh-79a2812808061129bf1449d9f4c3356b36bf0061.tar.xz
slosh-79a2812808061129bf1449d9f4c3356b36bf0061.zip
app: cut the modals, toasts and splash out of the images under them
Overlays are painted over the panes and the compositor needs no more than that: painted later is on top. A placement is not painted, though -- the client's terminal draws the image over the cells, in whatever order they arrived -- so an overlay that is only drawn is an overlay an image sits on top of. The cheatsheet came up under a picture and was unreadable through it, in the terminal and in the mirror both. So a frame now records where its overlays landed, and the graphics pass takes them out of a placement exactly as it takes out a float: the modal's box (the cheatsheet and the picker wear the same frame), each toast, and the splash. The list is rebuilt every compose, so a rect that is not registered again is one that is no longer on screen. Only the opaque things are registered. The scrim behind a modal tints what is behind it rather than hiding it, and an image cannot be tinted by us at all -- so a picture beside the cheatsheet stays bright while the text around it is pushed back, which is wrong-looking but a great deal better than the image disappearing while a modal is up. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CRz3zwZJvBvzsR9k4cj6dd
Diffstat (limited to 'src/app_draw.c')
-rw-r--r--src/app_draw.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/app_draw.c b/src/app_draw.c
index c47a253..495add6 100644
--- a/src/app_draw.c
+++ b/src/app_draw.c
@@ -2520,11 +2520,16 @@ static void gfx_leaf_cb(node_t *n, void *ud) {
if (n->hidden || n->collapsed) return; /* not drawn: images included */
/* Above this leaf: every float for a tiled pane, the higher-raised for a
* float — the same order draw_floats paints in, so an image is clipped by
- * exactly what its cells are covered by. */
- rect_t occ[64];
+ * exactly what its cells are covered by. Then the frame's overlays, which
+ * are above the floats too: the cheatsheet, a toast, the splash. They are
+ * drawn as cells and a placement is not, so without this the terminal puts
+ * the picture back over the top of them -- the cheatsheet appearing under
+ * an image is what asked for this. */
+ rect_t occ[64 + APP_MAX_OVERLAYS];
size_t k = 0;
for (size_t i = 0; i < w->n; i++)
if (!n->floating || w->raised[i] > n->raised) occ[k++] = w->occ[i];
+ for (size_t i = 0; i < w->a->noverlays; i++) occ[k++] = w->a->overlays[i];
struct gfx_ctx ctx = {.a = w->a,
.out = w->out,
.leaf = n,
@@ -2817,6 +2822,10 @@ void draw_splash(app_t *a, screen_t *s) {
uint16_t x0 = (uint16_t)((s->cols - bw) / 2);
uint16_t y0 = (uint16_t)((s->rows - bh) / 2);
+ /* A cleared backdrop, so the logo reads over whatever a pane put there --
+ * including an image, which is cleared by being cut out of its placement
+ * rather than by writing cells over it. */
+ app_overlay(a, (rect_t){x0, y0, bw, bh});
/* A cleared backdrop, so the logo reads over whatever a pane put there. */
char blank[512];
size_t nb = bw < sizeof blank - 1 ? bw : sizeof blank - 1;